Skip to content

Commit

Permalink
Fix VNFD build (Azure#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnycarter authored Jul 5, 2023
1 parent 09f6a45 commit 21154ff
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/aosm/azext_aosm/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ def __post_init__(self):
self.arm_template = ArtifactConfig(**self.arm_template)

if isinstance(self.vhd, dict):
self.vhd["file_path"] = self.path_from_cli_dir(self.vhd["file_path"])
if self.vhd.get("file_path"):
self.vhd["file_path"] = self.path_from_cli_dir(self.vhd["file_path"])
self.vhd = ArtifactConfig(**self.vhd)
self.validate()

Expand Down
18 changes: 18 additions & 0 deletions src/aosm/azext_aosm/tests/latest/mock_vnf/input_with_sas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"publisher_name": "jamie-mobile-publisher",
"publisher_resource_group_name": "Jamie-publisher",
"nf_name": "ubuntu-vm",
"version": "1.0.0",
"acr_artifact_store_name": "ubuntu-acr",
"location": "eastus",
"blob_artifact_store_name": "ubuntu-blob-store",
"image_name_parameter": "imageName",
"arm_template": {
"file_path": "ubuntu-template.json",
"version": "1.0.0"
},
"vhd": {
"blob_sas_url": "https://a/dummy/sas-url",
"version": "1-0-0"
}
}
13 changes: 11 additions & 2 deletions src/aosm/azext_aosm/tests/latest/test_vnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ def test_build(self):
os.chdir(test_dir)

try:
build_definition("vnf", str(mock_vnf_folder / "input.json"))
build_definition("vnf", str(mock_vnf_folder / "input_with_fp.json"))
assert os.path.exists("nfd-bicep-ubuntu-template")
finally:
os.chdir(starting_directory)

with TemporaryDirectory() as test_dir:
os.chdir(test_dir)

try:
build_definition("vnf", str(mock_vnf_folder / "input_with_sas.json"))
assert os.path.exists("nfd-bicep-ubuntu-template")
finally:
os.chdir(starting_directory)
Expand All @@ -53,7 +62,7 @@ def test_build_with_ordered_params(self):
try:
build_definition(
"vnf",
str(mock_vnf_folder / "input.json"),
str(mock_vnf_folder / "input_with_fp.json"),
order_params=True,
)
assert os.path.exists("nfd-bicep-ubuntu-template")
Expand Down

0 comments on commit 21154ff

Please sign in to comment.