Make module output more consistent wrt. changed/failed

- Make sure exit_json() always returns a changed= value
- Modify the yum module to not return failed=False
- Modify install() and latest() similar to remove() in yum module
- Changed exit_json(failed=True, **res) into a fail_json(**res)
- Make sure yum rc= value reflects loop (similar to how we fixed remove())
This commit is contained in:
Dag Wieers 2012-11-08 12:02:32 +01:00
parent 36c1b4be0e
commit fe0c70fe9d
2 changed files with 24 additions and 40 deletions

View file

@ -594,6 +594,8 @@ class AnsibleModule(object):
def exit_json(self, **kwargs):
''' return from the module, without error '''
self.add_path_info(kwargs)
if not kwargs.has_key('changed'):
kwargs['changed'] = False
print self.jsonify(kwargs)
sys.exit(0)