summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorOpenShift Bot <eparis+openshiftbot@redhat.com>2017-06-13 12:06:43 -0400
committerGitHub <noreply@github.com>2017-06-13 12:06:43 -0400
commitbf200ebf489d509740147c9ce01c9e6c41e8bd92 (patch)
tree67fbbeffd7ce0a3b103da6d0f911cac5cb8da134 /roles
parentd5a77cd315a877cc3f9e4f3aed240052338ea741 (diff)
parent3aea760737835070b761114f2909649795d6f6e9 (diff)
downloadopenshift-bf200ebf489d509740147c9ce01c9e6c41e8bd92.tar.gz
openshift-bf200ebf489d509740147c9ce01c9e6c41e8bd92.tar.bz2
openshift-bf200ebf489d509740147c9ce01c9e6c41e8bd92.tar.xz
openshift-bf200ebf489d509740147c9ce01c9e6c41e8bd92.zip
Merge pull request #4380 from jarrpa/oc_obj-fixes
Merged by openshift-bot
Diffstat (limited to 'roles')
-rw-r--r--roles/lib_openshift/library/oc_obj.py10
-rw-r--r--roles/lib_openshift/src/class/oc_obj.py10
2 files changed, 16 insertions, 4 deletions
diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py
index 215723cc8..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):
'''
@@ -1557,7 +1562,8 @@ class OCObject(OpenShiftCLI):
if state == 'absent':
# verify its not in our results
if (params['name'] is not None or params['selector'] is not None) and \
- (len(api_rval['results']) == 0 or len(api_rval['results'][0].get('items', [])) == 0):
+ (len(api_rval['results']) == 0 or \
+ ('items' in api_rval['results'][0] and len(api_rval['results'][0]['items']) == 0)):
return {'changed': False, 'state': state}
if check_mode:
diff --git a/roles/lib_openshift/src/class/oc_obj.py b/roles/lib_openshift/src/class/oc_obj.py
index 6f0da3d5c..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):
'''
@@ -117,7 +122,8 @@ class OCObject(OpenShiftCLI):
if state == 'absent':
# verify its not in our results
if (params['name'] is not None or params['selector'] is not None) and \
- (len(api_rval['results']) == 0 or len(api_rval['results'][0].get('items', [])) == 0):
+ (len(api_rval['results']) == 0 or \
+ ('items' in api_rval['results'][0] and len(api_rval['results'][0]['items']) == 0)):
return {'changed': False, 'state': state}
if check_mode: