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

disallow refresh_cluster_credentials with platowrm_workload_identities #3870

Merged
merged 6 commits into from
Oct 9, 2024
Merged
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
2 changes: 2 additions & 0 deletions python/az/aro/azext_aro/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ def validate_refresh_cluster_credentials(namespace):
return
if namespace.client_secret is not None or namespace.client_id is not None:
raise RequiredArgumentMissingError('--client-id and --client-secret must be not set with --refresh-credentials.') # pylint: disable=line-too-long
if namespace.platform_workload_identities is not None:
raise MutuallyExclusiveArgumentError('--platform-workload-identities must be not set with --refresh-credentials.') # pylint: disable=line-too-long
if namespace.upgradeable_to is not None:
raise MutuallyExclusiveArgumentError('Must not specify --refresh-credentials when --upgradeable-to is used.') # pylint: disable=line-too-long

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,14 @@ def test_validate_worker_vm_disk_size_gb(test_description, namespace, expected_e
Mock(client_id="client_id_456"),
RequiredArgumentMissingError
),
(
"should raise MutuallyExclusiveArgumentError Exception because namespace.platform_workload_identities is present",
Mock(platform_workload_identities=[Mock(resource_id='Foo')], client_id=None, client_secret=None),
MutuallyExclusiveArgumentError
),
(
"should not raise any Exception because namespace.client_secret is None and namespace.client_id is None",
Mock(upgradeable_to=None, client_secret=None, client_id=None),
Mock(upgradeable_to=None, client_secret=None, client_id=None, platform_workload_identities=None),
None
),
(
Expand Down
Loading