azure-cli: "az storage blob upload-batch" no longer works
Describe the bug
Using mcr.microsoft.com/azure-cli:latest
fails with “No such file or directory: ‘$web’”. However using mcr.microsoft.com/azure-cli:2.9.1
works.
To Reproduce
Using mcr.microsoft.com/azure-cli:latest
$ az storage blob upload-batch -s ./build -d '$web' --account-name $AZURE_STORAGE_ACCOUNT_NAME --account-key $AZURE_STORAGE_ACCESS_KEY
The command failed with an unexpected error. Here is the traceback:
[Errno 2] No such file or directory: '$web'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute
raise ex
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 709, in _run_job
cmd_copy.exception_handler(ex)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 325, in new_handler
raise ex
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
result = cmd_copy(params)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__
return self.handler(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 765, in default_command_handler
return op(**command_args)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 305, in storage_blob_upload_batch
if_none_match=if_none_match, timeout=timeout)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/util.py", line 225, in wrapper
return True, func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 281, in _upload_blob
return upload_blob(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 451, in upload_blob
return type_func[blob_type]()
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 444, in upload_block_blob
return client.create_blob_from_path(**create_blob_args)
File "/usr/local/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/blockblobservice.py", line 453, in create_blob_from_path
count = path.getsize(file_path)
File "/usr/local/lib/python3.6/genericpath.py", line 50, in getsize
return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: '$web'
Expected behavior
Command to finish successfully.
Environment summary
Docker image sha256:55a65eee1172e112a466d82671410fd2b3d1bed4f7c144e4f375dca2f2c7347f for mcr.microsoft.com/azure-cli
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 30
- Comments: 32 (3 by maintainers)
Hi @yonzhan. Looking at that milestone, it is planned to be released on August 25th (3 weeks from now).
Is that an accurate timeline here? I’m trying to determine whether I should submit a patch to revert back to v2.9.1 or wait for a hotfix, as this is a major blocker for those using Azure Storage for static website hosting.
Thanks!
The latest azure-cli version have the issue, try to use the old version, it solved the issue for me, I revert back to version: 2.1.0 If you don’t have any specific dependencies on the azure-cli latest version, then I try to use the old version, that may help
for ubuntu 18 : azure-cli=2.1.0-1~bionic
Hi all, We just released hotfix version 2.10.1 and please see https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest for installation. Homebrew for MacOS will be available tomorrow after the PR merged.
It worked after switching my gitlab build from
to
I didn’t even notice until now that I was using an older docker image
microsoft/azure-cli
that was moved tomcr.microsoft.com/azure-cli
Posting here for those looking for a workaround with the
azure-blob-storage-upload
github action:https://github.com/bacongobbler/azure-blob-storage-upload/commit/79465224a1ed32bc66105a825839e9f71a544fa0 was the fix reported by a few community members (thanks to @linkeshkanna for reporting the bug and following up with confirmation on a fix).
Changing
azcliversion
to2.9.1
as @trendoid suggested also works for theAzure/cli
action.@lgmorand we have updated the docker image with the
latest
tag, you can also use the version tagmcr.microsoft.com/azure-cli:2.9.1
Add @fengzhou-msft to help with docker image.
same here