Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cloudpub/models/ms_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,21 @@ class ProductProperty(AzureProductLinkedResource):
`Schema definition for ProductProperty <https://schema.mp.microsoft.com/schema/property/2022-03-01-preview2>`_
""" # noqa E501

schema: str = field(
validator=instance_of(str),
metadata={
"alias": MS_SCHEMA,
"const": "https://schema.mp.microsoft.com/schema/property/2022-03-01-preview2",
},
)
"""
The `resource schema`_ for Graph API."""

kind: str
"""Expected to be ``azureVM``"""

terms_of_use: Optional[str] = field(
validator=optional(instance_of(str)), metadata={"alias": "termsOfUse"}
validator=optional(instance_of(str)), metadata={"alias": "termsOfUseUrl"}
)
"""The product terms of use."""

Expand Down
15 changes: 11 additions & 4 deletions cloudpub/ms_azure/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,14 +563,13 @@ def get_modular_resources_to_publish(
# The following resources shouldn't be required:
# -> customer-leads
# -> test-drive
# -> property
# -> *listing*
# -> reseller
# -> price-and-availability-*
# NOTE: The "submission" resource will be already added by the "submit_to_status" method
#
# With that it needs only the related "product" and "plan" resources alongisde the
# updated tech_config
# With that it needs only the related "product", "property" and "plan" resources alongisde
# the updated tech_config
product_id = tech_config.product_id
plan_id = tech_config.plan_id
prod_res = cast(
Expand All @@ -581,6 +580,14 @@ def get_modular_resources_to_publish(
if prd.id == product_id
],
)[0]
property = cast(
List[ProductProperty],
[
prop
for prop in self.filter_product_resources(product=product, resource="property")
if prop.product_id == product_id
],
)[0]
plan_res = cast(
List[PlanSummary],
[
Expand All @@ -589,7 +596,7 @@ def get_modular_resources_to_publish(
if pln.id == plan_id
],
)[0]
return [prod_res, plan_res, tech_config]
return [prod_res, property, plan_res, tech_config]
Copy link
Collaborator

@lslebodn lslebodn Nov 26, 2025

Choose a reason for hiding this comment

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

a bit off-topic question.

Does azure API care about order of resources in the list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it doesn't. But I've added in this particular order because the property is a Product linked resource, not a plan linked one, so it would be less confusing in the code, I guess

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tech_config for example is a product and plan linked resource 🙂


def compute_targets(self, product_id: str) -> List[str]:
"""List all the possible publishing targets order to seek data from Azure.
Expand Down
4 changes: 2 additions & 2 deletions tests/ms_azure/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ def plan_summary() -> Dict[str, Any]:
@pytest.fixture
def product_property() -> Dict[str, Any]:
return {
"$schema": "https://product-ingestion.azureedge.net/schema/property/2022-03-01-preview3",
"$schema": "https://schema.mp.microsoft.com/schema/property/2022-03-01-preview2",
"id": "property/ffffffff-ffff-ffff-ffff-ffffffffffff/public/main",
"product": "product/ffffffff-ffff-ffff-ffff-ffffffffffff",
"kind": "azureVM",
"termsOfUse": "test",
"termsOfUseUrl": "test",
"termsConditions": "custom",
"categories": {"compute": ["operating-systems"]},
}
Expand Down
2 changes: 2 additions & 0 deletions tests/ms_azure/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ def test_publish_live_modular_push(
submission: Dict[str, Any],
product_summary_obj: ProductSummary,
plan_summary_obj: PlanSummary,
product_property_obj: ProductProperty,
metadata_azure_obj: mock.MagicMock,
gen2_image: Dict[str, Any],
caplog: pytest.LogCaptureFixture,
Expand Down Expand Up @@ -1947,6 +1948,7 @@ def test_publish_live_modular_push(
expected_tc = VMIPlanTechConfig.from_json(new_tc)
expected_modular_resources = [
product_summary_obj,
product_property_obj,
plan_summary_obj,
expected_tc,
ProductSubmission.from_json(submission_preview),
Expand Down
Loading