awx.awx.schedule: Do not fail if state is absent and unified_job_template does not exist #15220
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
Module managing schedules does is not idempotent in case
unified_job_template
is provided and suchunified_job_template
does not exist and so schedule does not exist anymore. Module should still provide OK.This is affecting mainly configuration as code, when switching object with state to absent. It is then not consistent to have one playbook managing creation and removal at same time.
ISSUE TYPE
COMPONENT NAME
AWX VERSION
ADDITIONAL INFORMATION
Using following example for configuration as code using dispatch within
infra.controller_configuration
is gonna deploy it.Simple changing state to absent, keeping the rest of the values intact will make it fail on schedules as job templates are removed first and schedule still refer to non-existing
unified_job_template
.Error:
With proposed update it manages both states successfully (present and absent).