Improve performance on Tower schedule runs with bugfix for missing schedules #630
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.
What does this PR do?
is true
fails and should be== true
400
response code when creating a schedule with aPOST
to determine if it should instead be updated with aPUT
/api/v2/schedules/?name={{ schedule.name }}
to lookup existing schedules instead of looping through all schedules. This will enhance performance while bypassing a potential bug where not all schedules show up in the global/api/v2/schedules
even when accounting for pagination. (The API browser is also missing some schedules from the global endpoint)How should this be tested?
Tested all changes against one of the failing playbooks in Tower by pointing to the incoming paulbarfuss/infra-ansible fork/branch.
For some unknown reason, when looking up all schedules in {{ ansible_tower_url }}/api/v2/schedules/ using the
rest_get
module a few are not appearing. For example:{{ ansible_tower_url }}/api/v2/schedules/86
does not appear in the global schedules{{ ansible_tower_url }}/api/v2/job_templates/94/schedules/
does include the schedule with"id": 86
{{ ansible_tower_url }}/api/v2/schedules/?name={{ schedule.name }}
quickly finds the correctschedule.id
and only checks once we know from the400
response code that the schedule does indeed already exist.People to notify
cc: @redhat-cop/infra-ansible