Fixes check mode error on Python 2.4 and wrong changed state (#2438)
* Fixes check mode error on Python 2.4 and wrong changed state * Changes code as suggested by @bcoca
This commit is contained in:
parent
e5e1869403
commit
5d63d0b8d1
1 changed files with 9 additions and 10 deletions
|
@ -164,12 +164,11 @@ def main():
|
|||
|
||||
try:
|
||||
if module.check_mode:
|
||||
if state == "absent":
|
||||
if state == "present":
|
||||
changed = not ext_exists(cursor, ext)
|
||||
elif state == "present":
|
||||
elif state == "absent":
|
||||
changed = ext_exists(cursor, ext)
|
||||
module.exit_json(changed=changed,ext=ext)
|
||||
|
||||
else:
|
||||
if state == "absent":
|
||||
changed = ext_delete(cursor, ext)
|
||||
|
||||
|
@ -180,7 +179,7 @@ def main():
|
|||
except Exception, e:
|
||||
module.fail_json(msg="Database query failed: %s" % e)
|
||||
|
||||
module.exit_json(changed=changed, db=db)
|
||||
module.exit_json(changed=changed, db=db, ext=ext)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
|
Loading…
Reference in a new issue