summaryrefslogtreecommitdiff
path: root/yang
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2023-01-24 18:17:05 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2023-01-24 18:19:18 +0100
commit05a13c2cd4fedcf55ddb3e4a20b7dc2a64abd937 (patch)
treee5b6fec03b7454ba8ca7215ba684cd0a32291592 /yang
parentd173381edcd8054494f26f29bfb237630dfc7724 (diff)
yang: fix race condition in embedmodel.py mkdir
Parallel build may be executing another copy of embedmodel.py at the same time, with both getting "False" on the isdir check, and then both trying to mkdir - one of which will error out. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'yang')
-rw-r--r--yang/embedmodel.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/yang/embedmodel.py b/yang/embedmodel.py
index a77a81363f..c532973d7c 100644
--- a/yang/embedmodel.py
+++ b/yang/embedmodel.py
@@ -12,8 +12,10 @@ inname = sys.argv[1]
outname = sys.argv[2]
outdir = os.path.dirname(os.path.abspath(outname))
-if not os.path.isdir(outdir):
+try:
os.makedirs(outdir)
+except FileExistsError:
+ pass
# these are regexes to avoid a compile-time/host dependency on yang-tools
# or python-yang. Cross-compiling FRR is already somewhat involved, no need