-
Notifications
You must be signed in to change notification settings - Fork 3.4k
rpm missing requirement on cffi package #13892
Description
Describe the bug
To Reproduce
Install azure-cli-2.7.0-1.el7.x86_64.rpm and the jq rpm in a fedora 32 container. Try to execute the following steps to create a storage container:
# log in
az login
az_region="eastus2"
az_resource_group="foo-20200608"
az_storage_account="foostorage20200608"
az_container="foo-storage-container-20200608"
# Create resource group
az group create -l "${az_region}" -n "${az_resource_group}"
# Create storage account for uploading FCOS image
az storage account create -g "${az_resource_group}" -n "${az_storage_account}"
# Retrieve connection string for storage account
cs=$(az storage account show-connection-string -n "${az_storage_account}" | jq -r .connectionString)
# Create storage container for uploading FCOS image
az storage container create --connection-string "${cs}" -n "${az_container}"
It fails with:
The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute '__name__'
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute
raise ex
File "/usr/lib64/az/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/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 709, in _run_job
cmd_copy.exception_handler(ex)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 257, in new_handler
raise ex
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
result = cmd_copy(params)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__
return self.handler(*args, **kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 545, in default_command_handler
return op(**command_args)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 40, in create_container
client = blob_data_service_factory(cmd.cli_ctx, kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_client_factory.py", line 80, in blob_data_service_factory
return generic_data_service_factory(cli_ctx, blob_service, kwargs.pop('account_name', None),
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_client_factory.py", line 36, in generic_data_service_factory
return get_storage_data_service_client(cli_ctx, service, name, key, connection_string, sas_token,
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_client_factory.py", line 27, in get_storage_data_service_client
return get_data_service_client(cli_ctx, service, name, key, connection_string, sas_token,
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/client_factory.py", line 178, in get_data_service_client
logger.debug('Getting data service client service_type=%s', service_type.__name__)
AttributeError: 'NoneType' object has no attribute '__name__'
This happens because some modules are dynamically loaded and if their deps aren't met
they silently fail. If I change these lines to add checked=False then I see:
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/sdkutil.py", line 35, in get_blob_service_by_type
print(get_sdk(cli_ctx, ResourceType.DATA_STORAGE, 'BlockBlobService', mod='blob', checked=False))
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/profiles/__init__.py", line 90, in get_sdk
return _sdk_get_versioned_sdk(cli_ctx.cloud.profile, resource_type, *attr_args, **kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/profiles/_shared.py", line 528, in get_versioned_sdk
loaded_obj = _get_attr(sdk_path, mod_attr_path, checked)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/profiles/_shared.py", line 492, in _get_attr
raise ex
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/profiles/_shared.py", line 483, in _get_attr
op = import_module(full_mod_path)
File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/__init__.py", line 6, in <module>
from .appendblobservice import AppendBlobService
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/appendblobservice.py", line 30, in <module>
from ._deserialization import (
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/_deserialization.py", line 41, in <module>
from ._encryption import _decrypt_blob
File "/usr/lib64/az/lib/python3.6/site-packages/azure/multiapi/storage/v2018_11_09/blob/_encryption.py", line 13, in <module>
from cryptography.hazmat.primitives.padding import PKCS7
File "/usr/lib64/az/lib/python3.6/site-packages/cryptography/hazmat/primitives/padding.py", line 13, in <module>
from cryptography.hazmat.bindings._padding import lib
ModuleNotFoundError: No module named '_cffi_backend'
A sudo dnf install python3-cffi fixes the problem. I think we should add the python3-cffi rpm to our list of deps for the rpm and also maybe we should detect this error for dynamically loaded modules better in the future (should we make checked=False the default)?
Also is there anyone who would want to submit azure-cli for inclusion in Fedora by default? I can help mentor someone if they would like to do that. It would make it much easier for new users to get started with the CLI.
Expected behavior
No errors.
Environment summary
RPM