From ee2d7cd21bbbf57ccde8d6453ad5144661a6d948 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:15:17 +0200 Subject: [PATCH] [PR #7375/eb4f8d43 backport][stable-7] Fix pagination issue in community.general.github_deploy_key (#7408) 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 b65f635801..ae90e04c91 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')