summaryrefslogtreecommitdiff
path: root/source_control/gitlab_project.py
diff options
context:
space:
mode:
authorChris Weber <chris.l.weber@gmail.com>2016-06-04 16:31:54 -0700
committerToshio Kuratomi <a.badger@gmail.com>2016-06-04 16:31:54 -0700
commit4f042c8cfa95060e564a56fb090b045402e50fd6 (patch)
treecf57517f13f0861cbfd6d64694841ffcd04343b1 /source_control/gitlab_project.py
parenta0bd87f04ebdd15a1b1c16550780a40597b4a5b9 (diff)
downloadansible-modules-extras-4f042c8cfa95060e564a56fb090b045402e50fd6.tar.gz
Fixed exception handeling for Python 2.4 and python 3 compatablity (#2364)
Diffstat (limited to 'source_control/gitlab_project.py')
-rw-r--r--source_control/gitlab_project.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/source_control/gitlab_project.py b/source_control/gitlab_project.py
index 4f016bc1..302965fc 100644
--- a/source_control/gitlab_project.py
+++ b/source_control/gitlab_project.py
@@ -163,6 +163,9 @@ try:
except:
HAS_GITLAB_PACKAGE = False
+from ansible.module_utils.basic import *
+from ansible.module_utils.pycompat24 import get_exception
+
class GitLabProject(object):
def __init__(self, module, git):
@@ -361,7 +364,8 @@ def main():
git.login(user=login_user, password=login_password)
else:
git = gitlab.Gitlab(server_url, token=login_token, verify_ssl=verify_ssl)
- except Exception, e:
+ except Exception:
+ e = get_exception()
module.fail_json(msg="Failed to connect to Gitlab server: %s " % e)
# Validate if project exists and take action based on "state"
@@ -391,7 +395,7 @@ def main():
else:
module.exit_json(changed=False)
-from ansible.module_utils.basic import *
+
if __name__ == '__main__':
main()