1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #8688/e7480ad2 backport][stable-9] gitlab_project: Add some missing params (#8742)

gitlab_project: Add some missing params (#8688)

(cherry picked from commit e7480ad29e)

Co-authored-by: Julien Lecomte <julien-lecomte@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2024-08-12 08:07:18 +02:00 committed by GitHub
parent e10f95836e
commit 825bd81e44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 1 deletions

View file

@ -0,0 +1,4 @@
minor_changes:
- gitlab_project - add option ``pages_access_level`` to disable project pages (https://github.com/ansible-collections/community.general/pull/8688).
- gitlab_project - add option ``service_desk_enabled`` to disable service desk (https://github.com/ansible-collections/community.general/pull/8688).
- gitlab_project - add option ``model_registry_access_level`` to disable model registry (https://github.com/ansible-collections/community.general/pull/8688).

View file

@ -302,6 +302,27 @@ options:
- Keep tags matching this regular expression. - Keep tags matching this regular expression.
type: str type: str
version_added: "9.3.0" version_added: "9.3.0"
pages_access_level:
description:
- V(private) means that accessing pages tab is allowed only to project members.
- V(disabled) means that accessing pages tab is disabled.
- V(enabled) means that accessing pages tab is enabled.
type: str
choices: ["private", "disabled", "enabled"]
version_added: "9.3.0"
service_desk_enabled:
description:
- Enable Service Desk.
type: bool
version_added: "9.3.0"
model_registry_access_level:
description:
- V(private) means that accessing model registry tab is allowed only to project members.
- V(disabled) means that accessing model registry tab is disabled.
- V(enabled) means that accessing model registry tab is enabled.
type: str
choices: ["private", "disabled", "enabled"]
version_added: "9.3.0"
''' '''
EXAMPLES = r''' EXAMPLES = r'''
@ -429,6 +450,9 @@ class GitLabProject(object):
'monitor_access_level': options['monitor_access_level'], 'monitor_access_level': options['monitor_access_level'],
'security_and_compliance_access_level': options['security_and_compliance_access_level'], 'security_and_compliance_access_level': options['security_and_compliance_access_level'],
'container_expiration_policy': options['container_expiration_policy'], 'container_expiration_policy': options['container_expiration_policy'],
'pages_access_level': options['pages_access_level'],
'service_desk_enabled': options['service_desk_enabled'],
'model_registry_access_level': options['model_registry_access_level'],
} }
# topics was introduced on gitlab >=14 and replace tag_list. We get current gitlab version # topics was introduced on gitlab >=14 and replace tag_list. We get current gitlab version
@ -603,6 +627,9 @@ def main():
name_regex=dict(type='str'), name_regex=dict(type='str'),
name_regex_keep=dict(type='str'), name_regex_keep=dict(type='str'),
)), )),
pages_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
service_desk_enabled=dict(type='bool'),
model_registry_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -664,6 +691,9 @@ def main():
security_and_compliance_access_level = module.params['security_and_compliance_access_level'] security_and_compliance_access_level = module.params['security_and_compliance_access_level']
topics = module.params['topics'] topics = module.params['topics']
container_expiration_policy = module.params['container_expiration_policy'] container_expiration_policy = module.params['container_expiration_policy']
pages_access_level = module.params['pages_access_level']
service_desk_enabled = module.params['service_desk_enabled']
model_registry_access_level = module.params['model_registry_access_level']
# Set project_path to project_name if it is empty. # Set project_path to project_name if it is empty.
if project_path is None: if project_path is None:
@ -702,7 +732,7 @@ def main():
if project_exists: if project_exists:
gitlab_project.delete_project() gitlab_project.delete_project()
module.exit_json(changed=True, msg="Successfully deleted project %s" % project_name) module.exit_json(changed=True, msg="Successfully deleted project %s" % project_name)
module.exit_json(changed=False, msg="Project deleted or does not exists") module.exit_json(changed=False, msg="Project deleted or does not exist")
if state == 'present': if state == 'present':
@ -740,6 +770,9 @@ def main():
"security_and_compliance_access_level": security_and_compliance_access_level, "security_and_compliance_access_level": security_and_compliance_access_level,
"topics": topics, "topics": topics,
"container_expiration_policy": container_expiration_policy, "container_expiration_policy": container_expiration_policy,
"pages_access_level": pages_access_level,
"service_desk_enabled": service_desk_enabled,
"model_registry_access_level": model_registry_access_level,
}): }):
module.exit_json(changed=True, msg="Successfully created or updated the project %s" % project_name, project=gitlab_project.project_object._attrs) module.exit_json(changed=True, msg="Successfully created or updated the project %s" % project_name, project=gitlab_project.project_object._attrs)