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