Skip to content

Commit

Permalink
Replace icinga2::db::connect function with icinga::db::connect from m…
Browse files Browse the repository at this point in the history
…odule icinga
  • Loading branch information
lbetz committed Dec 22, 2023
1 parent 9f53f91 commit 54a798f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 146 deletions.
51 changes: 0 additions & 51 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ start on boot and will be restarted if stopped.
### Functions

* [`icinga2::cert`](#icinga2--cert): Choose the path of tls key, cert and ca file.
* [`icinga2::db::connect`](#icinga2--db--connect): This function returns a string to connect databases
with or without TLS information.
* [`icinga2::icinga2_attributes`](#icinga2--icinga2_attributes): Calls the simple parser to decide what to quote.
For more information, see lib/puppet_x/icinga2/utils.rb.
* [`icinga2::icinga2_ticket_id`](#icinga2--icinga2_ticket_id): Summarise what the function does here
Expand Down Expand Up @@ -5587,55 +5585,6 @@ Data type: `Optional[String]`



### <a name="icinga2--db--connect"></a>`icinga2::db::connect`

Type: Puppet Language

This function returns a string to connect databases
with or without TLS information.

#### `icinga2::db::connect(Struct[{
type => Enum['pgsql','mysql','mariadb'],
host => Stdlib::Host,
port => Optional[Stdlib::Port],
database => String,
username => String,
password => Optional[Variant[String, Sensitive[String]]],
}] $db, Hash[String, Any] $tls, Optional[Boolean] $use_tls = undef)`

The icinga2::db::connect function.

Returns: `String` Connection string to connect database.

##### `db`

Data type:

```puppet
Struct[{
type => Enum['pgsql','mysql','mariadb'],
host => Stdlib::Host,
port => Optional[Stdlib::Port],
database => String,
username => String,
password => Optional[Variant[String, Sensitive[String]]],
}]
```



##### `tls`

Data type: `Hash[String, Any]`



##### `use_tls`

Data type: `Optional[Boolean]`



### <a name="icinga2--icinga2_attributes"></a>`icinga2::icinga2_attributes`

Type: Ruby 4.x API
Expand Down
89 changes: 0 additions & 89 deletions functions/db/connect.pp

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/feature/idomysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
Package[$ido_mysql_package_name] -> Exec['idomysql-import-schema']
}

$db_cli_options = icinga2::db::connect({
$db_cli_options = icinga::db::connect({
'type' => $type,
'host' => $host,
'port' => $port,
Expand Down
2 changes: 1 addition & 1 deletion manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
Package[$ido_pgsql_package_name] -> Exec['idopgsql-import-schema']
}

$db_cli_options = icinga2::db::connect({
$db_cli_options = icinga::db::connect({
'type' => 'pgsql',
'host' => $host,
'port' => $port,
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/idomysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
is_expected.to contain_exec('idomysql-import-schema').with(
{
user: 'root',
command: "mysql -u icinga -p'foo' -D icinga < \"#{ido_mysql_schema_dir}/mysql.sql\"",
command: "mysql -u icinga -p'foo' -D icinga < \"#{ido_mysql_schema_dir}/mysql.sql\"",
},
)
}
Expand Down Expand Up @@ -186,7 +186,7 @@
is_expected.to contain_exec('idomysql-import-schema').with(
{
'user' => 'root',
'command' => "mysql -h 127.0.0.1 -P 3306 -u icinga -p'foo' -D icinga --ssl --ssl-ca #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql_ca.crt" \
'command' => "mysql -h 127.0.0.1 -P 3306 -u icinga -p'foo' -D icinga --ssl --ssl-ca #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql_ca.crt" \
" --ssl-cert #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql.crt --ssl-key #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql.key < \"#{ido_mysql_schema_dir}/mysql.sql\"",
},
)
Expand Down Expand Up @@ -227,7 +227,7 @@
is_expected.to contain_exec('idomysql-import-schema').with(
{
'user' => 'root',
'command' => "mysql -u icinga -p'foo' -D icinga --ssl --ssl-ca #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql_ca.crt" \
'command' => "mysql -u icinga -p'foo' -D icinga --ssl --ssl-ca #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql_ca.crt" \
" --ssl-cert #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql.crt --ssl-key #{icinga2_pki_dir}/IdoMysqlConnection_ido-mysql.key < \"#{ido_mysql_schema_dir}/mysql.sql\"",
},
)
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/idopgsql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
{
'user' => 'root',
'environment' => ['PGPASSWORD=foo'],
'command' => "psql 'host=localhost user=icinga dbname=icinga ' -w -f '#{ido_pgsql_schema_dir}/pgsql.sql'",
'command' => "psql 'host=localhost user=icinga dbname=icinga' -w -f '#{ido_pgsql_schema_dir}/pgsql.sql'",
},
)
}
Expand Down

0 comments on commit 54a798f

Please sign in to comment.