You need to sign in or sign up before continuing.
Error - Label exists (only first page of results checked)
Summary
when attempting to process labels (-l
switch) an uncaught exception occurs. when a scoped label exists i.e. scoped::label
the exception is thrown stating the label already exists.
Update: wasn't caused by scoped labels, a non-scoped label still caused the same issue.
Steps to reproduce
- add a scoped label to
config.yml
that doesn't exist in the specified group. - run
gitlab-management
with switch -l` - after first run no issues, the label is created.
- run
gitlab-management
a second time and the exception occurs
What is the current bug behavior?
it prevents the application from continuing to run.
What is the expected correct behavior?
A check is done to confirm the label exists before attempting to create it.
Relevant logs and/or screenshots
starting
Notice: config loaded
Notice: Processing Config: labels
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/gitlab/exceptions.py", line 275, in wrapped_f
return f(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/gitlab/mixins.py", line 214, in create
server_data = self.gitlab.http_post(path, post_data=data, files=files, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/gitlab/__init__.py", line 684, in http_post
**kwargs
File "/usr/local/lib/python3.6/dist-packages/gitlab/__init__.py", line 574, in http_request
response_body=result.content,
gitlab.exceptions.GitlabHttpError: 409: Label already exists
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "[Redacted User Home Dir]/tmp/gitlab-bot/gitlab_management/base.py", line 228, in CreateGroupLabel
Group.labels.create(NewLabelString)
File "/usr/local/lib/python3.6/dist-packages/gitlab/exceptions.py", line 277, in wrapped_f
raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabCreateError: 409: Label already exists
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "[Redacted User Home Dir]/tmp/gitlab-bot/gitlab_management/base.py", line 392, in ProcessConfigLabels
self.CreateGroupLabel(self.GetGroupByName(Label['Group']), Label['Name'], Label['Description'], Label['Color'])
File "[Redacted User Home Dir]/tmp/gitlab-bot/gitlab_management/base.py", line 240, in CreateGroupLabel
self.Output(self.OutputSeverity.Critical, logging.error(traceback.format_exc()))
NameError: name 'logging' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "[Redacted User Home Dir]/tmp/gitlab-bot/gitlab_management/cli.py", line 89, in main
GitlabManagementObject.ProcessConfigLabels(GitlabManagementObject.Config['Group']['Labels'])
File "[Redacted User Home Dir]/tmp/gitlab-bot/gitlab_management/base.py", line 401, in ProcessConfigLabels
self.Output(self.OutputSeverity.Critical, logging.error(traceback.format_exc()))
NameError: name 'logging' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "[Redacted User Home Dir]/tmp/gitlab-bot/gitlab_management/__main__.py", line 6, in <module>
main()
File "[Redacted User Home Dir]/tmp/gitlab-bot/gitlab_management/cli.py", line 103, in main
print(logging.error(traceback.format_exc()))
NameError: name 'logging' is not defined
Possible fixes
-
Feature Check that the label does not exists before attempting to create -
Feature confirm if special chars need url encoding when a check is done for the labels existance
Details
- Module Version: 0.1.2.rc2006061112
- Python Version: 3.6
- Environment: development
Edited by Jon