From 97be34a7559cd458edd612861ca7c7311f574ae6 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Fri, 19 Feb 2021 09:36:24 +0100 Subject: [PATCH] Do not run tripleo_ha_wrapper when the HA service has no config_volume If a service has no config_volume, it means it has not config file, so there is no point in trying to restart the service when any of the configuration files change. Case in point, ovn_dbs currently generates an empty puppet config_volume. The only reason this works now is that the tripleo plugin that calls container-puppet.sh, will generate an empty folder even though no config is generated. Let's make this less fragile. Change-Id: I5199cf5fd20590a2aa1af5c52ef805067f995366 --- tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml b/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml index ec4381869..122bdcf95 100644 --- a/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml @@ -56,6 +56,11 @@ changed_when: puppet_run.rc == 2 failed_when: puppet_run.rc != 2 and puppet_run.rc != 0 +- name: "Check if {{ tripleo_ha_wrapper_config_basedir }}/{{ tripleo_ha_wrapper_puppet_config_volume }} exists" + stat: + path: "{{ tripleo_ha_wrapper_config_basedir }}/{{ tripleo_ha_wrapper_puppet_config_volume }}.md5sum" + register: config_volume_md5 + - name: Run pacemaker restart if the config file for the service changed tripleo_diff_exec: command: >- @@ -66,3 +71,5 @@ state_file_suffix: "{{ tripleo_ha_wrapper_config_suffix }}" environment: TRIPLEO_MINOR_UPDATE: "{{ tripleo_ha_wrapper_minor_update|default('') }}" + when: + - (config_volume_md5.stat.exists | bool)