From 5d91cb2ccffd6b5f6e75e3ceb9053aa3379695df Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 24 Jun 2019 12:00:55 +0200 Subject: [PATCH] Bug fix python 3 --- gitlab_host.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gitlab_host.py b/gitlab_host.py index aa130a8..7c389a3 100644 --- a/gitlab_host.py +++ b/gitlab_host.py @@ -3,7 +3,6 @@ RETURN = '''# ''' from subprocess import call -import string try: import gitlab @@ -73,7 +72,7 @@ def main(): 'namespace_id': cgroup.id, }) # Add remote repo to etckeeper git repo - cmd = ['git', 'remote', 'add', 'origin', '%s:ansible-inventories/hosts/%s/%s.git' % (string.replace(server_url, 'https://', 'git@'), company, hostname)] + cmd = ['git', 'remote', 'add', 'origin', '%s:ansible-inventories/hosts/%s/%s.git' % (server_url.replace('https://', 'git@'), company, hostname)] call(cmd, cwd='/etc') project = git.projects.get(gproject.id) # type: gitlab.Project @@ -83,7 +82,7 @@ def main(): 'can_push': True, }) except Exception as e: - module.fail_json(msg="Creating new host project failed: %s" % e.message, response=e) + module.fail_json(msg="Creating new host project failed: %s" % str(e), response=e) return module.exit_json(changed=changed, result="Successfully created project %s/ansible-inventories/hosts/%s/%s" % (server_url, company, hostname)) -- GitLab