summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSloane Hertel <19572925+s-hertel@users.noreply.github.com>2023-10-02 18:11:12 +0200
committerGitHub <noreply@github.com>2023-10-02 18:11:12 +0200
commit7fab5525630f725e8e5ddb184c251bf6b9d7e53c (patch)
treeabaa47dc0bd1caf862d5c2258f8a7a6a7e56b1a7
parentUpdate winrm.py (#81817) (diff)
downloadansible-7fab5525630f725e8e5ddb184c251bf6b9d7e53c.tar.xz
ansible-7fab5525630f725e8e5ddb184c251bf6b9d7e53c.zip
Fix reporting role as not found when remote_data is None (#81829)
-rw-r--r--changelogs/fragments/fix-ansible-galaxy-info-no-role-found.yml2
-rwxr-xr-xlib/ansible/cli/galaxy.py3
2 files changed, 5 insertions, 0 deletions
diff --git a/changelogs/fragments/fix-ansible-galaxy-info-no-role-found.yml b/changelogs/fragments/fix-ansible-galaxy-info-no-role-found.yml
new file mode 100644
index 0000000000..96c1ef7a0f
--- /dev/null
+++ b/changelogs/fragments/fix-ansible-galaxy-info-no-role-found.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - ansible-galaxy info - fix reporting no role found when lookup_role_by_name returns None.
diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py
index e3b0b1703f..65dd8aa4ff 100755
--- a/lib/ansible/cli/galaxy.py
+++ b/lib/ansible/cli/galaxy.py
@@ -1265,6 +1265,9 @@ class GalaxyCLI(CLI):
if remote_data:
role_info.update(remote_data)
+ else:
+ data = u"- the role %s was not found" % role
+ break
elif context.CLIARGS['offline'] and not gr._exists:
data = u"- the role %s was not found" % role