Skip to content

Commit 4c8d3b3

Browse files
committed
[ARM] az bicep: fix installation check for concurrent usages
If `az` is called by multiple processes or threads the code has a race condition. By simply allowing for the directory to exist, the same behavior as before is achieved without failing in concurrent usages.
1 parent ac6f490 commit 4c8d3b3

File tree

1 file changed

+1
-2
lines changed
  • src/azure-cli/azure/cli/command_modules/resource

1 file changed

+1
-2
lines changed

src/azure-cli/azure/cli/command_modules/resource/_bicep.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ def ensure_bicep_installation(cli_ctx, release_tag=None, target_platform=None, s
122122
return
123123

124124
installation_dir = os.path.dirname(installation_path)
125-
if not os.path.exists(installation_dir):
126-
os.makedirs(installation_dir)
125+
os.makedirs(installation_dir, exist_ok=True)
127126

128127
try:
129128
release_tag = release_tag if release_tag else get_bicep_latest_release_tag()

0 commit comments

Comments
 (0)