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/ (+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:

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
1=== modified file 'turku_agent/'
2--- turku_agent/ 2019-05-14 14:53:36 +0000
3+++ turku_agent/ 2019-05-23 14:19:32 +0000
4@@ -89,11 +89,30 @@
5 f.write(built_rsyncd_secrets)
8+def init_is_upstart():
9+ try:
10+ return 'upstart' in subprocess.check_output(
11+ ['initctl', 'version'],
12+ stderr=subprocess.DEVNULL, universal_newlines=True)
13+ except (FileNotFoundError, subprocess.CalledProcessError):
14+ return False
17 def start_services():
18 # Start rsyncd if it isn't already running.
19 # Note that we do *not* need to reload rsyncd when changing rsyncd.conf,
20 # as it rereads it on every client connection; but we may need to start
21 # it as it won't start if its configuration file doesn't exist.
22+ if init_is_upstart():
23+ # With Upstart, start will fail if the service is already running,
24+ # so we need to check for that first.
25+ try:
26+ if 'start/running' in subprocess.check_output(
27+ ['status', 'turku-agent-rsyncd'],
28+ stderr=subprocess.STDOUT, universal_newlines=True):
29+ return
30+ except subprocess.CalledProcessError:
31+ pass
32 subprocess.check_call(['service', 'turku-agent-rsyncd', 'start'])


People subscribed via source and target branches

to all changes: