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

[Quantum] Remove msrestazure dependency #8145

Merged
merged 2 commits into from
Oct 16, 2024
Merged
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
26 changes: 0 additions & 26 deletions src/quantum/azext_quantum/operations/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from azure.cli.core.azclierror import (InvalidArgumentValueError, AzureInternalError,
RequiredArgumentMissingError, ResourceNotFoundError)

from msrestazure.azure_exceptions import CloudError
from .._client_factory import cf_workspaces, cf_quotas, cf_workspace, cf_offerings, _get_data_credentials
from ..vendored_sdks.azure_mgmt_quantum.models import QuantumWorkspace
from ..vendored_sdks.azure_mgmt_quantum.models import QuantumWorkspaceIdentity
Expand Down Expand Up @@ -176,31 +175,6 @@ def _add_quantum_providers(cmd, workspace, providers, auto_accept, skip_autoadd)
workspace.providers.append(p)


def _create_role_assignment(cmd, quantum_workspace):
from azure.cli.command_modules.role.custom import create_role_assignment
retry_attempts = 0
while retry_attempts < MAX_RETRIES_ROLE_ASSIGNMENT:
try:
create_role_assignment(cmd, role="Contributor", scope=quantum_workspace.storage_account, assignee=quantum_workspace.identity.principal_id)
break
except (CloudError, AzureInternalError) as e:
error = str(e.args).lower()
if (("does not exist" in error) or ("cannot find" in error)):
print('.', end='', flush=True)
time.sleep(POLLING_TIME_DURATION)
retry_attempts += 1
continue
raise e
except Exception as x:
raise AzureInternalError(f"Role assignment encountered exception ({type(x).__name__}): {x}") from x
if retry_attempts > 0:
print() # To end the line of the waiting indicators.
if retry_attempts == MAX_RETRIES_ROLE_ASSIGNMENT:
max_time_in_seconds = MAX_RETRIES_ROLE_ASSIGNMENT * POLLING_TIME_DURATION
raise AzureInternalError(f"Role assignment could not be added to storage account {quantum_workspace.storage_account} within {max_time_in_seconds} seconds.")
return quantum_workspace


def _validate_storage_account(tier_or_kind_msg_text, tier_or_kind, supported_tiers_or_kinds):
if tier_or_kind not in supported_tiers_or_kinds:
tier_or_kind_list = ', '.join(supported_tiers_or_kinds)
Expand Down
Loading