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

"az storage blob download" errors with or without any options provided, NoneType error #23082

Closed
GavBurke opened this issue Jun 30, 2022 · 12 comments
Assignees
Labels
Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team. needs-author-feedback More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage az storage
Milestone

Comments

@GavBurke
Copy link

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az storage blob download

Errors:

The command failed with an unexpected error. Here is the traceback:
'NoneType' object is not iterable
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 556, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 518, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 31, in load_arguments
    load_arguments(self, command)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_params.py", line 1839, in load_arguments
    help=sas_help.format(get_permission_help_string(t_file_system_permissions)),
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_validators.py", line 772, in get_permission_help_string
    return ' '.join(['({}){}'.format(x[0], x[1:]) for x in allowed_values])
TypeError: 'NoneType' object is not iterable

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • az storage blob download

Expected Behavior

File specified is downloaded

Environment Summary

Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-debian-10.12, Debian GNU/Linux 10 (buster)
Python 3.6.10
Installer: DEB

azure-cli 2.32.0

Extensions:
storage-preview 0.8.2
account 0.2.3

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage az storage labels Jun 30, 2022
@ghost ghost added this to the Backlog milestone Jun 30, 2022
@ghost ghost assigned evelyn-ys Jun 30, 2022
@ghost ghost added the Auto-Assign Auto assign by bot label Jun 30, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 30, 2022

storage

@RakeshMohanMSFT
Copy link
Contributor

@GavBurke Can you please upgrade to the latest version of az cli 2.38.0? and retry this operation.

@RakeshMohanMSFT RakeshMohanMSFT self-assigned this Jul 15, 2022
@RakeshMohanMSFT RakeshMohanMSFT added question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-author-feedback More information is needed from author to address the issue. CXP Attention This issue is handled by CXP team. labels Jul 15, 2022
@ghost
Copy link

ghost commented Jul 15, 2022

Thank you for your feedback. This has been routed to the support team for assistance.

@GavBurke
Copy link
Author

GavBurke commented Jul 15, 2022

This was happening in my VSCode devcontainer, which even after recreating was still failing. I've gone back to it today to see how I could update the az cli inside the container (as it has no internet access) but now it works fine

@GavBurke GavBurke closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2022
@GavBurke
Copy link
Author

GavBurke commented Jul 15, 2022

In actual fact, when I first opened my devcontainer a little earlier today and ran "az storage blob download", that command executed fine, (except of course it reports I'm missing arguments).

I then run our deploy command, which uses some Python code to fetch the Azure config (using method below), and it's at that point that the issue arises, giving the error about the "NoneType", and that then somehow makes running the "az storage blob download" from the terminal now broke too. Even exiting the devcontainer, allowing the docker container to stop and relaunching does not fix the issue. The method in Python is:

        sh.az(
          'storage', 'blob', 'download',
          '--auth-mode', 'login',
          '--subscription', azure_spoke_config_subscription_id,
          '--account-name', azure_spoke_config_storage_account_name,
          '--container-name', azure_spoke_config_container_name,
          '--name', azure_spoke_config_blob,
          '--file', azure_spoke_config_path)

@GavBurke GavBurke reopened this Jul 15, 2022
@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Jul 15, 2022
@GavBurke
Copy link
Author

GavBurke commented Jul 15, 2022

Actually, then even "az storage blob" gives an error, if it helps narrow down the issue....
az storage blob.txt

I've tried restarting my Docker Desktop now, even restarting my laptop, and the "az storage blob" command is again now completely broke in my devcontainer.

@evelyn-ys
Copy link
Member

Seems like the dependency is broken. Probably Python SDK azure-mgmt-storage or azure-multiapi-storage was not installed properly. CLI has to fetch some enum definitions from SDK but if no SDK found 'NoneType' object is not iterable would be raised.

Please check if CLI is installed successfully. FYI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli

@RakeshMohanMSFT RakeshMohanMSFT added needs-author-feedback More information is needed from author to address the issue. and removed needs-team-attention This issue needs attention from Azure service team or SDK team labels Jul 18, 2022
@GavBurke
Copy link
Author

Seems like the dependency is broken. Probably Python SDK azure-mgmt-storage or azure-multiapi-storage was not installed properly. CLI has to fetch some enum definitions from SDK but if no SDK found 'NoneType' object is not iterable would be raised.

Please check if CLI is installed successfully. FYI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli

Thanks for that info, it gives me something to look into. The azure-cli in installed via apt and the storage module is installed via pip so I’ll check out image creation output for issues. What’s more confusing is this image is working for colleagues and also for our prod deployments, just not when built for my devcontainer…

@GavBurke GavBurke reopened this Jul 18, 2022
@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Jul 18, 2022
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Jul 18, 2022
@GavBurke
Copy link
Author

Seems like the dependency is broken. Probably Python SDK azure-mgmt-storage or azure-multiapi-storage was not installed properly. CLI has to fetch some enum definitions from SDK but if no SDK found 'NoneType' object is not iterable would be raised.

Please check if CLI is installed successfully. FYI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli

Hey @evelyn-ys , I've checked our requirements.txt and we don't install either of these packages. We do, however, install azure-storage-blob via pip, as well as many other Azure packages like azure-core, azure-cli-core, azure-mgmt-core..., but they all reported installing correctly. We do allow the latest packages from PyPI to be grabbed when installing (in our latest image azure-cli-core installed 2.37.0, whilst we have pegged the azure-cli version installed via apt to 2.32.0, if that could possibly cause any issue?

And then just to check we're installing in the correct method, we install the azure-cli via apt first, then run the pip install afterwards?

@evelyn-ys
Copy link
Member

Adding packaging expert @jiasli

@jiasli
Copy link
Member

jiasli commented Jul 18, 2022

Azure CLI installed using apt is at /opt/az/lib/python3.10/site-packages, but if you install packages with pip3, it will interfere with apt Azure CLI's installation:

sudo apt install azure-cli
pip3 install azure-mgmt-resource
$ /opt/az/bin/python3 -m pip list -v
Package                                 Version   Location                                        Installer
--------------------------------------- --------- ----------------------------------------------- ---------
adal                                    1.2.7     /opt/az/lib/python3.10/site-packages            pip
antlr4-python3-runtime                  4.9.3     /opt/az/lib/python3.10/site-packages
applicationinsights                     0.11.9    /opt/az/lib/python3.10/site-packages            pip
argcomplete                             1.11.1    /opt/az/lib/python3.10/site-packages            pip
asn1crypto                              0.24.0    /opt/az/lib/python3.10/site-packages            pip
azure-appconfiguration                  1.1.1     /opt/az/lib/python3.10/site-packages            pip
azure-batch                             12.0.0    /opt/az/lib/python3.10/site-packages            pip
azure-cli                               2.38.0    /opt/az/lib/python3.10/site-packages
azure-cli-core                          2.38.0    /opt/az/lib/python3.10/site-packages
azure-cli-telemetry                     1.0.6     /opt/az/lib/python3.10/site-packages
azure-common                            1.1.28    /home/user2/.local/lib/python3.10/site-packages pip
azure-core                              1.24.2    /home/user2/.local/lib/python3.10/site-packages pip
...

We recommend installing with only one method - either apt or pip. If you have to install twice with 2 tools, you may install Azure CLI with pip in a virtual environment. You may see #20476 (comment) for detailed instruction.

@RakeshMohanMSFT RakeshMohanMSFT added needs-author-feedback More information is needed from author to address the issue. and removed needs-team-attention This issue needs attention from Azure service team or SDK team labels Jul 20, 2022
@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label Jul 27, 2022
@ghost
Copy link

ghost commented Jul 27, 2022

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@ghost ghost closed this as completed Aug 14, 2022
@RakeshMohanMSFT RakeshMohanMSFT added the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Oct 21, 2022
@ghost ghost removed the no-recent-activity There has been no recent activity on this issue. label Oct 21, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team. needs-author-feedback More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage az storage
Projects
None yet
Development

No branches or pull requests

6 participants
@jiasli @evelyn-ys @GavBurke @RakeshMohanMSFT @yonzhan and others