settings module¶
The settings module of GitLab Guard.
- class confirm.gitlab_guard.settings.Settings(project, defaults, overrides, fix)¶
The class which does all the heavy load to compare the expected, with the current project settings.
- Parameters:
project (gitlab.v4.objects.projects.Project) – The project
defaults (dict) – The default settings
overrides (dict) – The project overrrides
fix (bool) – Fix violations automatically
- get_current_settings(settings)¶
Retreive the current settings of a project, given by the current configuration in GitLab itself.
- Parameters:
settings (iterable) – The settings to get
- Returns:
The current settings
- Return type:
dict
- get_expected_settings()¶
The expected settings for a project.
These settings will be retrieved from 3 different sources:
The defaults from the
defaults.ymlThe project-specific overrides from the
.gitlab-guard.ymloverridesAn eventual disabled repository directly from the GitLab project settings
The third one is an execption, as a disabled repository setting is the only setting which is allowed to be configured in the GitLab project itself. Overrides are not possible, since this is a chicken-egg issue (override needs repository, but repository is disabled).
- Returns:
The expected settings
- Return type:
dict
- verify()¶
Verify the settings.
- Raises:
UpdateError – When project couldn’t be updated
- Returns:
Violations
- Return type:
int