Skip to content

Commit a8bfa6b

Browse files
authored
Merge pull request #159 from release-engineering/fix_azure_modular_push
Azure: Fix modular push
2 parents 6277899 + 82400ba commit a8bfa6b

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

cloudpub/models/ms_azure.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,11 +711,21 @@ class ProductProperty(AzureProductLinkedResource):
711711
`Schema definition for ProductProperty <https://schema.mp.microsoft.com/schema/property/2022-03-01-preview2>`_
712712
""" # noqa E501
713713

714+
schema: str = field(
715+
validator=instance_of(str),
716+
metadata={
717+
"alias": MS_SCHEMA,
718+
"const": "https://schema.mp.microsoft.com/schema/property/2022-03-01-preview2",
719+
},
720+
)
721+
"""
722+
The `resource schema`_ for Graph API."""
723+
714724
kind: str
715725
"""Expected to be ``azureVM``"""
716726

717727
terms_of_use: Optional[str] = field(
718-
validator=optional(instance_of(str)), metadata={"alias": "termsOfUse"}
728+
validator=optional(instance_of(str)), metadata={"alias": "termsOfUseUrl"}
719729
)
720730
"""The product terms of use."""
721731

cloudpub/ms_azure/service.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,13 @@ def get_modular_resources_to_publish(
563563
# The following resources shouldn't be required:
564564
# -> customer-leads
565565
# -> test-drive
566-
# -> property
567566
# -> *listing*
568567
# -> reseller
569568
# -> price-and-availability-*
570569
# NOTE: The "submission" resource will be already added by the "submit_to_status" method
571570
#
572-
# With that it needs only the related "product" and "plan" resources alongisde the
573-
# updated tech_config
571+
# With that it needs only the related "product", "property" and "plan" resources alongisde
572+
# the updated tech_config
574573
product_id = tech_config.product_id
575574
plan_id = tech_config.plan_id
576575
prod_res = cast(
@@ -581,6 +580,14 @@ def get_modular_resources_to_publish(
581580
if prd.id == product_id
582581
],
583582
)[0]
583+
property = cast(
584+
List[ProductProperty],
585+
[
586+
prop
587+
for prop in self.filter_product_resources(product=product, resource="property")
588+
if prop.product_id == product_id # type: ignore [union-attr]
589+
],
590+
)[0]
584591
plan_res = cast(
585592
List[PlanSummary],
586593
[
@@ -589,7 +596,7 @@ def get_modular_resources_to_publish(
589596
if pln.id == plan_id
590597
],
591598
)[0]
592-
return [prod_res, plan_res, tech_config]
599+
return [prod_res, property, plan_res, tech_config]
593600

594601
def compute_targets(self, product_id: str) -> List[str]:
595602
"""List all the possible publishing targets order to seek data from Azure.

tests/ms_azure/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ def plan_summary() -> Dict[str, Any]:
220220
@pytest.fixture
221221
def product_property() -> Dict[str, Any]:
222222
return {
223-
"$schema": "https://product-ingestion.azureedge.net/schema/property/2022-03-01-preview3",
223+
"$schema": "https://schema.mp.microsoft.com/schema/property/2022-03-01-preview2",
224224
"id": "property/ffffffff-ffff-ffff-ffff-ffffffffffff/public/main",
225225
"product": "product/ffffffff-ffff-ffff-ffff-ffffffffffff",
226226
"kind": "azureVM",
227-
"termsOfUse": "test",
227+
"termsOfUseUrl": "test",
228228
"termsConditions": "custom",
229229
"categories": {"compute": ["operating-systems"]},
230230
}

tests/ms_azure/test_service.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,7 @@ def test_publish_live_modular_push(
19061906
submission: Dict[str, Any],
19071907
product_summary_obj: ProductSummary,
19081908
plan_summary_obj: PlanSummary,
1909+
product_property_obj: ProductProperty,
19091910
metadata_azure_obj: mock.MagicMock,
19101911
gen2_image: Dict[str, Any],
19111912
caplog: pytest.LogCaptureFixture,
@@ -1947,6 +1948,7 @@ def test_publish_live_modular_push(
19471948
expected_tc = VMIPlanTechConfig.from_json(new_tc)
19481949
expected_modular_resources = [
19491950
product_summary_obj,
1951+
product_property_obj,
19501952
plan_summary_obj,
19511953
expected_tc,
19521954
ProductSubmission.from_json(submission_preview),

0 commit comments

Comments
 (0)