From 0deacc4391245662e2357934392c8f3d7ecc8ce2 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Wed, 1 Apr 2020 11:32:34 -0400 Subject: [PATCH] If attempting to link to a resource that is not yet complete, wait --- awxkit/awxkit/api/pages/api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/awxkit/awxkit/api/pages/api.py b/awxkit/awxkit/api/pages/api.py index 9eb0d86942..905aa3d152 100644 --- a/awxkit/awxkit/api/pages/api.py +++ b/awxkit/awxkit/api/pages/api.py @@ -173,7 +173,14 @@ class ApiV2(base.Base): if frozen_key is not None and frozen_key not in self._natural_key and fetch: pass # FIXME - return self._natural_key.get(frozen_key) + from awxkit.api.mixins import has_status + + _page = self._natural_key.get(frozen_key) + if isinstance(_page, has_status.HasStatus) and not _page.is_completed: + _page.wait_until_completed() + _page = _page.get() + self._natural_key[frozen_key] = _page + return _page def _create_assets(self, data, resource): if resource not in data or resource not in EXPORTABLE_RESOURCES: