Skip to content

Commit

Permalink
dedup input identities
Browse files Browse the repository at this point in the history
  • Loading branch information
shenmuxiaosen committed Jan 9, 2020
1 parent a764e67 commit b0bf46d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def validate_filter_parameter(string):
def validate_assigned_identity(namespace):
if namespace.assign_identity:
from msrestazure.tools import is_valid_resource_id

namespace.assign_identity = set(namespace.assign_identity)
for identity in namespace.assign_identity:
if identity != '[system]' and not is_valid_resource_id(identity):
raise CLIError("Invalid identity '{}'. Use '[system]' to refer system assigned identity, or a resource id to refer user assigned identity.".format(identity))
Expand All @@ -160,6 +162,8 @@ def validate_assigned_identity(namespace):
def validate_identities(namespace):
if namespace.identities:
from msrestazure.tools import is_valid_resource_id

namespace.identities = set(namespace.identities)
for identity in namespace.identities:
if identity != '[system]' and identity != '[all]' and not is_valid_resource_id(identity):
raise CLIError("Invalid identity '{}'. Use '[system]' to refer system assigned identity '[all]' for all identities, or a resource id to refer user assigned identity.".format(identity))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def remove_managed_identity(cmd, client, name, resource_group_name=None, identit
def show_managed_identity(cmd, client, name, resource_group_name=None):
config_store = show_configstore(cmd, client, name, resource_group_name)

return config_store.identity
return config_store.identity if config_store.identity else {}


def list_credential(cmd, client, name, resource_group_name=None):
Expand Down

0 comments on commit b0bf46d

Please sign in to comment.