Commit 14c13299 authored by Brennen Bearnes's avatar Brennen Bearnes
Browse files

stub out configure-projects command, fill out a bit

`configure-projects` uses the python-gitlab project to loop over all
projects in the instance and disable issues and wikis.

This also adds a requirements.txt and some rudimentary instructions in the
parent ea4e1e2d
A collection of GitLab CE settings, and a Python script for applying them via
[the settings API][gl-settings].
A collection of GitLab CE settings for the [Wikimedia GitLab instance][wmf-gl],
along with Python utilities for applying them via [the settings
pip3 install -r requirements.txt
View current instance settings:
Apply instance settings from `settings.yaml`:
Apply project settings (at the moment, this disables wikis and issue tracking
for any projects that have turned it on):
#!/usr/bin/env python3
configure-projects - apply settings to all projects on GitLab instance
import os
import sys
import yaml
import argparse
import gitlab
import time
from gitlab_settings.util import get_token
def get_gitlab():
"""Get a GitLab instance."""
token = get_token()
server = gitlab.Gitlab('', private_token=token)
return server
def get_projects():
"""Get all projects on the server as a generator."""
server = get_gitlab()
return server.projects.list(all=True, as_list=False)
for project in get_projects():
if project.issues_access_level != 'disabled':
print('Disabling issue access for ',
project.issues_access_level = 'disabled'
print('Issues already disabled for ',
if project.wiki_access_level != 'disabled':
print('Disabling wiki access for',
project.wiki_access_level = 'disabled'
print('Wiki already disabled for',
......@@ -13,7 +13,7 @@ import sys
import yaml
from gitlab_settings.util import get_token
token = get_token
token = get_token()
url = ''
headers = {
'User-Agent': 'gitlab-settings/0.0.1',
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment