Browse Source

Fixing for linters.

Kenny Woodson 8 years ago
parent
commit
7a0149cf74

+ 11 - 9
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)

+ 0 - 1
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)

+ 11 - 8
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