From 9e8fb5b7f535dabfe9cb365091bab7831e5ae5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Thu, 23 Jan 2020 21:06:44 +0100 Subject: [PATCH] galaxy: fix AttributeError on empty requirements.yml (#66726) * galaxy: fix AttributeError on empty requirements.yml * add changelog --- changelogs/fragments/66726-galaxy-fix-attribute-error.yml | 2 ++ lib/ansible/cli/galaxy.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/66726-galaxy-fix-attribute-error.yml diff --git a/changelogs/fragments/66726-galaxy-fix-attribute-error.yml b/changelogs/fragments/66726-galaxy-fix-attribute-error.yml new file mode 100644 index 00000000000..469dfd9ad96 --- /dev/null +++ b/changelogs/fragments/66726-galaxy-fix-attribute-error.yml @@ -0,0 +1,2 @@ +bugfixes: + - galaxy - Fix an AttributeError on ansible-galaxy install with an empty requirements.yml (https://github.com/ansible/ansible/issues/66725). diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index ef86e8a7abe..f16616d32e2 100644 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -428,7 +428,7 @@ class GalaxyCLI(CLI): "Failed to parse the requirements yml at '%s' with the following error:\n%s" % (to_native(requirements_file), to_native(err))) - if requirements_file is None: + if file_requirements is None: raise AnsibleError("No requirements found in file '%s'" % to_native(requirements_file)) def parse_role_req(requirement):