Issue with creating nested repository
Summary
When creating repositories using the python-gitlab
tool, sometimes the creation fails with the error: 400: Failed to save group {:path=>["has already been taken"]}
yet the project does not exist.
Steps to reproduct
Example Project
What is the current bug behavior?
What is the expected correct behavior?
Relevant logs and/or screenshots
+ python3 -u -m src.main.py.repo_manager.actions.create_legacy --RepoPath repo/path --ReadEnabledKeys 23,24,207,248,82 --WriteEnabledKeys 23,24,207,248 --GitlabUrl https://xxxxxx.com/
Creating project from path: BHMDeploymentConfiguration/d0/claims/frid
Creating group: d0
Traceback (most recent call last):
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/gitlab/exceptions.py", line 279, in wrapped_f
return f(*args, **kwargs)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/gitlab/mixins.py", line 214, in create
server_data = self.gitlab.http_post(path, post_data=data, files=files, **kwargs)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 682, in http_post
**kwargs
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 570, in http_request
response_body=result.content,
gitlab.exceptions.GitlabHttpError: 400: Failed to save group {:path=>["has already been taken"]}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/var/lib/jenkins/workspace/Orchestration/utilities/gitlab-repository-creator/src/main/py/repo_manager/actions/create_legacy.py", line 34, in <module>
write_enabled_keys=args.WriteEnabledKeys
File "/var/lib/jenkins/workspace/Orchestration/utilities/gitlab-repository-creator/src/main/py/repo_manager/actions/create_legacy.py", line 11, in execute
object_path=repo_path
File "/var/lib/jenkins/workspace/Orchestration/utilities/gitlab-repository-creator/src/main/py/repo_manager/actions/base_manage.py", line 10, in execute
gl_object = gitlab_object(object_type).from_path(object_path, create_if_not_present=is_create_action)
File "/var/lib/jenkins/workspace/Orchestration/utilities/gitlab-repository-creator/src/main/py/repo_manager/gitlab/model.py", line 93, in from_path
return GitlabGroup.from_path("/".join(path_segments[0:-1]), create_if_not_present=create_if_not_present)\
File "/var/lib/jenkins/workspace/Orchestration/utilities/gitlab-repository-creator/src/main/py/repo_manager/gitlab/model.py", line 33, in from_path
target_group = target_group.get_subgroup(subgroup_name, create_if_not_present=create_if_not_present)
File "/var/lib/jenkins/workspace/Orchestration/utilities/gitlab-repository-creator/src/main/py/repo_manager/gitlab/model.py", line 68, in get_subgroup
return GitlabGroup(self.__get_sub_object('group', name, create_if_not_present))
File "/var/lib/jenkins/workspace/Orchestration/utilities/gitlab-repository-creator/src/main/py/repo_manager/gitlab/model.py", line 59, in __get_sub_object
target_parent_id_key: self.api_object.id
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/gitlab/exceptions.py", line 281, in wrapped_f
raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabCreateError: 400: Failed to save group {:path=>["has already been taken"]}
-------------------------------
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)