Skip to content

Commit

Permalink
fix #526 Set default of host to localhost for feature idopgsql
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Feb 12, 2019
1 parent 54084ec commit 38f173a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ configuration of Icinga 2 on multiple operating systems.
* Parameter ssl_crl_path was renamed to ssl_crl.
* Feature `idopgsql`
* Parameter `password` is required now.
* Parameter default for `host` is set to `localhost`
* Feature `idomysql`
* Parameter `password` is required now.
* Parameter default for `host` is set to `localhost`
Expand Down Expand Up @@ -1426,10 +1427,10 @@ Enables or disables the `ido-pgsql` feature.
Either `present` or `absent`. Defines if the feature `ido-pgsql` should be enabled. Defaults to `present`.

##### `host`
PostgreSQL database host address. Icinga defaults to `localhost`.
PostgreSQL database host address. Defaults to `localhost`.

##### `port`
PostgreSQL database port. Icinga defaults to `3306`.
PostgreSQL database port. Defaults to `5432`.

##### `user`
PostgreSQL database user with read/write permission to the icinga database. Icinga defaults to `icinga`.
Expand Down
2 changes: 1 addition & 1 deletion data/Windows-kernel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ icinga2::globals::group: null
icinga2::globals::ido_mysql_package_name: null
icinga2::globals::ido_mysql_schema: C:/Program Files/icinga2/usr/share/icinga2-ido-mysql/schema/mysql.sql
icinga2::globals::ido_pgsql_package_name: null
icinga2::globals::ido_pgsql_schema: C:/Program Files/icinga2/usr/share/icinga2-ido-mysql/schema/pgsql.sql
icinga2::globals::ido_pgsql_schema: C:/Program Files/icinga2/usr/share/icinga2-ido-pgsql/schema/pgsql.sql
icinga2::globals::icinga2_bin: C:/Program Files/icinga2/sbin/icinga2.exe
icinga2::globals::conf_dir: C:/ProgramData/icinga2/etc/icinga2
icinga2::globals::lib_dir: C:/Program Files/icinga2/usr/lib
Expand Down
1 change: 0 additions & 1 deletion examples/init_idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
}

class{ 'icinga2::feature::idopgsql':
host => '127.0.0.1',
user => "icinga2",
password => "supersecret",
database => "icinga2",
Expand Down
4 changes: 2 additions & 2 deletions manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Set to present enables the feature ido-pgsql, absent disables it. Defaults to present.
#
# [*host*]
# PostgreSQL database host address. Defaults to '127.0.0.1'.
# PostgreSQL database host address. Defaults to 'localhost'.
#
# [*port*]
# PostgreSQL database port. Defaults to '5432'.
Expand Down Expand Up @@ -74,7 +74,7 @@
class icinga2::feature::idopgsql(
String $password,
Enum['absent', 'present'] $ensure = present,
Stdlib::Host $host = '127.0.0.1',
Stdlib::Host $host = 'localhost',
Stdlib::Port::Unprivileged $port = 5432,
String $user = 'icinga',
String $database = 'icinga',
Expand Down
14 changes: 9 additions & 5 deletions spec/classes/idopgsql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
when 'windows'
@icinga2_conf_dir = 'C:/ProgramData/icinga2/etc/icinga2'
@icinga2_pki_dir = 'C:/ProgramData/icinga2/var/lib/icinga2/certs'
@ido_mysql_schema_dir = 'C:/Program Files/icinga2/usr/share/icinga2-ido-mysql/schema'
@ido_pgsql_schema_dir = 'C:/Program Files/icinga2/usr/share/icinga2-ido-pgsql/schema'
@icinga2_sslkey_mode = nil
@icinga2_user = nil
@icinga2_group = nil
when 'FreeBSD'
@icinga2_conf_dir = '/usr/local/etc/icinga2'
@icinga2_pki_dir = '/var/lib/icinga2/certs'
@ido_mysql_schema_dir = '/usr/local/share/icinga2-ido-mysql/schema'
@ido_pgsql_schema_dir = '/usr/local/share/icinga2-ido-pgsql/schema'
@icinga2_sslkey_mode = '0600'
@icinga2_user = 'icinga'
@icinga2_group = 'icinga'
else
@icinga2_conf_dir = '/etc/icinga2'
@icinga2_pki_dir = '/var/lib/icinga2/certs'
@ido_mysql_schema_dir = '/usr/share/icinga2-ido-mysql/schema'
@ido_pgsql_schema_dir = '/usr/share/icinga2-ido-pgsql/schema'
@icinga2_sslkey_mode = '0600'
case facts[:osfamily]
when 'Debian'
Expand Down Expand Up @@ -81,11 +81,15 @@
}
end

it { is_expected.to contain_exec('idopgsql-import-schema') }
it { is_expected.to contain_exec('idopgsql-import-schema')
.with({
'user' => 'root',
'environment' => ["PGPASSWORD=foo"],
'command' => "psql -h 'localhost' -U 'icinga' -p '5432' -d 'icinga' -w -f #{@ido_pgsql_schema_dir}/pgsql.sql" }) }
end

if facts[:kernel] == 'Linux'
context "with icinga2::manage_package => false" do
context "with manage_package => false" do
let(:params) do
{
:password => 'foo'
Expand Down

0 comments on commit 38f173a

Please sign in to comment.