Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,13 @@
$bindir = pick($bindir, "/usr/lib/postgresql/${version}/bin")
$datadir = pick($datadir, "/var/lib/postgresql/${version}/main")
$confdir = pick($confdir, "/etc/postgresql/${version}/main")
if $facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '8') >= 0 {
# Jessie uses systemd
$service_status = pick($service_status, "/usr/sbin/service ${service_name}@*-main status")
} elsif $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '18.04') >= 0 {
$service_status = pick($service_status, "/usr/sbin/service ${service_name}@*-main status")
} elsif $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '15.04') >= 0 {
# Ubuntu releases since vivid use systemd
$service_status = pick($service_status, "/usr/sbin/service ${service_name} status")
if pick($service_provider, $facts['service_provider']) == 'systemd' {
$service_reload = "systemctl reload ${service_name}"
$service_status = pick($service_status, "systemctl status ${service_name}")
} else {
$service_status = pick($service_status, "/etc/init.d/${service_name} status | /bin/egrep -q 'Running clusters: .+|online'")
$service_reload = "service ${service_name} reload"
$service_status = pick($service_status, "service ${service_name} status")
Comment on lines -172 to +174
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think these paths need to be absolute.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I cheated a bit, as it moved from /bin/ to /usr/bin/ or the other way around, but I think both work anyway (as does omitting the path, but I agree, having full path is better :) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh disregard that, I copy/pasted this bit, throughout that file the commands are used without absolute path. I think we could/should change that, but I think now local style is "without full path"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be OK with that (I've seen that Puppet does apply $PATH to it, unlike exec), but then the unit tests should match.

}
$service_reload = "service ${service_name} reload"
$psql_path = pick($psql_path, '/usr/bin/psql')
$postgresql_conf_mode = pick($postgresql_conf_mode, '0644')
}
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/server/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
end

it { is_expected.to contain_class('postgresql::server::service') }
it { is_expected.to contain_service('postgresqld').with_name('postgresql').with_status('/usr/sbin/service postgresql@*-main status') }
it { is_expected.to contain_service('postgresqld').with_name('postgresql').with_status('systemctl status postgresql') }
end
2 changes: 1 addition & 1 deletion spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
it { is_expected.to contain_class('postgresql::server') }
it { is_expected.to contain_file('/var/lib/postgresql/13/main') }
it {
is_expected.to contain_exec('postgresql_reload').with('command' => 'service postgresql reload')
is_expected.to contain_exec('postgresql_reload').with('command' => 'systemctl reload postgresql')
}
it 'validates connection' do
is_expected.to contain_postgresql_conn_validator('validate_service_is_running')
Expand Down