From 45c7e49c4244c2e26ea9adb2613315164ae275b6 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Fri, 28 Apr 2017 16:42:25 +0100 Subject: [PATCH] Only use handler on filtered services Since we create a filtered list of services we should use the handler to only restart those services, rather than all services. Additionally, we no longer need to check "service_en" since that will happen when the services are filtered. We can then check if the service exists before performing the metadata-proxy cleanup. Change-Id: I4ca3d90123e146d09cab20a0eda627014d9717e6 Depends-On: Ic152cfb01930d8bde10ea6d9aa5bba173a87e376 --- handlers/main.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 5dc0f918..2771745b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -28,8 +28,7 @@ enabled: yes state: "stopped" daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" - with_dict: "{{ neutron_services }}" - when: item.value.service_en | bool + with_dict: "{{ filtered_neutron_services }}" register: _stop until: _stop | success retries: 5 @@ -53,7 +52,7 @@ fi fi done - when: neutron_services['neutron-metadata-agent'].service_en | bool + when: '"neutron-metadata-agent" in filtered_neutron_services' # Note (odyssey4me): # The policy.json file is currently read continually by the services @@ -75,8 +74,7 @@ enabled: yes state: "started" daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" - with_dict: "{{ neutron_services }}" - when: item.value.service_en | bool + with_dict: "{{ filtered_neutron_services }}" register: _start until: _start | success retries: 5