1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-24 22:06:14 +01:00

Fix failure to create config in current dir

This uses exception based protection from parallel execution
https://github.com/openSUSE/osc/pull/1077#discussion_r928976845
This commit is contained in:
Anatoli Babenia 2022-07-24 15:36:23 +03:00
parent 8f12f884c8
commit 6a9398a97b

View File

@ -827,9 +827,10 @@ def write_config(fname, cp):
fname = os.readlink(fname)
# create directories to the config file (if they don't exist already)
if not os.path.exists(os.path.dirname(fname)):
fdir = os.path.dirname(fname)
if fdir:
try:
os.makedirs(os.path.dirname(fname), mode=0o700)
os.makedirs(fdir, mode=0o700)
except OSError as e:
if e.errno != errno.EEXIST:
raise