gitlab_management.base module¶
https://gitlab.com/nofusscomputing/projects/python-gitlab-management
-
class
gitlab_management.base.GitlabManagement(GitLab_URL: str, GitLab_PrivateToken: str)[source]¶ Bases:
object-
CreateGroupLabel(Group: gitlab.v4.objects.Group, Name: str, Description: str, Color: str) → bool[source]¶ Create a group label within the specified group
Parameters: - Group (gitlab.v4.objects.Group) – A gitlab group Object
- Name (str) – The name of the label to create
- Description (str) – The description for the label. the description will be prefixed with [Managed Label] to denote this script created the label.
- Color (str) – the colour that the label shoud be in format ‘#RRGGBB’
Raises: Exception– No Exception is returned, however the exception will be printed to the consoleReturns: if the string was successfully created, true is returned. false will be returned when there was an exception
Return type: bool
-
GetConfig() → bool[source]¶ Read all of the config.yml config file to an object in this class.
Raises: yaml.YAMLError– any error with the yml, will return the text outputException– Generic catch all exception. if this exception occurs, please log an issue ticket.
Returns: returns success/failure on reading the config and adding to the class object self.Config
Return type: bool
-
GetGroupByName(GroupName: str) → gitlab.v4.objects.Group[source]¶ Find and return a group by name.
Workflow 1. Find all groups that the current user (the one authorized in this module) has maintainer access to 2. iterate through all returned groups until the group is found that matches the string.
Parameters: GroupName (str) – description
Raises: Exception– Generic catch all exception. if this method returns an exception please log an issue.# ToDo: add proper error checking and exception checking.
Returns: - gitlab.v4.objects.Group – The Group that matches the search string will be returned.
- None – Returned if nothing found
-
GetLabelByName(Group: gitlab.v4.objects.Group, LabelName: str) → gitlab.v4.objects.GroupLabel[source]¶ Finds a label by human readable name and returns a gitlab.v4.objects.GroupLabel object.
Workflow: 1. iterate through each label in the group until the LabelName matches. 2. return the label as a gitlab.v4.objects.GroupLabel
Parameters: - Group (gitlab.v4.objects.Group) – The group that is being searched.
- LabelName (str) – The group name to search for.
Raises: - #ToDo: do some error checking
- Nothing is raised in this method.
Returns: - gitlab.v4.objects.GroupLabel – returns thoe object that has a name that matches what was searched for.
- None – Only returned if no group is found.
-
GitLabAPIWrapper= <module 'gitlab' from '/home/docs/checkouts/readthedocs.org/user_builds/python-gitlab-management/envs/0.1.2.rc2006061112/lib/python3.7/site-packages/gitlab/__init__.py'>[source]¶
-
GitlabLoginAuthenticate(URL: str, PrivateToken: str) → bool[source]¶ Establish the Gitlab instance to connect to and authenticate.
Parameters: - URL (str) – The url of the gitlab instance to connect to.
- PrivateToken (str) – The private token of the user that will be used to authenticate against the gitlab instance.
Raises: GitLabAPIWrapper.GitlabAuthenticationError– Returns text output of the failed authentication issue that occured when attemping to authenticate.Exception– Generic catch all exception.
Returns: Returns bool to denote success/failure of the connection and authentication.
Return type: bool
-
Output(OutputLevel: gitlab_management.base.GitlabManagement.OutputSeverity, OutputMessage: str) → None[source]¶ Method to output commands to the console.
Parameters: - OutputLevel (GitlabManagement.OutputSeverity(Enum)) – The output leval that the message is categorised as.
- OutputMessage (str) – The text to output.
Raises: Exception– None raised. # ToDo: do proper error and exception handling.Returns: This method does not require output as it is part of the error handling of the application.
Return type: None
-
ProcessConfigLabels(ConfigGroups: list) → bool[source]¶ Process the provided configuration labels.
Parameters: ConfigGroups (list) – The labels array from the config.yml file
The array that is passed to the function is processed as follows.
- iterates through list of labels
- finds the group id that the label is for
- confirms that label attributes are in the config file Group, Name, Description and color.
- creates the label in each group that the label is intended for. CreateGroupLabel() does the check to see if it exists before creating it.
Raises: Exception– currently is a catch all exception. if this function returns an exception, an issue needs to be raised.Returns: returns bool denoting success/failure for the processing of the labels provided. Return type: bool
-
gitlab= <module 'gitlab' from '/home/docs/checkouts/readthedocs.org/user_builds/python-gitlab-management/envs/0.1.2.rc2006061112/lib/python3.7/site-packages/gitlab/__init__.py'>[source]¶
-