Avoid error with slash in git branch name#6120
Avoid error with slash in git branch name#6120AlanCoding wants to merge 1 commit intoansible:develfrom
Conversation
|
Build succeeded.
|
| if not os.path.exists(destination_folder): | ||
| os.mkdir(destination_folder, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC) | ||
| tmp_branch_name = 'awx_internal/{}'.format(uuid4()) | ||
| tmp_branch_name = 'awx_internal_{}'.format(uuid4()) |
There was a problem hiding this comment.
🤔
I do not doubt that this fixes the problem, but given that we already include a uuid in the branch name, I'm wondering why removing the forward slash prevents a duplicate file exception ?
Is it because we're always creating an awx_internal directory (because of the slash) and so the uuids don't matter?
There was a problem hiding this comment.
yeah I'm guessing that's probably it:
FileExistsError: [Errno 17] File exists: '/var/lib/awx/projects/_71__project_aspectmatter/.git/refs/heads/awx_internal' <-----------------------------------------
There was a problem hiding this comment.
It's how git works, in that it nests these refs under directories when there are slashes. The race condition is where the library we use doesn't account for multi-processing, and tests for existence and creates the directory with a time gap in-between.
|
Closing in favor of gitpython-developers/GitPython#998 |
SUMMARY
Speculative fix for #6119
ISSUE TYPE
COMPONENT NAME
AWX VERSION
ADDITIONAL INFORMATION
still needs better replication and confirmation of fix