summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorJose A. Rivera <jarrpa@redhat.com>2017-06-03 11:02:39 -0500
committerJose A. Rivera <jarrpa@redhat.com>2017-06-06 21:32:42 -0500
commit3aea760737835070b761114f2909649795d6f6e9 (patch)
treee9ec1d8d98cf92c98b961e3e3ef6a4fb5612ef24 /roles
parente089f74edc79a31117a49d3f84519974787f31f0 (diff)
downloadopenshift-3aea760737835070b761114f2909649795d6f6e9.tar.gz
openshift-3aea760737835070b761114f2909649795d6f6e9.tar.bz2
openshift-3aea760737835070b761114f2909649795d6f6e9.tar.xz
openshift-3aea760737835070b761114f2909649795d6f6e9.zip
oc_obj: set _delete() rc to 0 if err is 'not found'
When deleting multiple objects, allow for some resources to already be absent. Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Diffstat (limited to 'roles')
-rw-r--r--roles/lib_openshift/library/oc_obj.py7
-rw-r--r--roles/lib_openshift/src/class/oc_obj.py7
2 files changed, 12 insertions, 2 deletions
diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py
index c63441aa3..5b1039385 100644
--- a/roles/lib_openshift/library/oc_obj.py
+++ b/roles/lib_openshift/library/oc_obj.py
@@ -1473,7 +1473,12 @@ class OCObject(OpenShiftCLI):
def delete(self):
'''delete the object'''
- return self._delete(self.kind, name=self.name, selector=self.selector)
+ results = self._delete(self.kind, name=self.name, selector=self.selector)
+ if (results['returncode'] != 0 and 'stderr' in results and
+ '\"{}\" not found'.format(self.name) in results['stderr']):
+ results['returncode'] = 0
+
+ return results
def create(self, files=None, content=None):
'''
diff --git a/roles/lib_openshift/src/class/oc_obj.py b/roles/lib_openshift/src/class/oc_obj.py
index d480bfaf0..5e423bea9 100644
--- a/roles/lib_openshift/src/class/oc_obj.py
+++ b/roles/lib_openshift/src/class/oc_obj.py
@@ -33,7 +33,12 @@ class OCObject(OpenShiftCLI):
def delete(self):
'''delete the object'''
- return self._delete(self.kind, name=self.name, selector=self.selector)
+ results = self._delete(self.kind, name=self.name, selector=self.selector)
+ if (results['returncode'] != 0 and 'stderr' in results and
+ '\"{}\" not found'.format(self.name) in results['stderr']):
+ results['returncode'] = 0
+
+ return results
def create(self, files=None, content=None):
'''