Browse Source

Fixed a bug. Ansible requires a msg param when module.fail_json.

Kenny Woodson 8 years ago
parent
commit
1002d6f1a2

+ 6 - 6
roles/lib_openshift/library/oc_process.py

@@ -1545,7 +1545,7 @@ class OCProcess(OpenShiftCLI):
             if api_rval['returncode'] != 0:
                 return {"failed": True, "msg" : api_rval}
 
-            return {"changed" : False, "results": api_rval, "state": "list"}
+            return {"changed" : False, "results": api_rval, "state": state}
 
         elif state == 'present':
             if check_mode and params['create']:
@@ -1567,9 +1567,9 @@ class OCProcess(OpenShiftCLI):
                     return {"failed": True, "msg": api_rval}
 
                 if params['create']:
-                    return {"changed": True, "results": api_rval, "state": "present"}
+                    return {"changed": True, "results": api_rval, "state": state}
 
-                return {"changed": False, "results": api_rval, "state": "present"}
+                return {"changed": False, "results": api_rval, "state": state}
 
         # verify results
         update = False
@@ -1584,13 +1584,13 @@ class OCProcess(OpenShiftCLI):
                 update = True
 
         if not update:
-            return {"changed": update, "results": api_rval, "state": "present"}
+            return {"changed": update, "results": api_rval, "state": state}
 
         for cmd in rval:
             if cmd['returncode'] != 0:
-                return {"failed": True, "changed": update, "results": rval, "state": "present"}
+                return {"failed": True, "changed": update, "msg": rval, "state": state}
 
-        return {"changed": update, "results": rval, "state": "present"}
+        return {"changed": update, "results": rval, "state": state}
 
 
 # -*- -*- -*- End included fragment: class/oc_process.py -*- -*- -*-

+ 6 - 6
roles/lib_openshift/src/class/oc_process.py

@@ -136,7 +136,7 @@ class OCProcess(OpenShiftCLI):
             if api_rval['returncode'] != 0:
                 return {"failed": True, "msg" : api_rval}
 
-            return {"changed" : False, "results": api_rval, "state": "list"}
+            return {"changed" : False, "results": api_rval, "state": state}
 
         elif state == 'present':
             if check_mode and params['create']:
@@ -158,9 +158,9 @@ class OCProcess(OpenShiftCLI):
                     return {"failed": True, "msg": api_rval}
 
                 if params['create']:
-                    return {"changed": True, "results": api_rval, "state": "present"}
+                    return {"changed": True, "results": api_rval, "state": state}
 
-                return {"changed": False, "results": api_rval, "state": "present"}
+                return {"changed": False, "results": api_rval, "state": state}
 
         # verify results
         update = False
@@ -175,11 +175,11 @@ class OCProcess(OpenShiftCLI):
                 update = True
 
         if not update:
-            return {"changed": update, "results": api_rval, "state": "present"}
+            return {"changed": update, "results": api_rval, "state": state}
 
         for cmd in rval:
             if cmd['returncode'] != 0:
-                return {"failed": True, "changed": update, "results": rval, "state": "present"}
+                return {"failed": True, "changed": update, "msg": rval, "state": state}
 
-        return {"changed": update, "results": rval, "state": "present"}
+        return {"changed": update, "results": rval, "state": state}