summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-02-02 12:52:40 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-02-09 09:41:36 -0500
commit7a0149cf74ec76b2bbcec3b21b7cdcd9d98178cf (patch)
tree48125bee3a799b1e41cec7585c0452a4295eb212 /roles
parent353a24669e7116b40a9c85367277d19040eb75ea (diff)
downloadopenshift-7a0149cf74ec76b2bbcec3b21b7cdcd9d98178cf.tar.gz
openshift-7a0149cf74ec76b2bbcec3b21b7cdcd9d98178cf.tar.bz2
openshift-7a0149cf74ec76b2bbcec3b21b7cdcd9d98178cf.tar.xz
openshift-7a0149cf74ec76b2bbcec3b21b7cdcd9d98178cf.zip
Fixing for linters.
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