summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/modules/fetch_cmd.py4
-rw-r--r--lib/modules/mysql_user24
-rw-r--r--lib/modules/openldap10
-rw-r--r--lib/modules/postmap4
-rw-r--r--lib/modules/postmulti4
5 files changed, 13 insertions, 13 deletions
diff --git a/lib/modules/fetch_cmd.py b/lib/modules/fetch_cmd.py
index ac8757f..ca3e817 100644
--- a/lib/modules/fetch_cmd.py
+++ b/lib/modules/fetch_cmd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Fetch the output of a remote command
# Copyright (c) 2016 Guilhem Moulin <guilhem@fripost.org>
@@ -48,7 +48,7 @@ def main():
if stdin is not None:
stdin.close()
- except KeyError, e:
+ except KeyError as e:
module.fail_json(msg=str(e))
module.exit_json(changed=changed)
diff --git a/lib/modules/mysql_user2 b/lib/modules/mysql_user2
index f2d9d40..20742fe 100644
--- a/lib/modules/mysql_user2
+++ b/lib/modules/mysql_user2
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# (c) 2012, Mark Theunissen <mark.theunissen@gmail.com>
# Sponsored by Four Kitchens http://fourkitchens.com.
@@ -472,7 +472,7 @@ def main():
if not cursor:
cursor = connect(module, login_user, login_password)
- except Exception, e:
+ except Exception as e:
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials")
if state == "present":
diff --git a/lib/modules/openldap b/lib/modules/openldap
index 9b015b6..9afe1f1 100644
--- a/lib/modules/openldap
+++ b/lib/modules/openldap
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Manage OpenLDAP databases
# Copyright (c) 2013 Guilhem Moulin <guilhem@fripost.org>
@@ -303,7 +303,7 @@ def main():
try:
r = l.search_s( name, ldap.SCOPE_BASE, filterStr, attrsonly=1 )
- except ldap.LDAPError, ldap.NO_SUCH_OBJECT:
+ except (ldap.LDAPError, ldap.NO_SUCH_OBJECT):
r = None
if r:
@@ -352,9 +352,9 @@ def main():
changed = parser.changed
l.unbind_s()
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
module.fail_json(rv=e.returncode, msg=e.output.rstrip())
- except ldap.LDAPError, e:
+ except ldap.LDAPError as e:
e = e.args[0]
if 'info' in e.keys():
msg = e['info']
@@ -363,7 +363,7 @@ def main():
else:
msg = str(e)
module.fail_json(msg=msg)
- except KeyError, e:
+ except KeyError as e:
module.fail_json(msg=str(e))
module.exit_json(changed=changed)
diff --git a/lib/modules/postmap b/lib/modules/postmap
index 8c9d54c..ce09018 100644
--- a/lib/modules/postmap
+++ b/lib/modules/postmap
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Create or update postfix's alias and lookup tables
# Copyright (c) 2013 Guilhem Moulin <guilhem@fripost.org>
@@ -97,7 +97,7 @@ def main():
changed = True
if not module.check_mode:
msg = compile( cmd, instance, db, src)
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
module.fail_json(rv=e.returncode, msg=e.output.rstrip())
changed = module.set_file_attributes_if_different(file_args, changed)
diff --git a/lib/modules/postmulti b/lib/modules/postmulti
index d6ecb09..3c0a522 100644
--- a/lib/modules/postmulti
+++ b/lib/modules/postmulti
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Create and manage postfix instances.
# Copyright (c) 2013 Guilhem Moulin <guilhem@fripost.org>
@@ -94,7 +94,7 @@ def main():
module.exit_json(changed=changed)
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
module.fail_json(rv=e.returncode, msg=e.output.rstrip())