summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awxkit/awxkit/api/pages/inventory.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/awxkit/awxkit/api/pages/inventory.py b/awxkit/awxkit/api/pages/inventory.py
index fb3284ba3f..2142275886 100644
--- a/awxkit/awxkit/api/pages/inventory.py
+++ b/awxkit/awxkit/api/pages/inventory.py
@@ -5,6 +5,7 @@ import json
from awxkit.api.pages import Credential, Organization, Project, UnifiedJob, UnifiedJobTemplate
from awxkit.utils import filter_by_class, random_title, update_payload, not_provided, PseudoNamespace, poll_until
from awxkit.api.mixins import DSAdapter, HasCreate, HasInstanceGroups, HasNotifications, HasVariables, HasCopy
+from awxkit.config import config
from awxkit.api.resources import resources
import awxkit.exceptions as exc
from . import base
@@ -97,9 +98,18 @@ class Inventory(HasCopy, HasCreate, HasInstanceGroups, HasVariables, base.Base):
poll_until(_wait, interval=1, timeout=60)
def silent_delete(self):
- r = super(Inventory, self).silent_delete()
- self.wait_until_deleted()
- return r
+ try:
+ if not config.prevent_teardown:
+ r = self.delete()
+ self.wait_until_deleted()
+ return r
+ except (exc.NoContent, exc.NotFound, exc.Forbidden):
+ pass
+ except (exc.BadRequest, exc.Conflict) as e:
+ if 'Resource is being used' in e.msg:
+ pass
+ else:
+ raise e
def update_inventory_sources(self, wait=False):
response = self.related.update_inventory_sources.post()