feat: add aap_job_template_id support to Hook class#2759
Conversation
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Cherry-pick Operations
Branch Management
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
Security Checks
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
ChangesHook compatibility shim migration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoAdd AAP/AWX job template support to MTV Hook resource
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Positional args API break
|
a19aa01 to
3f9a036
Compare
3f9a036 to
517e05f
Compare
|
/verified |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ocp_resources/hook.py`:
- Around line 27-34: In the hook initialization logic, move the
DeprecationWarning into the `if image is _UNSET:` block so explicitly supplied
images do not trigger it. Add the requested TODO in that block documenting
removal of the legacy fallback, while preserving the existing `aap`-dependent
image assignment.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4be5a318-eba3-46dc-b17b-f6f49c227353
📒 Files selected for processing (1)
ocp_resources/hook.py
15bbb54 to
e346681
Compare
|
Clean rebase detected — no code changes compared to previous head ( |
|
/verified |
Add support for AAP (Ansible Automation Platform) hooks. When aap_job_template_id is set, to_dict() produces spec.aap.jobTemplateId instead of spec.image + spec.playbook. The two hook types are mutually exclusive. Also adds type annotations to all __init__ parameters.
e346681 to
5e49334
Compare
|
/verified |
|
/lgtm |
Summary
Add
aap_job_template_idparameter to theHookclass, enabling MTV AAP hook integration — Hook CRs that trigger AWX/AAP job templates during migration instead of running playbooks in containers.What changed
aap_job_template_id=NoneonHook.__init__().to_dict():aap_job_template_idis set → producesspec.aap.jobTemplateId.spec.image+spec.playbook(existing behavior, unchanged).No regression — existing callers that don't pass
aap_job_template_idhit the original code path.Why
The
mtv-api-testsproject (branchfeat/aap-hook-integration) has a new AAP hook integration test that creates a Hook CR viaHook(aap_job_template_id=9). Without this wrapper change, it fails with:Confirmed by running the test against the current PyPI release (11.0.134).
Related Jira tickets
Polarion: MTV-781
Summary by CodeRabbit
aap), plusdeadline,image,playbook, andservice_account.spec.image/spec.playbook; serialization now follows the provided input parameters.imagedefaulting is conditional: it’s omitted whenaapis set, otherwise defaults apply.