launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23108
[Merge] lp:~cjwatson/charms/trusty/rutabaga/nrpe-compat into lp:~canonical-launchpad-branches/charms/trusty/rutabaga/devel
Colin Watson has proposed merging lp:~cjwatson/charms/trusty/rutabaga/nrpe-compat into lp:~canonical-launchpad-branches/charms/trusty/rutabaga/devel.
Commit message:
Support newer versions of the nrpe charm.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/charms/trusty/rutabaga/nrpe-compat/+merge/359748
This is a bit of a hack, but can be simplified once all deployments have been upgraded.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/charms/trusty/rutabaga/nrpe-compat into lp:~canonical-launchpad-branches/charms/trusty/rutabaga/devel.
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2016-12-09 13:08:30 +0000
+++ hooks/actions.py 2018-11-28 13:16:25 +0000
@@ -218,10 +218,18 @@
# Only makes sense with basenode.
if not config['log_hosts_allow']:
return
- concat_rsync_fragments = '/usr/local/bin/concat_rsync_fragments'
- if not os.path.exists(concat_rsync_fragments):
- return
- subprocess.check_call([concat_rsync_fragments])
+ # New versions of the nrpe charm use a different system that doesn't
+ # require manual concatenation.
+ concat = True
+ if os.path.exists('/etc/rsyncd.conf'):
+ with open('/etc/rsyncd.conf') as rsyncd_conf:
+ if '&include /etc/rsync-juju.d' in rsyncd_conf.read():
+ concat = False
+ if concat:
+ concat_rsync_fragments = '/usr/local/bin/concat_rsync_fragments'
+ if not os.path.exists(concat_rsync_fragments):
+ return
+ subprocess.check_call([concat_rsync_fragments])
service_restart('rsync')
=== modified file 'hooks/services.py'
--- hooks/services.py 2016-04-25 16:51:10 +0000
+++ hooks/services.py 2018-11-28 13:16:25 +0000
@@ -22,11 +22,21 @@
owner=owner, group=group, perms=perms)
+def render_old_rsync_template(config):
+ if config['log_hosts_allow']:
+ return helpers.render_template(
+ source='rutabaga-rsync.j2',
+ target='/etc/rsyncd.d/010-rutabaga',
+ perms=0o644)
+ else:
+ return lambda _: None
+
+
def render_rsync_template(config):
if config['log_hosts_allow']:
return helpers.render_template(
source='rutabaga-rsync.j2',
- target='/etc/rsyncd.d/010-rutabaga',
+ target='/etc/rsync-juju.d/010-rutabaga.conf',
perms=0o644)
else:
return lambda _: None
Follow ups