Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions src/workload-orchestration/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============
5.1.1
++++++
* Resolved solution template name to uniqueIdentifier for ``az workload-orchestration target solution-revision-list`` and ``az workload-orchestration target solution-instance-list``
Copy link
Member

Choose a reason for hiding this comment

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

can you run these CLI cmds locally and attach results that they are working e2e

* Added shared ``_target_helper.py`` for reusable solution template resolution logic

5.1.0
++++++
* Added new target solution management command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# flake8: noqa

from azure.cli.core.aaz import *
from ._target_helper import TargetHelper


@register_command(
Expand Down Expand Up @@ -89,6 +90,14 @@ class SolutionInstancesList(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
# Resolve solution template name to its uniqueIdentifier
self.unique_identifier = TargetHelper.get_solution_template_unique_identifier(
self.ctx.subscription_id,
self.ctx.args.resource_group,
self.ctx.args.solution_name,
self.client
)

request = self.make_request()
Comment on lines 92 to 101
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The new behavior adds an extra management-plane GET to resolve the solution template uniqueIdentifier before listing instances, but there’s no scenario coverage for this command path in the extension tests. Adding/adjusting a scenario test to exercise workload-orchestration target solution-instance-list (including the extra solutionTemplates GET) would help prevent regressions.

Copilot uses AI. Check for mistakes.
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
Expand Down Expand Up @@ -127,7 +136,7 @@ def url_parameters(self):
required=True,
),
**self.serialize_url_param(
"solutionName", self.ctx.args.solution_name,
"solutionName", self.unique_identifier,
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# flake8: noqa

from azure.cli.core.aaz import *
from ._target_helper import TargetHelper


@register_command(
Expand Down Expand Up @@ -92,6 +93,14 @@ class TargetSolutionRevisionsList(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
# Resolve solution template name to its uniqueIdentifier
self.unique_identifier = TargetHelper.get_solution_template_unique_identifier(
self.ctx.subscription_id,
self.ctx.args.resource_group,
self.ctx.args.solution_name,
self.client
)

request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
Comment on lines 95 to 105
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The new behavior adds an extra management-plane GET to resolve the solution template uniqueIdentifier before listing revisions, but there’s no scenario coverage for this command path in the extension tests. Adding/adjusting a scenario test to exercise workload-orchestration target solution-revision-list (including the extra solutionTemplates GET) would help prevent regressions.

Copilot uses AI. Check for mistakes.
if session.http_response.status_code in [200]:
Expand Down Expand Up @@ -122,7 +131,7 @@ def url_parameters(self):
required=True,
),
**self.serialize_url_param(
"solutionName", self.ctx.args.solution_name,
"solutionName", self.unique_identifier,
required=True,
),
**self.serialize_url_param(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Code generated by aaz-dev-tools. DO NOT EDIT.

# pylint: skip-file
# flake8: noqa


class TargetHelper:
"""Shared helper for target commands."""

@staticmethod
def get_solution_template_unique_identifier(subscription_id, resource_group_name, template_name, client):
"""Fetch the solution template and return its uniqueIdentifier from properties.

Args:
subscription_id: The subscription ID
resource_group_name: The resource group name
template_name: The solution template name
client: HTTP client for making the request

Returns:
str: The uniqueIdentifier from template properties, or template_name as fallback

Raises:
CLIInternalError: If the template does not exist or the request fails
"""
from azure.cli.core.azclierror import CLIInternalError
import json

template_url = client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/solutionTemplates/{solutionTemplateName}",
subscriptionId=subscription_id,
resourceGroupName=resource_group_name,
solutionTemplateName=template_name
)
request = client._request("GET", template_url, {
"api-version": "2025-08-01"
}, {
"Accept": "application/json"
}, None, {}, None)

try:
response = client.send_request(request=request, stream=False)

if response.http_response.status_code == 404:
raise CLIInternalError(
f"Solution template '{template_name}' not found in resource group '{resource_group_name}'."
)
if response.http_response.status_code != 200:
raise CLIInternalError(
f"Failed to get solution template '{template_name}': HTTP {response.http_response.status_code}"
)

data = json.loads(response.http_response.text())
unique_identifier = data.get("properties", {}).get("uniqueIdentifier")

if unique_identifier and unique_identifier.strip():
return unique_identifier
return template_name
except CLIInternalError:
# Propagate explicitly raised CLIInternalError instances unchanged.
raise
except Exception as exc:
# Wrap unexpected errors (e.g., network issues, JSON parsing failures)
# in CLIInternalError to match the documented behavior.
raise CLIInternalError(
f"Failed to get solution template '{template_name}': {exc}"
) from exc
2 changes: 1 addition & 1 deletion src/workload-orchestration/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


# HISTORY.rst entry.
VERSION = '5.1.0'
VERSION = '5.1.1'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading