Remove deprecated CV/LCE params from ActivationKey and HostGroup - #1419
Conversation
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
ActivationKey.read, you're mutating theignoreset passed in by the caller (ignore.add(...)); consider creating a new set (e.g.,ignore = set(ignore or []) | {'content_view_environment_ids'}) to avoid surprising side effects when callers reuse the same set. - The
content_viewandenvironmentproperties assume the nested dicts always contain an'id'key; it might be safer to use.get('id')and returnNonewhen it's missing to avoid aKeyErroron malformed or partial API responses. - For
HostGroup.create_payload/update_payload, you might want to check for a non-Nonecontent_view_environment_idrather than just key presence (e.g.,if payload.get('content_view_environment_id') is not None:) so that you only strip the legacy IDs when a new CVE value is actually being sent.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `ActivationKey.read`, you're mutating the `ignore` set passed in by the caller (`ignore.add(...)`); consider creating a new set (e.g., `ignore = set(ignore or []) | {'content_view_environment_ids'}`) to avoid surprising side effects when callers reuse the same set.
- The `content_view` and `environment` properties assume the nested dicts always contain an `'id'` key; it might be safer to use `.get('id')` and return `None` when it's missing to avoid a `KeyError` on malformed or partial API responses.
- For `HostGroup.create_payload`/`update_payload`, you might want to check for a non-`None` `content_view_environment_id` rather than just key presence (e.g., `if payload.get('content_view_environment_id') is not None:`) so that you only strip the legacy IDs when a new CVE value is actually being sent.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
This PR updates Katello-facing entity models for the newer content view environment API shape, replacing deprecated separate content view / lifecycle environment parameters where applicable.
Changes:
- Replaces ActivationKey create/update input with
content_view_environment_ids. - Adds read-side ActivationKey compatibility helpers for
content_viewandenvironment. - Adds HostGroup
content_view_environment_idpayload support and removes legacy CV/LCE IDs when it is present.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if 'content_view_environment_id' in payload: | ||
| payload.pop('content_view_id', None) | ||
| payload.pop('lifecycle_environment_id', None) |
LadislavVasina1
left a comment
There was a problem hiding this comment.
Changes look good to me, but I would like someone with more nailgun "skills" :D to also review.
Also I would merge only after we are close to delivering the Katello changes to the downstream snap.
|
Katello change is merged now. |
|
@jeremylenz This looks good, but could you change the instances of |
e7ffa24 to
c928319
Compare
vsedmik
left a comment
There was a problem hiding this comment.
LGTM, thank you for the update @jeremylenz!
c928319 to
dd22844
Compare
6b0f708 to
77b11ab
Compare
sambible
left a comment
There was a problem hiding this comment.
ACK pending fixes for the failing unit tests.
77b11ab to
afaf8d6
Compare
ActivationKey: Replace content_view/environment fields with content_view_environment_ids for create/update. Add read() override to populate content_view_environments from the API response, and backward-compat properties for content_view/environment. HostGroup: Add content_view_environment_id field. Strip legacy content_view_id/lifecycle_environment_id from payloads when the new field is present. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
latest commit is to fix Robottelo PRT failures. |
1d2d922 to
affbb03
Compare
This field is write-only — the API response does not include it, so read() must skip it to avoid a KeyError. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Description of changes
Remove the deprecated separate
content_viewandenvironmentfields fromActivationKey, replacing them withcontent_view_environment_idsto match the Katello 4.21+ API changes (Fixes #39330).ActivationKey:
content_view(OneToOneField) andenvironment(OneToOneField) from_fieldscontent_view_environment_ids(ListField) for create/update payloadsread()to populatecontent_view_environmentsfrom the API response@propertyforcontent_viewandenvironment(read-only, extracts from first content view environment)HostGroup:
content_view_environment_id(IntegerField) to_fieldscreate_payload()andupdate_payload()to strip legacycontent_view_id/lifecycle_environment_idwhencontent_view_environment_idis presentUpstream API documentation, plugin, or feature links
Katello PR: Katello/katello#11753 (branch
sat-38100-remove-deprecated-cv-lce-params)Robottelo PR: SatelliteQE/robottelo#21644
Functional demonstration
Callers update from:
to:
Read-side backward compat is preserved:
Additional Information
Companion Robottelo PR will follow with test updates.
🤖 Generated with Claude Code