Repository navigation
AAP-101726: Tolerate missing unified_job_template on schedule state=absent - #16819
Open
arvind-sme wants to merge 1 commit into
Open
arvind-sme wants to merge 1 commit into
arvind-sme wants to merge 1 commit into
Conversation
…bsent Match credential_input_source (AAP-80457): when state is absent and the unified job template no longer exists, exit changed=false instead of failing on None['id']. Keep present-state lookups strict. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fix awx.awx.schedule (downstream ansible.controller.schedule) so state: absent is idempotent when the targeted unified_job_template no longer exists.
Previously the module always resolved the UJT via get_one(...)['id'] before handling state: absent. When the template was already gone (common in CasC cleanup after JT deletion), get_one returned None and the module crashed with 'NoneType' object is not subscriptable.
This matches the AAP-80457 / credential_input_source pattern: use allow_none=(state == 'absent'), and if the UJT is missing on absent, exit_json(changed=False). state: present still fails when the UJT is missing (allow_none=False).
Related: AAP-101726
ISSUE TYPE
COMPONENT NAME
STEPS TO REPRODUCE AND EXTRA INFO
Before:
After:
Unit tests added: test_schedule_delete_missing_unified_job_template, test_schedule_create_missing_unified_job_template.
Summary by CodeRabbit