From 2484d97f1b2f6b8ac4cc9427012f0c1fc52ea132 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 7 Dec 2021 12:19:22 +0000 Subject: [PATCH] pulp_repository: Fix remote removal with state=absent Since remotes were made optional, they no longer get removed when state=absent. This change fixes the issue. --- roles/pulp_repository/tasks/container.yml | 2 +- roles/pulp_repository/tasks/deb.yml | 2 +- roles/pulp_repository/tasks/python.yml | 2 +- roles/pulp_repository/tasks/rpm.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/pulp_repository/tasks/container.yml b/roles/pulp_repository/tasks/container.yml index b534564..3724a4e 100644 --- a/roles/pulp_repository/tasks/container.yml +++ b/roles/pulp_repository/tasks/container.yml @@ -35,7 +35,7 @@ url: "{{ item.url | default(omit) }}" state: "{{ item.state }}" with_items: "{{ pulp_repository_container_repos }}" - when: item.url is defined + when: item.state == "absent" or item.url is defined loop_control: label: "{{ item.name }}" diff --git a/roles/pulp_repository/tasks/deb.yml b/roles/pulp_repository/tasks/deb.yml index 5acc48f..a3f5efe 100644 --- a/roles/pulp_repository/tasks/deb.yml +++ b/roles/pulp_repository/tasks/deb.yml @@ -35,7 +35,7 @@ url: "{{ item.url | default(omit) }}" state: "{{ item.state }}" with_items: "{{ pulp_repository_deb_repos }}" - when: item.url is defined + when: item.state == "absent" or item.url is defined loop_control: label: "{{ item.name }}" diff --git a/roles/pulp_repository/tasks/python.yml b/roles/pulp_repository/tasks/python.yml index 04fe2b1..cc2a1f1 100644 --- a/roles/pulp_repository/tasks/python.yml +++ b/roles/pulp_repository/tasks/python.yml @@ -35,7 +35,7 @@ url: "{{ item.url | default(omit) }}" state: "{{ item.state }}" with_items: "{{ pulp_repository_python_repos }}" - when: item.url is defined + when: item.state == "absent" or item.url is defined loop_control: label: "{{ item.name }}" diff --git a/roles/pulp_repository/tasks/rpm.yml b/roles/pulp_repository/tasks/rpm.yml index ec9898d..904e3d9 100644 --- a/roles/pulp_repository/tasks/rpm.yml +++ b/roles/pulp_repository/tasks/rpm.yml @@ -32,7 +32,7 @@ url: "{{ item.url | default(omit) }}" state: "{{ item.state }}" with_items: "{{ pulp_repository_rpm_repos }}" - when: item.url is defined + when: item.state == "absent" or item.url is defined loop_control: label: "{{ item.name }}"