Skip to content

Commit 800adbe

Browse files
jeremylenzclaude
andcommitted
Address PR review feedback
- Fix HostMixin fallback to extract CV/LCE IDs from content_view_environments when top-level fields are absent (matches the activation_key.py approach) - Update changelog PR links to pull/1977 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2aee979 commit 800adbe

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
deprecated_features:
22
- activation_key - the ``content_view`` and ``lifecycle_environment`` parameters
33
are deprecated, please use ``content_view_environments`` instead
4-
(https://github.com/theforeman/foreman-ansible-modules/pull/0000)
4+
(https://github.com/theforeman/foreman-ansible-modules/pull/1977)
55
- host, hostgroup - the ``content_view`` and ``lifecycle_environment`` parameters
66
are deprecated and will be removed in a future version
7-
(https://github.com/theforeman/foreman-ansible-modules/pull/0000)
7+
(https://github.com/theforeman/foreman-ansible-modules/pull/1977)
88
minor_changes:
99
- activation_key, host, hostgroup - internally convert deprecated
1010
``content_view``/``lifecycle_environment`` to content view environment ID(s)
1111
for compatibility with newer Katello API versions
12-
(https://github.com/theforeman/foreman-ansible-modules/pull/0000)
12+
(https://github.com/theforeman/foreman-ansible-modules/pull/1977)
1313
bugfixes:
1414
- foreman_helper - use safe dictionary access for content_view_id/environment_id
1515
in update workaround to prevent KeyError on newer Katello versions
16-
(https://github.com/theforeman/foreman-ansible-modules/pull/0000)
16+
(https://github.com/theforeman/foreman-ansible-modules/pull/1977)

plugins/module_utils/foreman_helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,16 @@ def _convert_cv_lce_to_cve(self, entity):
381381

382382
if entity and cv_id is None:
383383
cv_id = entity.get('content_view_id')
384+
if cv_id is None:
385+
entity_cves = entity.get('content_view_environments', [])
386+
if entity_cves:
387+
cv_id = entity_cves[0].get('content_view', {}).get('id')
384388
if entity and lce_id is None:
385389
lce_id = entity.get('lifecycle_environment_id')
390+
if lce_id is None:
391+
entity_cves = entity.get('content_view_environments', [])
392+
if entity_cves:
393+
lce_id = entity_cves[0].get('lifecycle_environment', {}).get('id')
386394

387395
if cv_id is None or lce_id is None:
388396
self.fail_json(msg="Both 'content_view' and 'lifecycle_environment' must be provided together.")

0 commit comments

Comments
 (0)