Skip to content

Commit

Permalink
Merge pull request Azure#11 from jddarby/jl/tidy-up
Browse files Browse the repository at this point in the history
Jl/tidy up
  • Loading branch information
jordlay authored May 23, 2023
2 parents 3c52481 + aa0b061 commit c988938
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 123 deletions.
12 changes: 8 additions & 4 deletions src/aosm/azext_aosm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# --------------------------------------------------------------------------------------------

import json
import os
from dataclasses import asdict
from typing import Optional
from knack.log import get_logger
Expand All @@ -21,6 +22,7 @@
get_configuration,
NFConfiguration,
)
from azure.cli.core.azclierror import InvalidTemplateError, CLIInternalError


logger = get_logger(__name__)
Expand Down Expand Up @@ -104,13 +106,15 @@ def _generate_nfd(definition_type, config):
elif definition_type == CNF:
nfd_generator = CnfNfdGenerator(config)
else:
from azure.cli.core.azclierror import CLIInternalError

raise CLIInternalError(
"Generate NFD called for unrecognised definition_type. Only VNF and CNF have been implemented."
)

nfd_generator.generate_nfd()
if nfd_generator.bicep_path:
raise InvalidTemplateError(
f"ERROR: Using the existing NFD bicep template {nfd_generator.bicep_path}.\nTo generate a new NFD, delete the folder {os.path.dirname(nfd_generator.bicep_path)} and re-run this command."
)
else:
nfd_generator.generate_nfd()


def publish_definition(
Expand Down
Loading

0 comments on commit c988938

Please sign in to comment.