diff --git a/gitlab_host.py b/gitlab_host.py index aa130a853bc63a70c11908f517393370ff7d067e..7c389a3f9e34f8be5c9c76045de29d154882a883 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))