Skip to content

Commit 458f2a8

Browse files
committed
add custom_cdn support
1 parent c5aa500 commit 458f2a8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

plugins/modules/organization.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
- redhat_cdn
6666
- network_sync
6767
- export_sync
68+
- custom_cdn
6869
upstream_url:
6970
description:
7071
- URL of the upstream resource
@@ -106,6 +107,11 @@
106107
- Required when I(upstream_type) is C(network_sync)
107108
required: false
108109
type: str
110+
upstream_custom_cdn_auth_enabled:
111+
description:
112+
- If product certificates should be used to authenticate to a custom CDN.
113+
type: bool
114+
required: false
109115
extends_documentation_fragment:
110116
- theforeman.foreman.foreman
111117
- theforeman.foreman.foreman.entity_state
@@ -182,14 +188,15 @@ def main():
182188
label=dict(),
183189
ignore_types=dict(type='list', elements='str', required=False, aliases=['select_all_types']),
184190
select_all_types=dict(type='list', invisible=True, flat_name='ignore_types'),
185-
upstream_type=dict(required=False, choices=['redhat_cdn', 'export_sync', 'network_sync']),
191+
upstream_type=dict(required=False, choices=['redhat_cdn', 'export_sync', 'network_sync', 'custom_cdn']),
186192
upstream_url=dict(required=False),
187193
upstream_username=dict(required=False),
188194
upstream_password=dict(required=False, no_log=True),
189195
upstream_ca_cert=dict(required=False, type='entity', resource_type='content_credentials', scope=['organization']),
190196
upstream_organization=dict(required=False),
191197
upstream_lifecycle_environment=dict(required=False),
192198
upstream_content_view=dict(required=False),
199+
upstream_custom_cdn_auth_enabled=dict(required=False, type='bool'),
193200
),
194201
)
195202

@@ -229,6 +236,18 @@ def main():
229236
'upstream_content_view_label': module.foreman_params['upstream_content_view'],
230237
}
231238
extra_payload.update(cdn_config)
239+
if module.foreman_params['upstream_type'] == 'custom_cdn':
240+
cdn_config = {
241+
'url': module.foreman_params['upstream_url'],
242+
'ssl_ca_credential_id': module.foreman_params['upstream_ca_cert'],
243+
'username': module.foreman_params['upstream_username'],
244+
'password': module.foreman_params['upstream_password'],
245+
'upstream_organization_label': module.foreman_params['upstream_organization'],
246+
'upstream_lifecycle_environment_label': module.foreman_params['upstream_lifecycle_environment'],
247+
'upstream_content_view_label': module.foreman_params['upstream_content_view'],
248+
'custom_cdn_auth_enabled': module.foreman_params['upstream_custom_cdn_auth_enabled'],
249+
}
250+
extra_payload.update(cdn_config)
232251

233252
current_cdn_config = {k: v for k, v in organization['cdn_configuration'].items() if v is not None}
234253
del current_cdn_config['password_exists']

0 commit comments

Comments
 (0)