Fix rsync service restart in os_swift

The rsync service is currently restarted using two handlers, one to stop
the service and a second to start it. There is not a sufficient delay
between the two task and so the rsync pid has not been removed before
the attempt is made to start the service.

This commit replaces the two handlers with a single one that will do the
restart in one go.

Change-Id: I8ed4630da1add7205552b6ec731a143dbe45112b
Closes-bug: 1538649
This commit is contained in:
git-harry
2016-01-27 16:51:14 +00:00
parent 918be83c6e
commit 5957af3355
2 changed files with 6 additions and 14 deletions

View File

@@ -62,17 +62,9 @@
name: "rsyslog" name: "rsyslog"
state: "restarted" state: "restarted"
- name: Ensure rsync service stopped - name: Restart rsync service
service: service:
name: "rsync" name: "rsync"
state: "stopped" state: "restarted"
register: service_restart enabled: "yes"
failed_when: "'msg' in service_restart and 'FAIL' in service_restart.msg|upper" sleep: 2
until: add_service|success
retries: 3
delay: 2
- name: Ensure rsync service running
service:
name: "rsync"
state: "started"

View File

@@ -38,14 +38,14 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
notify: ["Ensure rsync service stopped", "Ensure rsync service running"] notify: "Restart rsync service"
- name: "Enable rsync in defaults" - name: "Enable rsync in defaults"
lineinfile: lineinfile:
dest: "/etc/default/rsync" dest: "/etc/default/rsync"
line: "RSYNC_ENABLE=true" line: "RSYNC_ENABLE=true"
regexp: "^RSYNC_ENABLE*" regexp: "^RSYNC_ENABLE*"
notify: ["Ensure rsync service stopped", "Ensure rsync service running"] notify: "Restart rsync service"
- name: "Setup swift-recon-cron cron job" - name: "Setup swift-recon-cron cron job"
cron: cron: