From b57ae592ed1edf474230c932b7e1d8fb7edc0a5e Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Fri, 28 Oct 2022 12:56:35 -0400 Subject: [PATCH] Expand the dependencies of the Schedule page type Really these could get any of the unified job template types, not just system job templates, so importing e.g. a project with a schedule was doing them in the wrong order. Also, bump the timeout of the project update and make sure that we stash it in the page cache even if it doesn't finish in 5 minutes. --- awxkit/awxkit/api/pages/api.py | 8 +++++++- awxkit/awxkit/api/pages/schedules.py | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/awxkit/awxkit/api/pages/api.py b/awxkit/awxkit/api/pages/api.py index cd600d9dc4..2fcc62648a 100644 --- a/awxkit/awxkit/api/pages/api.py +++ b/awxkit/awxkit/api/pages/api.py @@ -275,7 +275,13 @@ class ApiV2(base.Base): # When creating a project, we need to wait for its # first project update to finish so that associated # JTs have valid options for playbook names - _page.wait_until_completed() + try: + _page.wait_until_completed(timeout=300) + except AssertionError: + # If the project update times out, try to + # carry on in the hopes that it will + # finish before it is needed. + pass else: # If we are an existing project and our scm_tpye is not changing don't try and import the local_path setting if asset['natural_key']['type'] == 'project' and 'local_path' in post_data and _page['scm_type'] == post_data['scm_type']: diff --git a/awxkit/awxkit/api/pages/schedules.py b/awxkit/awxkit/api/pages/schedules.py index 3ff9e1c0bb..1fa34c81e6 100644 --- a/awxkit/awxkit/api/pages/schedules.py +++ b/awxkit/awxkit/api/pages/schedules.py @@ -1,6 +1,7 @@ from contextlib import suppress -from awxkit.api.pages import SystemJobTemplate +from awxkit.api.pages import JobTemplate, SystemJobTemplate, Project, InventorySource +from awxkit.api.pages.workflow_job_templates import WorkflowJobTemplate from awxkit.api.mixins import HasCreate from awxkit.api.resources import resources from awxkit.config import config @@ -11,7 +12,7 @@ from . import base class Schedule(HasCreate, base.Base): - dependencies = [SystemJobTemplate] + dependencies = [JobTemplate, SystemJobTemplate, Project, InventorySource, WorkflowJobTemplate] NATURAL_KEY = ('unified_job_template', 'name') def silent_delete(self):