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

check if resource types used in the VNF ARM template are valid #186

Merged
merged 4 commits into from
May 1, 2024

Conversation

priyavj08
Copy link
Collaborator

@priyavj08 priyavj08 commented May 1, 2024


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
image
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

tested with invalid resource type in arm template by running "az aosm nfd build --definition-type vnf-nexus --config-file /home/priyavij/testbug/input.jsonc"

image

@jordlay jordlay changed the base branch from main to 2.0.0b2-release May 1, 2024 15:03
for resource_type in arm_resource_types:
resource_type_prefix = resource_type.split('/')[0] if '/' in resource_type else resource_type
if resource_type_prefix not in VALID_VNF_TEMPLATE_RESOURCE_TYPES:
raise InvalidARMResourceType(
Copy link
Collaborator

@jordlay jordlay May 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you raise a CLI error isntead, you won't get the trace printed to the user. I just tested it with InvalidTemplateError but there may be a better one. To use these errirs import like this:

from azure.cli.core.azclierror import InvalidTemplateError

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, the errors available for use in the CLI are all declared here:
https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/azclierror.py

(Or of course you can click through to the azure.cli.core.azclierror module in VS Code to find them too.)

@jordlay
Copy link
Collaborator

jordlay commented May 1, 2024

Looks good to me. One comment on the error

@priyavj08 priyavj08 merged commit 5d7589e into 2.0.0b2-release May 1, 2024
@priyavj08 priyavj08 deleted the priyavij/checkforvalidRT branch May 1, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants