Azure / azure-cli

Azure Command-Line Interface
MIT License
3.91k stars 2.88k forks source link

Adding a workload profile to existing Container Apps Environment fails #28998

Open miceiken opened 1 month ago

miceiken commented 1 month ago

Describe the bug

Adding a workload profile to existing Container Apps Environment fails

Related command

az containerapp env workload-profile add \
  --name -snip- \
  --resource-group -snip- \
  --workload-profile-name consumption \
  --workload-profile-type Consumption \
  --min-nodes 1 \
  --max-nodes 5

Errors

The command failed with an unexpected error. Here is the traceback:
'NoneType' object is not iterable
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/containerapp/custom.py", line 4932, in add_workload_profile
    workload_profiles_lower = [p["name"].lower() for p in workload_profiles]
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable

Issue script & Debug output

unrecognized arguments:  --debug

😉

Expected behavior

A workload profile is created and added to the Container Apps Environment.

Environment Summary

azure-cli                         2.61.0

core                              2.61.0
telemetry                          1.1.0

Extensions:
arcdata                           1.5.13
azure-devops                       1.0.1
containerapp                      0.3.52
resource-graph                     2.1.0

Dependencies:
msal                              1.28.0
azure-mgmt-resource               23.1.1

Python location '/usr/local/Cellar/azure-cli/2.61.0/libexec/bin/python'
Extensions directory '/Users/michaeleikelandtt/.azure/cliextensions'

Python (Darwin) 3.11.9 (main, Apr  2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.3.9.4)]

Additional context

No response

azure-client-tools-bot-prd[bot] commented 1 month ago
Hi @miceiken Find similar issue https://github.com/Azure/azure-cli/issues/22235.
Issue title Storage commands failling on Fedora 35 when Python 3.6 is not present
Create time 2022-04-29
Comment number 7

Possible solution: It seems that the error message you are seeing is related to a missing package libpython3.6m.so.1.0()(64bit) which is not included in the RPM's requirement since 2.35.0. One workaround is to specify python36 in the RPM's requirement. Another workaround is to install Azure CLI using pip instead of RPM.

However, since Python 3.6 is now deprecated, the better solution is to build RPMs with the latest Fedora. You can use dnf command to query the package contents.


Please confirm if this resolves your issue.

yonzhan commented 1 month ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 1 month ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @calvinsID.

miceiken commented 1 month ago

Hi @miceiken Find similar issue #22235.

Issue title Storage commands failling on Fedora 35 when Python 3.6 is not present Create time 2022-04-29 Comment number 7 Possible solution: It seems that the error message you are seeing is related to a missing package libpython3.6m.so.1.0()(64bit) which is not included in the RPM's requirement since 2.35.0. One workaround is to specify python36 in the RPM's requirement. Another workaround is to install Azure CLI using pip instead of RPM.

However, since Python 3.6 is now deprecated, the better solution is to build RPMs with the latest Fedora. You can use dnf command to query the package contents.

Please confirm if this resolves your issue.

This does not seem related.

Greedygre commented 1 month ago

Hi @miceiken Thanks for reporting this issue, I will take a look.

May I ask what this the result when you execute this command: az containerapp env show -n {env-name} -g {rg} --query "properties.workloadProfiles"

Thanks

Greedygre commented 1 month ago

Hi @miceiken I have checked this error. This is due to your managed environment is not an environment that enable workload profiles. We don't support adding workload profiles for an environment that doesn't enable workload profiles. The existing environment which not enable workload profiles also not support change to enable.

You can create a new environment enable workload-profiles with following command: az containerapp env create -g {} -n {} --location {} --logs-destination none --enable-workload-profiles

I will create a PR to give a more friendly message for this issue.

Thanks