Skip to content
Snippets Groups Projects
Commit 45660c7b authored by nd's avatar nd
Browse files
parents 12f7e936 a07dcd65
Branches
No related tags found
No related merge requests found
...@@ -106,7 +106,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run= ...@@ -106,7 +106,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
existing_member_dns = [] existing_member_dns = []
logging.debug('Checking current Gitlab group members') logging.debug('Checking current Gitlab group members')
members = group.members.list(all=True) members = group.members.list(all=True)
owner_count = len([member for member in members if member.access_level == gitlab.OWNER_ACCESS]) owner_count = len([member for member in members if member.access_level == gitlab.const.OWNER_ACCESS])
logging.debug('Group has %d owners', owner_count) logging.debug('Group has %d owners', owner_count)
for member in members: for member in members:
user = gl.users.get(member.id) user = gl.users.get(member.id)
...@@ -120,9 +120,9 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run= ...@@ -120,9 +120,9 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
logging.info('Removing user %s from group %s', dn, group.full_path) logging.info('Removing user %s from group %s', dn, group.full_path)
if not dry_run: if not dry_run:
member.delete() member.delete()
elif member.access_level != gitlab.MASTER_ACCESS: elif member.access_level != gitlab.const.MAINTAINER_ACCESS:
# We cannot change the access level of the last owner of a top-level group # We cannot change the access level of the last owner of a top-level group
if member.access_level == gitlab.OWNER_ACCESS: if member.access_level == gitlab.const.OWNER_ACCESS:
if owner_count == 1 and not group.parent_id: if owner_count == 1 and not group.parent_id:
logging.info('Not updating access level of %s in group %s, because it is the last owner', dn, group.full_path) logging.info('Not updating access level of %s in group %s, because it is the last owner', dn, group.full_path)
continue continue
...@@ -130,7 +130,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run= ...@@ -130,7 +130,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
logging.info('Updating access level of %s in group %s', dn, group.full_path) logging.info('Updating access level of %s in group %s', dn, group.full_path)
try: try:
if not dry_run: if not dry_run:
member.access_level = gitlab.MASTER_ACCESS member.access_level = gitlab.const.MAINTAINER_ACCESS
member.save() member.save()
except gitlab.exceptions.GitlabUpdateError as e: except gitlab.exceptions.GitlabUpdateError as e:
logging.exception('Access level update of %s in group %s failed', dn, group.full_path) logging.exception('Access level update of %s in group %s failed', dn, group.full_path)
...@@ -144,7 +144,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run= ...@@ -144,7 +144,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
continue continue
try: try:
if not dry_run: if not dry_run:
group.members.create({'user_id': user.id, 'access_level': gitlab.MASTER_ACCESS}) group.members.create({'user_id': user.id, 'access_level': gitlab.const.MAINTAINER_ACCESS})
except gitlab.exceptions.GitlabCreateError as e: except gitlab.exceptions.GitlabCreateError as e:
if e.response_code == 500: if e.response_code == 500:
logging.info('Adding user %s to group %s failed with Internal Server Error', dn, group.full_path) logging.info('Adding user %s to group %s failed with Internal Server Error', dn, group.full_path)
......
...@@ -1783,68 +1783,6 @@ registry_nginx['enable'] = false ...@@ -1783,68 +1783,6 @@ registry_nginx['enable'] = false
# To completely disable prometheus, and all of it's exporters, set to false # To completely disable prometheus, and all of it's exporters, set to false
# prometheus_monitoring['enable'] = true # prometheus_monitoring['enable'] = true
################################################################################
## Grafana Dashboards
##! Docs: https://docs.gitlab.com/ee/administration/monitoring/prometheus/#prometheus-as-a-grafana-data-source
################################################################################
grafana['enable'] = false
# grafana['log_directory'] = '/var/log/gitlab/grafana'
# grafana['home'] = '/var/opt/gitlab/grafana'
# grafana['admin_password'] = 'admin'
# grafana['allow_user_sign_up'] = false
# grafana['basic_auth_enabled'] = false
# grafana['disable_login_form'] = true
# grafana['gitlab_application_id'] = 'GITLAB_APPLICATION_ID'
# grafana['gitlab_secret'] = 'GITLAB_SECRET'
# grafana['env_directory'] = '/opt/gitlab/etc/grafana/env'
# grafana['allowed_groups'] = []
# grafana['gitlab_auth_sign_up'] = true
# grafana['env'] = {
# 'SSL_CERT_DIR' => "#{node['package']['install-dir']}/embedded/ssl/certs/"
# }
# grafana['metrics_enabled'] = false
# grafana['metrics_basic_auth_username'] = 'grafana_metrics' # default: nil
# grafana['metrics_basic_auth_password'] = 'please_set_a_unique_password' # default: nil
### Dashboards
#
# See: http://docs.grafana.org/administration/provisioning/#dashboards
#
# NOTE: Setting this will override the default.
#
# grafana['dashboards'] = [
# {
# 'name' => 'GitLab Omnibus',
# 'orgId' => 1,
# 'folder' => 'GitLab Omnibus',
# 'type' => 'file',
# 'disableDeletion' => true,
# 'updateIntervalSeconds' => 600,
# 'options' => {
# 'path' => '/opt/gitlab/embedded/service/grafana-dashboards',
# }
# }
# ]
### Datasources
#
# See: http://docs.grafana.org/administration/provisioning/#example-datasource-config-file
#
# NOTE: Setting this will override the default.
#
# grafana['datasources'] = [
# {
# 'name' => 'GitLab Omnibus',
# 'type' => 'prometheus',
# 'access' => 'proxy',
# 'url' => 'http://localhost:9090'
# }
# ]
##! Advanced settings. Should be changed only if absolutely needed.
# grafana['http_addr'] = 'localhost'
# grafana['http_port'] = 3000
################################################################################ ################################################################################
## Gitaly ## Gitaly
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment