← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/turnip:charm-reload-systemd-after-unmask into turnip:master

 

Colin Watson has proposed merging ~cjwatson/turnip:charm-reload-systemd-after-unmask into turnip:master.

Commit message:
charm: Reload systemd after unmasking srv-turnip-data.mount

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/turnip/+git/turnip/+merge/389648

CI is currently showing suspicious symptoms like this:

  2020-08-20 23:54:36 DEBUG nfs-relation-changed Created symlink /etc/systemd/system/srv-turnip-data.mount → /dev/null.
  2020-08-20 23:54:36 DEBUG juju-log nfs:17: Writing file /lib/systemd/system/srv-turnip-data.mount root:root 644
  2020-08-20 23:54:37 DEBUG nfs-relation-changed Removed /etc/systemd/system/srv-turnip-data.mount.
  ...
  2020-08-20 23:54:56 DEBUG amqp-relation-changed Failed to start turnip-celery.service: Unit srv-turnip-data.mount is masked.

But srv-turnip-data.mount shouldn't be masked at this point, because /etc/systemd/system/srv-turnip-data.mount (the masking symlink) was removed.  systemctl(1) doesn't explicitly say that unmask has the additional effect of daemon-reload, so my best theory is that we should explicitly call daemon-reload after unmask.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/turnip:charm-reload-systemd-after-unmask into turnip:master.
diff --git a/charm/layer/turnip-storage/lib/charms/turnip/storage.py b/charm/layer/turnip-storage/lib/charms/turnip/storage.py
index 86785fb..b4cc3ea 100644
--- a/charm/layer/turnip-storage/lib/charms/turnip/storage.py
+++ b/charm/layer/turnip-storage/lib/charms/turnip/storage.py
@@ -30,8 +30,8 @@ def mount_data(mount_info):
     context = dict(mount_info)
     context['data_dir'] = data_dir()
     templating.render('data.mount.j2', data_mount_conf, context, perms=0o644)
-    reload_systemd()
     host.service('unmask', data_mount)
+    reload_systemd()
     host.service_restart(data_mount)
     # systemctl shouldn't return successfully unless the mount completed,
     # but let's make sure.