From aa8abeeff3d17b440d4ea4e3897a3f925583df09 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 29 Apr 2022 09:47:46 +0200 Subject: [PATCH] repository - add support for ``mirroring_policy`` for Katello 4.4+ Fixes: #1388 --- .../1388-repository-mirroring_policy.yml | 2 ++ plugins/modules/repository.py | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/1388-repository-mirroring_policy.yml diff --git a/changelogs/fragments/1388-repository-mirroring_policy.yml b/changelogs/fragments/1388-repository-mirroring_policy.yml new file mode 100644 index 0000000000..8fc5be9b78 --- /dev/null +++ b/changelogs/fragments/1388-repository-mirroring_policy.yml @@ -0,0 +1,2 @@ +minor_changes: + - repository - add support for ``mirroring_policy`` for Katello 4.4+ (https://github.com/theforeman/foreman-ansible-modules/issues/1388) diff --git a/plugins/modules/repository.py b/plugins/modules/repository.py index e69987a52b..ae0f7f0140 100644 --- a/plugins/modules/repository.py +++ b/plugins/modules/repository.py @@ -131,9 +131,19 @@ mirror_on_sync: description: - toggle "mirror on sync" where the state of the repository mirrors that of the upstream repository at sync time - default: true + - This is deprecated with Katello 4.4 + - It has been superseeded by I(mirroring_policy=mirror_content_only) type: bool required: false + mirroring_policy: + description: + - Policy to set for mirroring content + - Supported since Katello 4.4 + type: str + choices: + - additive + - mirror_content_only + - mirror_complete verify_ssl_on_sync: description: - verify the upstream certifcates are signed by a trusted CA @@ -302,7 +312,8 @@ def main(): ssl_client_key=dict(type='entity', resource_type='content_credentials', scope=['organization'], no_log=False), download_policy=dict(choices=['background', 'immediate', 'on_demand']), download_concurrency=dict(type='int'), - mirror_on_sync=dict(type='bool', default=True), + mirror_on_sync=dict(type='bool'), + mirroring_policy=dict(type='str', choices=['additive', 'mirror_content_only', 'mirror_complete']), verify_ssl_on_sync=dict(type='bool'), upstream_username=dict(), upstream_password=dict(no_log=True), @@ -321,6 +332,9 @@ def main(): os_versions=dict(type='list', elements='str', choices=['rhel-6', 'rhel-7', 'rhel-8']), arch=dict(), ), + mutually_exclusive=[ + ['mirror_on_sync', 'mirroring_policy'] + ], argument_spec=dict( state=dict(default='present', choices=['present_with_defaults', 'present', 'absent']), ),