From 0e4b7aef26db80fd6a5c7b038838866006a250f2 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 09:32:16 +0100 Subject: [PATCH] deploy_helper: fix a bug when not defining release on state=clean (#1859) (#1876) * Fix a bug when not defining release on state=clean * Add changelog fragment (cherry picked from commit abfbe2a48d45f22479e214dc5ff5dd7c80c8b034) Co-authored-by: Ramon de la Fuente --- .../1852-deploy-helper-fix-state-is-clean-without-release.yaml | 2 ++ plugins/modules/web_infrastructure/deploy_helper.py | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/1852-deploy-helper-fix-state-is-clean-without-release.yaml diff --git a/changelogs/fragments/1852-deploy-helper-fix-state-is-clean-without-release.yaml b/changelogs/fragments/1852-deploy-helper-fix-state-is-clean-without-release.yaml new file mode 100644 index 0000000000..0946a4f38f --- /dev/null +++ b/changelogs/fragments/1852-deploy-helper-fix-state-is-clean-without-release.yaml @@ -0,0 +1,2 @@ +bugfixes: + - deploy_helper - allow ``state=clean`` to be used without defining a ``release`` (https://github.com/ansible-collections/community.general/issues/1852). \ No newline at end of file diff --git a/plugins/modules/web_infrastructure/deploy_helper.py b/plugins/modules/web_infrastructure/deploy_helper.py index 641cc1d4ec..a07281819b 100644 --- a/plugins/modules/web_infrastructure/deploy_helper.py +++ b/plugins/modules/web_infrastructure/deploy_helper.py @@ -408,6 +408,9 @@ class DeployHelper(object): def remove_unfinished_link(self, path): changed = False + if not self.release: + return changed + tmp_link_name = os.path.join(path, self.release + '.' + self.unfinished_filename) if not self.module.check_mode and os.path.exists(tmp_link_name): changed = True