Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SCVMM] Public Preview refresh using New Resource Model #6708

Merged
merged 19 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Bug fix for get-resource-id
  • Loading branch information
nascarsayan committed Aug 30, 2023
commit 342b6de99beedd6ee0cdca4d91f033383b47aadb
13 changes: 7 additions & 6 deletions src/scvmm/azext_scvmm/scvmm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from typing import Optional
from typing import Dict, Optional, Set
from azure.cli.core.azclierror import InvalidArgumentValueError, CLIInternalError
from azure.cli.core.commands.client_factory import get_subscription_id
from msrestazure.tools import is_valid_resource_id, parse_resource_id, resource_id
Expand Down Expand Up @@ -68,7 +68,7 @@ def get_resource_id(
}

def process_resource_name(
rid_parts: dict[str, str],
rid_parts: Dict[str, str],
resource_name_key: str,
resource_name: Optional[str],
):
Expand All @@ -90,7 +90,7 @@ def process_resource_name(
for key in child_rid_parts_keys:
if key in selected_keys:
continue
if any([key.startswith(prefix) for prefix in selected_key_prefixes]):
if any(key.startswith(prefix) for prefix in selected_key_prefixes):
continue
child_rid_parts.pop(key)
child_set = {
Expand All @@ -105,13 +105,12 @@ def process_resource_name(
)
rid_parts.update(child_rid_parts)

rid_parts: dict[str, str] = {}
rid_parts: Dict[str, str] = {}
rid_parts.update(
resource_group=resource_group,
namespace=namespace,
type=_type,
)
null_keys: set[str] = set()
null_keys: Set[str] = set()
if name is not None:
process_resource_name(rid_parts, "name", name)
else:
Expand Down Expand Up @@ -175,6 +174,8 @@ def process_resource_name(

if "subscription" not in rid_parts:
rid_parts["subscription"] = get_subscription_id(cmd.cli_ctx)
if "resource_group" not in rid_parts:
rid_parts["resource_group"] = resource_group

return resource_id(**rid_parts)

Expand Down