From 5957af33553ef91d4b864a6173b258ef1dd338c8 Mon Sep 17 00:00:00 2001 From: git-harry Date: Wed, 27 Jan 2016 16:51:14 +0000 Subject: [PATCH] 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 --- playbooks/roles/os_swift/handlers/main.yml | 16 ++++------------ .../os_swift/tasks/swift_storage_hosts_setup.yml | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/playbooks/roles/os_swift/handlers/main.yml b/playbooks/roles/os_swift/handlers/main.yml index 5e8934190e..3d736e050b 100644 --- a/playbooks/roles/os_swift/handlers/main.yml +++ b/playbooks/roles/os_swift/handlers/main.yml @@ -62,17 +62,9 @@ name: "rsyslog" state: "restarted" -- name: Ensure rsync service stopped +- name: Restart rsync service service: name: "rsync" - state: "stopped" - register: service_restart - failed_when: "'msg' in service_restart and 'FAIL' in service_restart.msg|upper" - until: add_service|success - retries: 3 - delay: 2 - -- name: Ensure rsync service running - service: - name: "rsync" - state: "started" + state: "restarted" + enabled: "yes" + sleep: 2 diff --git a/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml b/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml index 2ad6b5bbb4..7062fc7b9f 100644 --- a/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml +++ b/playbooks/roles/os_swift/tasks/swift_storage_hosts_setup.yml @@ -38,14 +38,14 @@ owner: "root" group: "root" mode: "0644" - notify: ["Ensure rsync service stopped", "Ensure rsync service running"] + notify: "Restart rsync service" - name: "Enable rsync in defaults" lineinfile: dest: "/etc/default/rsync" line: "RSYNC_ENABLE=true" regexp: "^RSYNC_ENABLE*" - notify: ["Ensure rsync service stopped", "Ensure rsync service running"] + notify: "Restart rsync service" - name: "Setup swift-recon-cron cron job" cron: