Merge lp:~cjwatson/turku/turku-agent-fix-rsyncd-interaction into lp:turku/turku-agent

Proposed by Colin Watson
Status: Merged
Approved by: Haw Loeung
Approved revision: 52
Merged at revision: 51
Proposed branch: lp:~cjwatson/turku/turku-agent-fix-rsyncd-interaction
Merge into: lp:turku/turku-agent
Diff against target: 32 lines (+19/-0)
1 file modified
turku_agent/update_config.py (+19/-0)
To merge this branch: bzr merge lp:~cjwatson/turku/turku-agent-fix-rsyncd-interaction
Reviewer Review Type Date Requested Status
Haw Loeung Approve
Review via email: mp+367847@code.launchpad.net

Commit message

On Upstart, check if turku-agent-rsyncd is already running before starting it.

Description of the change

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM, +1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 51

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'turku_agent/update_config.py'
--- turku_agent/update_config.py 2019-05-14 14:53:36 +0000
+++ turku_agent/update_config.py 2019-05-23 14:19:32 +0000
@@ -89,11 +89,30 @@
89 f.write(built_rsyncd_secrets)89 f.write(built_rsyncd_secrets)
9090
9191
92def init_is_upstart():
93 try:
94 return 'upstart' in subprocess.check_output(
95 ['initctl', 'version'],
96 stderr=subprocess.DEVNULL, universal_newlines=True)
97 except (FileNotFoundError, subprocess.CalledProcessError):
98 return False
99
100
92def start_services():101def start_services():
93 # Start rsyncd if it isn't already running.102 # Start rsyncd if it isn't already running.
94 # Note that we do *not* need to reload rsyncd when changing rsyncd.conf,103 # Note that we do *not* need to reload rsyncd when changing rsyncd.conf,
95 # as it rereads it on every client connection; but we may need to start104 # as it rereads it on every client connection; but we may need to start
96 # it as it won't start if its configuration file doesn't exist.105 # it as it won't start if its configuration file doesn't exist.
106 if init_is_upstart():
107 # With Upstart, start will fail if the service is already running,
108 # so we need to check for that first.
109 try:
110 if 'start/running' in subprocess.check_output(
111 ['status', 'turku-agent-rsyncd'],
112 stderr=subprocess.STDOUT, universal_newlines=True):
113 return
114 except subprocess.CalledProcessError:
115 pass
97 subprocess.check_call(['service', 'turku-agent-rsyncd', 'start'])116 subprocess.check_call(['service', 'turku-agent-rsyncd', 'start'])
98117
99118

Subscribers

People subscribed via source and target branches

to all changes: