Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not error in race condition of directory existing #998

Merged
merged 1 commit into from
Mar 21, 2020

Conversation

AlanCoding
Copy link
Contributor

This address a rare race condition where the directory is created by simultaneous processes both trying to create things under the same folder.

ansible/awx#6119

File "/awx_devel/awx/main/tasks.py", line 2255, in make_local_copy
  source_branch = git_repo.create_head(tmp_branch_name, scm_revision)
File "/venv/awx/lib/python3.6/site-packages/git/repo/base.py", line 389, in create_head
  return Head.create(self, path, commit, force, logmsg)
File "/venv/awx/lib/python3.6/site-packages/git/refs/symbolic.py", line 546, in create
  return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg)
File "/venv/awx/lib/python3.6/site-packages/git/refs/symbolic.py", line 513, in _create
  ref.set_reference(target, logmsg)
File "/venv/awx/lib/python3.6/site-packages/git/refs/symbolic.py", line 329, in set_reference
  assure_directory_exists(fpath, is_file=True)
File "/venv/awx/lib/python3.6/site-packages/git/util.py", line 181, in assure_directory_exists
  os.makedirs(path)
File "/venv/awx/lib64/python3.6/os.py", line 220, in makedirs
  mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/var/lib/awx/projects/_71__project_aspectmatter/.git/refs/heads/awx_internal'

This has been available since python 3.2, and I see in your setup.py that you don't support python2 any longer, so this kwarg shouldn't cause problems.

@Byron
Copy link
Member

Byron commented Mar 21, 2020

Thanks so much! It's so painful to track these things down usually, and am glad it's as simple as adding another argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants