summaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2016-05-25 12:09:49 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2016-05-25 12:09:49 -0700
commit0e4a023a7e883743e92ddfcd097b3a60d86b1608 (patch)
tree56c294a245d7c773a489de53b13151aaea4b9c6d /database
parente7e36209832bc6de3eb4854045da5961073c839a (diff)
downloadansible-modules-extras-0e4a023a7e883743e92ddfcd097b3a60d86b1608.tar.gz
The pymssql library requires python 2.7 or greater so port the syntax of this file to use python3-style exception handling
Diffstat (limited to 'database')
-rw-r--r--database/mssql/mssql_db.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/database/mssql/mssql_db.py b/database/mssql/mssql_db.py
index 413d4627..45642c57 100644
--- a/database/mssql/mssql_db.py
+++ b/database/mssql/mssql_db.py
@@ -73,7 +73,9 @@ options:
notes:
- Requires the pymssql Python package on the remote host. For Ubuntu, this
is as easy as pip install pymssql (See M(pip).)
-requirements: [ pymssql ]
+requirements:
+ - python >= 2.7
+ - pymssql
author: Vedit Firat Arig
'''
@@ -177,7 +179,7 @@ def main():
try:
conn = pymssql.connect(user=login_user, password=login_password, host=login_querystring, database='master')
cursor = conn.cursor()
- except Exception, e:
+ except Exception as e:
if "Unknown database" in str(e):
errno, errstr = e.args
module.fail_json(msg="ERROR: %s %s" % (errno, errstr))
@@ -191,7 +193,7 @@ def main():
if state == "absent":
try:
changed = db_delete(conn, cursor, db)
- except Exception, e:
+ except Exception as e:
module.fail_json(msg="error deleting database: " + str(e))
elif state == "import":
conn.autocommit(autocommit)
@@ -205,12 +207,12 @@ def main():
if state == "present":
try:
changed = db_create(conn, cursor, db)
- except Exception, e:
+ except Exception as e:
module.fail_json(msg="error creating database: " + str(e))
elif state == "import":
try:
changed = db_create(conn, cursor, db)
- except Exception, e:
+ except Exception as e:
module.fail_json(msg="error creating database: " + str(e))
conn.autocommit(autocommit)