mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
* Add additional auth support to Gitlab (#705) - removed unused imports from module_utils.gitlab - fix bug in gitlab_project to check if avatar_path is provided * add doc_fragment and argument_spec for gitlab auth * doc fixes and remove avatar_path bug fix * small doc changes, pass validate_certs to requests call * update changelog
This commit is contained in:
parent
11fcf661bf
commit
52ad0a5fbb
15 changed files with 298 additions and 250 deletions
|
@ -18,7 +18,8 @@ requirements:
|
|||
- python >= 2.7
|
||||
- python-gitlab >= 2.3.0
|
||||
extends_documentation_fragment:
|
||||
- community.general.auth_basic
|
||||
- community.general.auth_basic
|
||||
- community.general.gitlab
|
||||
|
||||
options:
|
||||
state:
|
||||
|
@ -27,11 +28,6 @@ options:
|
|||
default: present
|
||||
type: str
|
||||
choices: ["present", "absent"]
|
||||
api_token:
|
||||
description:
|
||||
- GitLab access token with API permissions.
|
||||
required: true
|
||||
type: str
|
||||
project:
|
||||
description:
|
||||
- The path and name of the project.
|
||||
|
@ -87,7 +83,7 @@ except Exception:
|
|||
GITLAB_IMP_ERR = traceback.format_exc()
|
||||
HAS_GITLAB_PACKAGE = False
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import gitlab_authentication
|
||||
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
|
||||
|
||||
|
||||
class GitlabProtectedBranch(object):
|
||||
|
@ -141,8 +137,8 @@ class GitlabProtectedBranch(object):
|
|||
|
||||
def main():
|
||||
argument_spec = basic_auth_argument_spec()
|
||||
argument_spec.update(auth_argument_spec())
|
||||
argument_spec.update(
|
||||
api_token=dict(type='str', required=True, no_log=True),
|
||||
project=dict(type='str', required=True),
|
||||
name=dict(type='str', required=True),
|
||||
merge_access_levels=dict(type='str', default="maintainer", choices=["maintainer", "developer", "nobody"]),
|
||||
|
@ -154,13 +150,16 @@ def main():
|
|||
argument_spec=argument_spec,
|
||||
mutually_exclusive=[
|
||||
['api_username', 'api_token'],
|
||||
['api_password', 'api_token'],
|
||||
['api_username', 'api_oauth_token'],
|
||||
['api_username', 'api_job_token'],
|
||||
['api_token', 'api_oauth_token'],
|
||||
['api_token', 'api_job_token'],
|
||||
],
|
||||
required_together=[
|
||||
['api_username', 'api_password'],
|
||||
],
|
||||
required_one_of=[
|
||||
['api_username', 'api_token']
|
||||
['api_username', 'api_token', 'api_oauth_token', 'api_job_token']
|
||||
],
|
||||
supports_check_mode=True
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue