From ae2234f185069d88032ee78b0179df946646d0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Thu, 18 Apr 2024 13:51:22 +0200 Subject: [PATCH] add countme option to yum_repository (#82831) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add countme option to yum_repository Signed-off-by: Thomas Sjögren * Update lib/ansible/modules/yum_repository.py Co-authored-by: Abhijeet Kasurde * add changelog fragment Signed-off-by: Thomas Sjögren * add version_added Signed-off-by: Thomas Sjögren * Update lib/ansible/modules/yum_repository.py Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> * Update lib/ansible/modules/yum_repository.py * Update lib/ansible/modules/yum_repository.py Co-authored-by: Martin Krizek * Update lib/ansible/modules/yum_repository.py --------- Signed-off-by: Thomas Sjögren Co-authored-by: Abhijeet Kasurde Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> Co-authored-by: Martin Krizek --- changelogs/fragments/82831_countme_yum_repository.yml | 2 ++ lib/ansible/modules/yum_repository.py | 9 +++++++++ test/integration/targets/yum_repository/tasks/main.yml | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 changelogs/fragments/82831_countme_yum_repository.yml diff --git a/changelogs/fragments/82831_countme_yum_repository.yml b/changelogs/fragments/82831_countme_yum_repository.yml new file mode 100644 index 00000000000..7f6bec4c487 --- /dev/null +++ b/changelogs/fragments/82831_countme_yum_repository.yml @@ -0,0 +1,2 @@ +bugfixes: + - support the countme option when using yum_repository diff --git a/lib/ansible/modules/yum_repository.py b/lib/ansible/modules/yum_repository.py index c171c6c611a..88f8cd065bd 100644 --- a/lib/ansible/modules/yum_repository.py +++ b/lib/ansible/modules/yum_repository.py @@ -50,6 +50,13 @@ options: - Relative cost of accessing this repository. Useful for weighing one repo's packages as greater/less than any other. type: str + countme: + description: + - Whether a special flag should be added to a randomly chosen metalink/mirrorlist query each week. + This allows the repository owner to estimate the number of systems consuming it. + default: ~ + type: bool + version_added: '2.18' deltarpm_metadata_percentage: description: - When the relative size of deltarpm metadata vs pkgs is larger than @@ -432,6 +439,7 @@ class YumRepo(object): 'bandwidth', 'baseurl', 'cost', + 'countme', 'deltarpm_metadata_percentage', 'deltarpm_percentage', 'enabled', @@ -581,6 +589,7 @@ def main(): bandwidth=dict(), baseurl=dict(type='list', elements='str'), cost=dict(), + countme=dict(type='bool'), deltarpm_metadata_percentage=dict(), deltarpm_percentage=dict(), description=dict(), diff --git a/test/integration/targets/yum_repository/tasks/main.yml b/test/integration/targets/yum_repository/tasks/main.yml index 7813af06ef2..5b50d7dfc1a 100644 --- a/test/integration/targets/yum_repository/tasks/main.yml +++ b/test/integration/targets/yum_repository/tasks/main.yml @@ -97,6 +97,7 @@ baseurl: "{{ yum_repository_test_repo.baseurl }}" description: New description async: no + countme: yes enablegroups: no file: "{{ yum_repository_test_repo.name ~ 2 }}" ip_resolve: 4 @@ -114,6 +115,7 @@ that: - "'async = 0' in repo_file_contents" - "'name = New description' in repo_file_contents" + - "'countme = 1' in repo_file_contents" - "'enablegroups = 0' in repo_file_contents" - "'ip_resolve = 4' in repo_file_contents" - "'keepalive = 0' in repo_file_contents" @@ -127,6 +129,7 @@ baseurl: "{{ yum_repository_test_repo.baseurl }}" description: New description async: no + countme: yes enablegroups: no file: "{{ yum_repository_test_repo.name ~ 2 }}" ip_resolve: 4