From dba1df0dcc0790c3fc8090663c2c9f5206119935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Quatremain?= Date: Sat, 14 Dec 2024 12:17:15 +0100 Subject: [PATCH] Fix robot account federations for older versions of Quay (#19) --- .pre-commit-config.yaml | 2 +- CHANGELOG.rst | 8 ++++++++ changelogs/changelog.yaml | 10 ++++++++++ galaxy.yml | 2 +- plugins/modules/quay_robot.py | 5 ++++- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ddedabb..2254575 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: types: - yaml - repo: https://github.com/ansible/ansible-lint.git - rev: v24.10.0 + rev: v24.12.2 hooks: - id: ansible-lint types: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cd9a32e..26a6791 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,14 @@ Quay Container Registry Collection Release Notes .. contents:: Topics +v2.5.1 +====== + +Bugfixes +-------- + +- quay_robot - updating robot accounts failed for Quay versions prior to 3.13 because of the robot account federations feature introduced in this version of Quay. Fix now skip federation configuration if the ``federations`` parameter is not specified (https://github.com/redhat-cop/quay_configuration/issues/18). + v2.5.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index ee89334..af006e1 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -283,3 +283,13 @@ releases: fragments: - 17-v2.5.0-summary.yml release_date: '2024-11-26' + 2.5.1: + changes: + bugfixes: + - quay_robot - updating robot accounts failed for Quay versions prior to 3.13 + because of the robot account federations feature introduced in this version + of Quay. Fix now skip federation configuration if the ``federations`` parameter + is not specified (https://github.com/redhat-cop/quay_configuration/issues/18). + fragments: + - 19-v2.5.1-summary.yml + release_date: '2024-12-14' diff --git a/galaxy.yml b/galaxy.yml index cc0ae87..4695009 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: infra name: quay_configuration -version: 2.5.0 +version: 2.5.1 readme: README.md authors: - Hervé Quatremain diff --git a/plugins/modules/quay_robot.py b/plugins/modules/quay_robot.py index 8db757c..b248203 100644 --- a/plugins/modules/quay_robot.py +++ b/plugins/modules/quay_robot.py @@ -273,6 +273,9 @@ def main(): module.delete(robot_details, "robot account", name, path_url) if robot_details: + if federations is None: + exit_module(module, False, robot_details) + # GET /api/v1/organization/{orgname}/robots/{robot_shortname}/federation # [ # { @@ -288,7 +291,7 @@ def main(): ) fed_to_add = fed_req_set - fed_curr_set - if federations is None or fed_req_set == fed_curr_set or (append and not fed_to_add): + if fed_req_set == fed_curr_set or (append and not fed_to_add): exit_module(module, False, robot_details) if append: