Make redis run on python 3

This commit is contained in:
Michael Scherer 2016-10-15 17:01:46 +02:00 committed by Matt Clay
parent 11d88bc1a8
commit 715b88a8a5
2 changed files with 11 additions and 6 deletions

View file

@ -210,7 +210,8 @@ def main():
password=login_password) password=login_password)
try: try:
r.ping() r.ping()
except Exception, e: except Exception:
e = get_exception()
module.fail_json(msg="unable to connect to database: %s" % e) module.fail_json(msg="unable to connect to database: %s" % e)
#Check if we are already in the mode that we want #Check if we are already in the mode that we want
@ -269,7 +270,8 @@ def main():
db=db) db=db)
try: try:
r.ping() r.ping()
except Exception, e: except Exception:
e = get_exception()
module.fail_json(msg="unable to connect to database: %s" % e) module.fail_json(msg="unable to connect to database: %s" % e)
# Do the stuff # Do the stuff
@ -296,13 +298,15 @@ def main():
try: try:
r.ping() r.ping()
except Exception, e: except Exception:
e = get_exception()
module.fail_json(msg="unable to connect to database: %s" % e) module.fail_json(msg="unable to connect to database: %s" % e)
try: try:
old_value = r.config_get(name)[name] old_value = r.config_get(name)[name]
except Exception, e: except Exception:
e = get_exception()
module.fail_json(msg="unable to read config: %s" % e) module.fail_json(msg="unable to read config: %s" % e)
changed = old_value != value changed = old_value != value
@ -311,7 +315,8 @@ def main():
else: else:
try: try:
r.config_set(name, value) r.config_set(name, value)
except Exception, e: except Exception:
e = get_exception()
module.fail_json(msg="unable to write config: %s" % e) module.fail_json(msg="unable to write config: %s" % e)
module.exit_json(changed=changed, name=name, value=value) module.exit_json(changed=changed, name=name, value=value)
else: else:
@ -319,4 +324,5 @@ def main():
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception
main() main()

View file

@ -48,7 +48,6 @@
/clustering/consul_session.py /clustering/consul_session.py
/database/misc/mongodb_parameter.py /database/misc/mongodb_parameter.py
/database/misc/mongodb_user.py /database/misc/mongodb_user.py
/database/misc/redis.py
/database/mysql/mysql_replication.py /database/mysql/mysql_replication.py
/database/postgresql/postgresql_ext.py /database/postgresql/postgresql_ext.py
/database/postgresql/postgresql_lang.py /database/postgresql/postgresql_lang.py