From d9ed00fb12c619a2b63553f90937b11db85a762c Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:15:12 +0200 Subject: [PATCH] [PR #7375/eb4f8d43 backport][stable-6] Fix pagination issue in community.general.github_deploy_key (#7407) Fix pagination issue in community.general.github_deploy_key (#7375) * Fix pagination issue in community.general.github_deploy_key * Add changelog fragment * Update changelogs/fragments/7375-fix-github-deploy-key-pagination.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein (cherry picked from commit eb4f8d4301adcf4329e358b216e4696741479221) Co-authored-by: Padraic Calpin --- changelogs/fragments/7375-fix-github-deploy-key-pagination.yml | 3 +++ plugins/modules/github_deploy_key.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/7375-fix-github-deploy-key-pagination.yml diff --git a/changelogs/fragments/7375-fix-github-deploy-key-pagination.yml b/changelogs/fragments/7375-fix-github-deploy-key-pagination.yml new file mode 100644 index 0000000000..c95da981c6 --- /dev/null +++ b/changelogs/fragments/7375-fix-github-deploy-key-pagination.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - "github_deploy_key - fix pagination behaviour causing a crash when only a single page of deploy keys exist (https://github.com/ansible-collections/community.general/pull/7375)." \ No newline at end of file diff --git a/plugins/modules/github_deploy_key.py b/plugins/modules/github_deploy_key.py index 322650bf70..9e19d53ce6 100644 --- a/plugins/modules/github_deploy_key.py +++ b/plugins/modules/github_deploy_key.py @@ -227,7 +227,7 @@ class GithubDeployKey(object): yield self.module.from_json(resp.read()) links = {} - for x, y in findall(r'<([^>]+)>;\s*rel="(\w+)"', info["link"]): + for x, y in findall(r'<([^>]+)>;\s*rel="(\w+)"', info.get("link", '')): links[y] = x url = links.get('next')