From e089f74edc79a31117a49d3f84519974787f31f0 Mon Sep 17 00:00:00 2001 From: "Jose A. Rivera" Date: Tue, 6 Jun 2017 00:39:35 -0500 Subject: oc_obj: only check 'items' if exists in delete Signed-off-by: Jose A. Rivera --- roles/lib_openshift/src/class/oc_obj.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'roles/lib_openshift/src') diff --git a/roles/lib_openshift/src/class/oc_obj.py b/roles/lib_openshift/src/class/oc_obj.py index 6f0da3d5c..d480bfaf0 100644 --- a/roles/lib_openshift/src/class/oc_obj.py +++ b/roles/lib_openshift/src/class/oc_obj.py @@ -117,7 +117,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: -- cgit v1.2.3