summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/lib_openshift/library/oc_process.py20
-rw-r--r--roles/lib_openshift/src/ansible/oc_process.py1
-rw-r--r--roles/lib_openshift/src/class/oc_process.py19
3 files changed, 22 insertions, 18 deletions
diff --git a/roles/lib_openshift/library/oc_process.py b/roles/lib_openshift/library/oc_process.py
index ee75d8f84..60eeb283b 100644
--- a/roles/lib_openshift/library/oc_process.py
+++ b/roles/lib_openshift/library/oc_process.py
@@ -1257,7 +1257,7 @@ class OCProcess(OpenShiftCLI):
@property
def template(self):
'''template property'''
- if self._template == None:
+ if self._template is None:
results = self._process(self.name, False, self.params, self.data)
if results['returncode'] != 0:
raise OpenShiftCLIError('Error processing template [%s].' % self.name)
@@ -1345,18 +1345,18 @@ class OCProcess(OpenShiftCLI):
return obj_results
-
+ # pylint: disable=too-many-return-statements
@staticmethod
def run_ansible(params, check_mode):
'''run the ansible idempotent code'''
ocprocess = OCProcess(params['namespace'],
- params['template_name'],
- params['params'],
- params['create'],
- kubeconfig=params['kubeconfig'],
- tdata=params['content'],
- verbose=params['debug'])
+ params['template_name'],
+ params['params'],
+ params['create'],
+ kubeconfig=params['kubeconfig'],
+ tdata=params['content'],
+ verbose=params['debug'])
state = params['state']
@@ -1369,6 +1369,9 @@ class OCProcess(OpenShiftCLI):
return {"changed" : False, "results": api_rval, "state": "list"}
elif state == 'present':
+ if check_mode and params['create']:
+ return {"changed": True, 'msg': "CHECK_MODE: Would have processed template."}
+
if not ocprocess.exists() or not params['reconcile']:
#FIXME: this code will never get run in a way that succeeds when
# module.params['reconcile'] is true. Because oc_process doesn't
@@ -1436,7 +1439,6 @@ def main():
supports_check_mode=True,
)
-
rval = OCProcess.run_ansible(module.params, module.check_mode)
if 'failed' in rval:
module.fail_json(**rval)
diff --git a/roles/lib_openshift/src/ansible/oc_process.py b/roles/lib_openshift/src/ansible/oc_process.py
index 5faa46aef..17cf865b7 100644
--- a/roles/lib_openshift/src/ansible/oc_process.py
+++ b/roles/lib_openshift/src/ansible/oc_process.py
@@ -22,7 +22,6 @@ def main():
supports_check_mode=True,
)
-
rval = OCProcess.run_ansible(module.params, module.check_mode)
if 'failed' in rval:
module.fail_json(**rval)
diff --git a/roles/lib_openshift/src/class/oc_process.py b/roles/lib_openshift/src/class/oc_process.py
index 6cb5ec8c9..80d81448d 100644
--- a/roles/lib_openshift/src/class/oc_process.py
+++ b/roles/lib_openshift/src/class/oc_process.py
@@ -30,7 +30,7 @@ class OCProcess(OpenShiftCLI):
@property
def template(self):
'''template property'''
- if self._template == None:
+ if self._template is None:
results = self._process(self.name, False, self.params, self.data)
if results['returncode'] != 0:
raise OpenShiftCLIError('Error processing template [%s].' % self.name)
@@ -118,18 +118,18 @@ class OCProcess(OpenShiftCLI):
return obj_results
-
+ # pylint: disable=too-many-return-statements
@staticmethod
def run_ansible(params, check_mode):
'''run the ansible idempotent code'''
ocprocess = OCProcess(params['namespace'],
- params['template_name'],
- params['params'],
- params['create'],
- kubeconfig=params['kubeconfig'],
- tdata=params['content'],
- verbose=params['debug'])
+ params['template_name'],
+ params['params'],
+ params['create'],
+ kubeconfig=params['kubeconfig'],
+ tdata=params['content'],
+ verbose=params['debug'])
state = params['state']
@@ -142,6 +142,9 @@ class OCProcess(OpenShiftCLI):
return {"changed" : False, "results": api_rval, "state": "list"}
elif state == 'present':
+ if check_mode and params['create']:
+ return {"changed": True, 'msg': "CHECK_MODE: Would have processed template."}
+
if not ocprocess.exists() or not params['reconcile']:
#FIXME: this code will never get run in a way that succeeds when
# module.params['reconcile'] is true. Because oc_process doesn't