From b51538ffbe6a10b4bf979463b4a5a1ef113a7c87 Mon Sep 17 00:00:00 2001 From: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:22:31 -0400 Subject: [PATCH] Fix reporting role as not found when remote_data is None (#81829) (#81836) (cherry picked from commit 7fab5525630f725e8e5ddb184c251bf6b9d7e53c) --- changelogs/fragments/fix-ansible-galaxy-info-no-role-found.yml | 2 ++ lib/ansible/cli/galaxy.py | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/fix-ansible-galaxy-info-no-role-found.yml 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 00000000000..96c1ef7a0f4 --- /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 7732c79a0d3..536964e28f9 100755 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -1229,6 +1229,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