Merge lp:~paulgear/charm-helpers/enable-disable-service-systemd into lp:charm-helpers

Proposed by Paul Gear
Status: Merged
Merged at revision: 745
Proposed branch: lp:~paulgear/charm-helpers/enable-disable-service-systemd
Merge into: lp:charm-helpers
Diff against target: 19 lines (+2/-0)
1 file modified
charmhelpers/core/host.py (+2/-0)
To merge this branch: bzr merge lp:~paulgear/charm-helpers/enable-disable-service-systemd
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
charmers Pending
Review via email: mp+324361@code.launchpad.net

Description of the change

See lp:1692178 for background on this. This is a fairly simplistic solution, but the mask/unmask has been left in place, in order not to break anything which relies on masked behaviour from systemd-controlled services. I suspect there are no charms which do this, but have no way to be sure; so this is the safe solution which makes enabling services work.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

How does this address lp:1692178 ? My understanding is that the disable/enable will not have any effect and with the mask still in place pause/resume will still fail.

review: Needs Information
Revision history for this message
Stuart Bishop (stub) wrote :

The unmask of course is happening before the enable, so this is fine. While the disable + mask may be redundant, the unmask + enable is not for the case where a service is disabled but not masked.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/core/host.py'
2--- charmhelpers/core/host.py 2017-04-11 11:42:53 +0000
3+++ charmhelpers/core/host.py 2017-05-20 06:09:38 +0000
4@@ -191,6 +191,7 @@
5 upstart_file = os.path.join(init_dir, "{}.conf".format(service_name))
6 sysv_file = os.path.join(initd_dir, service_name)
7 if init_is_systemd():
8+ service('disable', service_name)
9 service('mask', service_name)
10 elif os.path.exists(upstart_file):
11 override_path = os.path.join(
12@@ -225,6 +226,7 @@
13 sysv_file = os.path.join(initd_dir, service_name)
14 if init_is_systemd():
15 service('unmask', service_name)
16+ service('enable', service_name)
17 elif os.path.exists(upstart_file):
18 override_path = os.path.join(
19 init_dir, '{}.override'.format(service_name))

Subscribers

People subscribed via source and target branches