mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
remove wildcards and add boilerplate
* cloud/centurylink * source_control * cloud/google * notification * cloud/rackspace * cloud/vmware
This commit is contained in:
parent
21564cdb98
commit
4109a82d0a
135 changed files with 1343 additions and 2631 deletions
|
@ -1,20 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# (c) 2015, Werner Dijkerman (ikben@werner-dijkerman.nl)
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -151,8 +141,8 @@ try:
|
|||
except:
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class GitLabUser(object):
|
||||
|
@ -195,8 +185,6 @@ class GitLabUser(object):
|
|||
|
||||
# Create the user
|
||||
user_username = arguments['username']
|
||||
user_name = arguments['name']
|
||||
user_email = arguments['email']
|
||||
if self._gitlab.createuser(password=user_password, confirm=confirm, **arguments):
|
||||
user_id = self.getUserId(user_username)
|
||||
if self._gitlab.addsshkeyuser(user_id=user_id, title=user_sshkey_name, key=user_sshkey_file):
|
||||
|
@ -344,9 +332,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 = get_exception()
|
||||
module.fail_json(msg="Failed to connect to Gitlab server: %s " % e)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to connect to Gitlab server: %s " % to_native(e))
|
||||
|
||||
# Check if user is authorized or not before proceeding to any operations
|
||||
# if not, exit from here
|
||||
|
@ -370,6 +357,5 @@ def main():
|
|||
user.createOrUpdateUser(user_name, user_username, user_password, user_email, user_sshkey_name, user_sshkey_file, group_name, access_level, confirm)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue