From 8bde1d12a0cf5f2adec3b84b15ef08602d2fb0c9 Mon Sep 17 00:00:00 2001 From: Jiri Stransky Date: Fri, 12 Jul 2024 12:20:22 +0200 Subject: [PATCH 1/3] tripleo_cleanup: Fix a task that was always skipped and it shouldn't be Apparently the 'when' condition on a block is not evaluated only before the block begins executing, but it is evaluated for each task separately. That means that if the fact that is used in the 'when' condition changes during the block execution, it affects whether the following tasks in the block will execute or not. In our case, the "Filter for tripleo services" task set the tripleo_services fact, and due to that the following "Filter services in skip list" task never executed because the "when" condition on the block says to execute only if tripleo_services is empty. I've pulled the two set_fact tasks into a single one to get around this issue, since i didn't want to pollute the facts list with a temporary fact. (Facts can't be undefined.) Co-Authored-By: Joan F. Gilabert Navarro --- roles/edpm_tripleo_cleanup/tasks/main.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/roles/edpm_tripleo_cleanup/tasks/main.yml b/roles/edpm_tripleo_cleanup/tasks/main.yml index 38335919f..e96bad415 100644 --- a/roles/edpm_tripleo_cleanup/tasks/main.yml +++ b/roles/edpm_tripleo_cleanup/tasks/main.yml @@ -34,12 +34,9 @@ block: - name: Get all services ansible.builtin.service_facts: - - name: Filter for tripleo services + - name: Filter for tripleo services and skip the ones in skip list ansible.builtin.set_fact: - tripleo_services: "{{ ansible_facts.services.keys() | select('contains', 'tripleo') }}" - - name: Filter services in skip list - ansible.builtin.set_fact: - tripleo_services: "{{ tripleo_services | reject('in', edpm_service_removal_skip_list ) }}" + tripleo_services: "{{ ansible_facts.services.keys() | select('contains', 'tripleo') | reject('in', edpm_service_removal_skip_list ) }}" - name: Stop and disable tripleo services tags: From 5e4326e26511833e3bba02319b05a7118b005c4a Mon Sep 17 00:00:00 2001 From: Jiri Stransky Date: Mon, 15 Jul 2024 10:12:11 +0200 Subject: [PATCH 2/3] tripleo_cleanup: Add '.service' suffix into the skip list When the service list is fetched, the entries have the '.service' suffix on them. For the skip list to work as intended, we need to provide the suffix on the entries there too. --- roles/edpm_tripleo_cleanup/defaults/main.yml | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/roles/edpm_tripleo_cleanup/defaults/main.yml b/roles/edpm_tripleo_cleanup/defaults/main.yml index 649d77b2e..5e6fe98d6 100644 --- a/roles/edpm_tripleo_cleanup/defaults/main.yml +++ b/roles/edpm_tripleo_cleanup/defaults/main.yml @@ -24,16 +24,16 @@ edpm_remove_tripleo_unit_files: true # Keep services listed edpm_service_removal_skip_list: - - tripleo_swift_account_auditor - - tripleo_swift_account_reaper - - tripleo_swift_account_replicator - - tripleo_swift_account_server - - tripleo_swift_container_auditor - - tripleo_swift_container_replicator - - tripleo_swift_container_server - - tripleo_swift_container_updater - - tripleo_swift_object_auditor - - tripleo_swift_object_expirer - - tripleo_swift_object_replicator - - tripleo_swift_object_server - - tripleo_swift_object_updater + - tripleo_swift_account_auditor.service + - tripleo_swift_account_reaper.service + - tripleo_swift_account_replicator.service + - tripleo_swift_account_server.service + - tripleo_swift_container_auditor.service + - tripleo_swift_container_replicator.service + - tripleo_swift_container_server.service + - tripleo_swift_container_updater.service + - tripleo_swift_object_auditor.service + - tripleo_swift_object_expirer.service + - tripleo_swift_object_replicator.service + - tripleo_swift_object_server.service + - tripleo_swift_object_updater.service From bc8c70075366ff31bbe868bdbc6fdc39eeafe0f5 Mon Sep 17 00:00:00 2001 From: Jiri Stransky Date: Mon, 15 Jul 2024 11:29:36 +0200 Subject: [PATCH 3/3] Run adoption job on the edpm_tripleo_cleanup role --- zuul.d/projects.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 0bf267e76..f1f1ac388 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -50,3 +50,4 @@ - ^roles/edpm_ovn/* - ^roles/edpm_neutron_metadata/* - ^roles/edpm_pre_adoption_validation/* + - ^roles/edpm_tripleo_cleanup/*