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 ts commands failing #17890

Closed
JavierPalaciosNexplore opened this issue Apr 27, 2021 · 12 comments
Closed

az ts commands failing #17890

JavierPalaciosNexplore opened this issue Apr 27, 2021 · 12 comments
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Service Attention This issue is responsible by Azure service team.

Comments

@JavierPalaciosNexplore
Copy link

Describe the bug

Some commands from az ts familiy are failing for newly created/edited templates.

We initially discovered by a failure like

$ TPL_ID=$( az ts show -n aks-cluster -g global --query id -o tsv  --version 0.1.2.1 )
WARNING: Command group 'ts' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
$ az deployment group create --resource-group minerva --template-spec ${TPL_ID} --parameters clusterName=clustest001
Argument '--template-spec' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
'template'

and tracing the problem I discovered a more verbose error running a similar az ts export --output-folder output -n aks-cluster --version 0.1.2.1 -g global command, which gives a python traceback (I've lost the first one, but I remember it already mentioned template, not like the current one)

Deploying the same template from web portal did work. Upgrading az-cli makes no change, and tracebacks below are from fresh upgrade to 2.22.1 (rpm based).
Upgrading using the portal a template with working export makes it to become unexportable.

The create command worked around three weeks ago, although I'm not sure about the last modification time of the template spec I was using at that moment.

Command Name
az ts export

Errors:

'NoneType' object is not iterable
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 231, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 657, in execute
    raise ex
cli/core/commands/__init__.py, ln 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
...
    result = cmd_copy(params)
cli/core/commands/__init__.py, ln 328, in __call__
    return self.handler(*args, **kwargs)
azure/cli/core/__init__.py, ln 807, in default_command_handler
    return op(**command_args)
cli/command_modules/resource/custom.py, ln 1963, in export_template_spec
    return unpack(cmd, exported_template, output_folder, (str(name) + '.JSON'))
cli/command_modules/resource/_packing_engine.py, ln 195, in unpack
    for artifact in getattr(packaged_template, 'Artifacts'):
TypeError: 'NoneType' object is not iterable

To Reproduce:

  • az ts export --output-folder {} -n {} --version {} -g {}

Expected Behavior

Environment Summary

Linux-3.10.23-xxxx-std-ipv6-64-x86_64-with-centos-7.8.2003-Core
Python 3.6.8
Installer: RPM

azure-cli 2.22.1

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 27, 2021
@JavierPalaciosNexplore
Copy link
Author

@hvithlani

@yonzhan yonzhan added the ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group label Apr 27, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 27, 2021
@yonzhan yonzhan added needs-triage This is a new issue that needs to be triaged to the appropriate team. Service Attention This issue is responsible by Azure service team. labels Apr 27, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 27, 2021
@ghost
Copy link

ghost commented Apr 27, 2021

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

Issue Details

Describe the bug

Some commands from az ts familiy are failing for newly created/edited templates.

We initially discovered by a failure like

$ TPL_ID=$( az ts show -n aks-cluster -g global --query id -o tsv  --version 0.1.2.1 )
WARNING: Command group 'ts' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
$ az deployment group create --resource-group minerva --template-spec ${TPL_ID} --parameters clusterName=clustest001
Argument '--template-spec' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
'template'

and tracing the problem I discovered a more verbose error running a similar az ts export --output-folder output -n aks-cluster --version 0.1.2.1 -g global command, which gives a python traceback (I've lost the first one, but I remember it already mentioned template, not like the current one)

Deploying the same template from web portal did work. Upgrading az-cli makes no change, and tracebacks below are from fresh upgrade to 2.22.1 (rpm based).
Upgrading using the portal a template with working export makes it to become unexportable.

The create command worked around three weeks ago, although I'm not sure about the last modification time of the template spec I was using at that moment.

Command Name
az ts export

Errors:

'NoneType' object is not iterable
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 231, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 657, in execute
    raise ex
cli/core/commands/__init__.py, ln 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
...
    result = cmd_copy(params)
cli/core/commands/__init__.py, ln 328, in __call__
    return self.handler(*args, **kwargs)
azure/cli/core/__init__.py, ln 807, in default_command_handler
    return op(**command_args)
cli/command_modules/resource/custom.py, ln 1963, in export_template_spec
    return unpack(cmd, exported_template, output_folder, (str(name) + '.JSON'))
cli/command_modules/resource/_packing_engine.py, ln 195, in unpack
    for artifact in getattr(packaged_template, 'Artifacts'):
TypeError: 'NoneType' object is not iterable

To Reproduce:

  • az ts export --output-folder {} -n {} --version {} -g {}

Expected Behavior

Environment Summary

Linux-3.10.23-xxxx-std-ipv6-64-x86_64-with-centos-7.8.2003-Core
Python 3.6.8
Installer: RPM

azure-cli 2.22.1

Author: JavierPalaciosNexplore
Assignees: -
Labels:

ARM, Service Attention, needs-triage, question

Milestone: -

@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 Apr 27, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 27, 2021

route to service team

@fabrycy
Copy link

fabrycy commented Apr 28, 2021

Hi,
I'm facing similar problem but with deploying template specs with command az deployment group create ....
What I found is that that azure-cli is calling template specs api with api-version=2021-03-01-preview and response is following:

msrest.http_logger: {
  "location": "westeurope",
  "systemData": {
...
  },
  "properties": {
    "mainTemplate": {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
...

According to API documentation https://docs.microsoft.com/en-us/rest/api/resources/templatespecversions/get#templatespecversion response should have properties.template object not properties.mainTemplate.

Michal

@arsenvlad
Copy link

I am seeing the same issue with latest version of Azure CLI 2.22.1... It appears that Azure CLI is using latest API version 2021-03-01-preview which changed properties.template to properties.mainTemplate as can be see from screenshots below.

image

image

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 30, 2021

ARM service team could take a look at this issue

@arsenvlad
Copy link

I think there is also this related issue #17733

@usrme
Copy link

usrme commented May 1, 2021

Seems to also be a duplicate of this: #17759.

@detienne20
Copy link
Contributor

@JavierPalaciosNexplore Thank you for your patience, the fix for deploying a template spec version should be released after 05/06. I am unable to reproduce the az ts export error. Can you please explain in more detail how you ran in to the "'NoneType' object is not iterable" error using this command? i.e. Does this fail for all of your template specs or only one? Does your template spec contain artifacts?

@JavierPalaciosNexplore
Copy link
Author

Although I expect this to get solved after #17896, This is the complete sequence:

javier@JaviP:~/Repos/e2ep-bcqd/e2ep-bcqd-docs$ az ts show -n aks-cluster -g global --query id -o tsv  --version 0.1.2.1
Command group 'ts' is in preview. It may be changed/removed in a future release.
/subscriptions/8e30d682-f71e-4992-8b17-dfdb28e4f4c7/resourceGroups/global/providers/Microsoft.Resources/templateSpecs/aks-cluster/versions/0.1.2.1
javier@JaviP:~/Repos/e2ep-bcqd/e2ep-bcqd-docs$ mkdir test
javier@JaviP:~/Repos/e2ep-bcqd/e2ep-bcqd-docs$ az ts export -g global -s /subscriptions/8e30d682-f71e-4992-8b17-dfdb28e4f4c7/resourceGroups/global/providers/Microsoft.Resources/templateSpecs/aks-cluster/versions/0.1.2.1 --output-folder test
Argument '--template-spec' is in preview. It may be changed/removed in a future release.
Command group 'ts' is in preview. It may be changed/removed in a future release.
CLIInternalError: 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 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 659, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 722, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 715, in _run_job
    six.reraise(*sys.exc_info())
  File "/opt/az/lib/python3.6/site-packages/six.py", line 703, in reraise
    raise value
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 693, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 330, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 784, in default_command_handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/resource/custom.py", line 1908, in export_template_spec
    return unpack(cmd, exported_template, output_folder, (str(name) + '.JSON'))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/resource/_packing_engine.py", line 195, in unpack
    for artifact in getattr(packaged_template, 'Artifacts'):
TypeError: 'NoneType' object is not iterable
To open an issue, please run: 'az feedback'

@detienne20
Copy link
Contributor

@JavierPalaciosNexplore Please try upgrade to Azure CLI 2.23.0. The latest version was released today. Are you still seeing this error?

@JavierPalaciosNexplore
Copy link
Author

Yes, everything is working again with the new CLI release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

6 participants