Skip to content

Commit

Permalink
Fixes #34824 - properly restart foreman when puma config changed
Browse files Browse the repository at this point in the history
we need to restart foreman.service *before* a (possible) restart of
foreman.socket, as the later *also* does restart foreman.service which
leads to foreman.socket being *started* instead of *restarted*

    /Service[foreman.socket]: Starting to evaluate the resource (2265 of 2522)
    Executing: '/bin/systemctl is-active -- foreman.socket'
    Executing: '/bin/systemctl restart -- foreman.socket'
    /Service[foreman]: Starting to evaluate the resource (2266 of 2522)
    Executing: '/bin/systemctl is-active -- foreman'
    Executing: '/bin/systemctl show --property=NeedDaemonReload -- foreman'
    Executing: '/bin/systemctl daemon-reload'
    Executing: '/bin/systemctl unmask -- foreman'
    Executing: '/bin/systemctl start -- foreman'
    Executing: '/bin/systemctl is-enabled -- foreman'
    /Stage[main]/Foreman::Service/Service[foreman]/ensure: ensure changed 'stopped' to 'running'

But in this case the now running foreman.service didn't see the changes
to the service file that daemon-reload would have loaded.
  • Loading branch information
evgeni committed Apr 26, 2022
1 parent 1d28765 commit eb32056
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
}

service { $foreman_service:
ensure => $foreman_service_ensure,
enable => $foreman_service_enable,
require => Service["${foreman_service}.socket"],
ensure => $foreman_service_ensure,
enable => $foreman_service_enable,
before => Service["${foreman_service}.socket"],
}
}
4 changes: 2 additions & 2 deletions spec/classes/foreman_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_service('foreman.socket').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true).that_comes_before('Service[foreman.socket]') }
end

context 'with apache' do
Expand All @@ -34,7 +34,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('foreman::service').that_requires('Class[apache::service]') }
it { is_expected.to contain_service('foreman.socket').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true).that_comes_before('Service[foreman.socket]') }

context 'without ssl' do
let(:params) { super().merge(ssl: false) }
Expand Down

0 comments on commit eb32056

Please sign in to comment.