Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1787a46
remove some DATA_STORAGE usage
calvinhzy May 14, 2025
029c9a3
move `az storage blob incremental-copy start` to track2 sdk,
calvinhzy May 15, 2025
0981a7c
use codegen for `az storage blob incremental-copy start`, datetime te…
calvinhzy May 30, 2025
e56d3b9
Merge remote-tracking branch 'upstream/dev' into storage-azure-stack-…
calvinhzy May 30, 2025
d131d9c
fix merge conflict causing test failures , incremental copy start tes…
calvinhzy Jun 3, 2025
71f11e9
use dataplane error format
calvinhzy Jun 3, 2025
368ebc7
storage blob incremental-copy cancel moved to track2
calvinhzy Jun 3, 2025
96c3420
moving az storage remove and az storage blob sync to use track2 sdk, …
calvinhzy Jun 4, 2025
45d7447
remove checking for track2 vs track1, removing more outdated code
calvinhzy Jun 9, 2025
f221ab6
continue removing DATA_STORAGE
calvinhzy Jun 10, 2025
20ecf09
continue removing DATA_STORAGE
calvinhzy Jun 12, 2025
1efeee0
use track2 blob sdk for `az vm boot-diagnostics get-boot-log`
calvinhzy Jun 13, 2025
3181891
use track2 blob sdk for `az functionapp deployment source config-zip`
calvinhzy Jun 15, 2025
26eb476
fix minor errors and unused imports
calvinhzy Jun 15, 2025
b7fa46d
use track2 blob sdk for `az acr run`, `az acr build`, `az acr taskrun…
calvinhzy Jun 15, 2025
b393dab
fix style
calvinhzy Jun 16, 2025
f3c9e88
use storage dataplane track2 for `az batch application package create`
calvinhzy Jun 16, 2025
5a1776e
use storage dataplane track2 for `az batchai cluster create` and `az …
calvinhzy Jun 17, 2025
df0ac38
remove multiapi v1
calvinhzy Jun 17, 2025
3dd99b5
style
calvinhzy Jun 17, 2025
1733906
Merge remote-tracking branch 'upstream/dev' into storage-azure-stack-…
calvinhzy Jun 17, 2025
d24ecd0
style, lint
calvinhzy Jun 18, 2025
bec840b
update multiapi to 1.5.0 to remove track1 sdk and old api versions
calvinhzy Jun 18, 2025
f6e549c
Merge branch 'dev' into storage-azure-stack-cleanup
calvinhzy Jul 7, 2025
101a287
Merge remote-tracking branch 'upstream/dev' into storage-azure-stack-…
calvinhzy Jul 28, 2025
d9a8fe6
Merge remote-tracking branch 'upstream/dev' into storage-azure-stack-…
calvinhzy Aug 7, 2025
125a2be
add back missed param --lease-id
calvinhzy Aug 7, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from azure.cli.core import _debug
from azure.cli.core.auth.util import resource_to_scopes
from azure.cli.core.extension import EXTENSIONS_MOD_PREFIX
from azure.cli.core.profiles import ResourceType, CustomResourceType, get_api_version, get_sdk
from azure.cli.core.profiles import ResourceType, CustomResourceType, get_api_version
from azure.cli.core.profiles._shared import get_client_class, SDKProfile
from azure.cli.core.util import get_az_user_agent, is_track2
from knack.log import get_logger
Expand Down Expand Up @@ -275,8 +275,8 @@ def get_data_service_client(cli_ctx, service_type, account_name, account_key, co
if location_mode:
client.location_mode = location_mode
except ValueError as exc:
_ERROR_STORAGE_MISSING_INFO = get_sdk(cli_ctx, ResourceType.DATA_STORAGE,
'common._error#_ERROR_STORAGE_MISSING_INFO')
_ERROR_STORAGE_MISSING_INFO = ('You need to provide an account name and either an account_key or sas_token '
'when creating a storage service.')
if _ERROR_STORAGE_MISSING_INFO in str(exc):
raise ValueError(exc)
raise CLIError('Unable to obtain data client. Check your connection parameters.')
Expand Down
4 changes: 0 additions & 4 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
# can be provided with "ResourceType.XXX" to initialize the client object. This usually happens
# when related commands start to support Multi-API

DATA_COSMOS_TABLE = ('azure.multiapi.cosmosdb', None)
MGMT_ADVISOR = ('azure.mgmt.advisor', None)
MGMT_MEDIA = ('azure.mgmt.media', None)
MGMT_BACKUP = ('azure.mgmt.recoveryservicesbackup', None)
Expand All @@ -116,7 +115,6 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
MGMT_SQLVM = ('azure.mgmt.sqlvirtualmachine', None)
MGMT_MANAGEDSERVICES = ('azure.mgmt.managedservices', None)
MGMT_NETAPPFILES = ('azure.mgmt.netappfiles', None)
DATA_STORAGE = ('azure.multiapi.storage', None)
DATA_STORAGE_BLOB = ('azure.multiapi.storagev2.blob', None)
DATA_STORAGE_FILEDATALAKE = ('azure.multiapi.storagev2.filedatalake', None)
DATA_STORAGE_FILESHARE = ('azure.multiapi.storagev2.fileshare', None)
Expand Down Expand Up @@ -206,12 +204,10 @@ def default_api_version(self):
ResourceType.DATA_KEYVAULT_ADMINISTRATION_SETTING: None,
ResourceType.DATA_KEYVAULT_ADMINISTRATION_BACKUP: '7.5-preview.1',
ResourceType.DATA_KEYVAULT_ADMINISTRATION_ACCESS_CONTROL: '7.4',
ResourceType.DATA_STORAGE: '2018-11-09',
ResourceType.DATA_STORAGE_BLOB: '2022-11-02',
ResourceType.DATA_STORAGE_FILEDATALAKE: '2021-08-06',
ResourceType.DATA_STORAGE_FILESHARE: '2025-05-05',
ResourceType.DATA_STORAGE_QUEUE: '2018-03-28',
ResourceType.DATA_COSMOS_TABLE: '2017-04-17',
ResourceType.DATA_STORAGE_TABLE: None,
ResourceType.MGMT_SERVICEBUS: None,
ResourceType.MGMT_EVENTHUB: None,
Expand Down
41 changes: 11 additions & 30 deletions src/azure-cli/azure/cli/command_modules/acr/_stream_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from azure.core.exceptions import HttpResponseError
from azure.common import AzureHttpError
from azure.cli.core.profiles import ResourceType, get_sdk
from ._azure_utils import get_blob_info
from ._constants import ACR_RUN_DEFAULT_TIMEOUT_IN_SEC

logger = get_logger(__name__)
Expand Down Expand Up @@ -50,20 +49,14 @@ def stream_logs(cmd, client,
raise CLIError(error_msg)

if not artifact:
account_name, endpoint_suffix, container_name, blob_name, sas_token = get_blob_info(
log_file_sas)
AppendBlobService = get_sdk(cmd.cli_ctx, ResourceType.DATA_STORAGE, 'blob#AppendBlobService')
BlobClient = get_sdk(cmd.cli_ctx, ResourceType.DATA_STORAGE_BLOB, '_blob_client#BlobClient')
blob_client = BlobClient.from_blob_url(log_file_sas)
if not timeout:
timeout = ACR_RUN_DEFAULT_TIMEOUT_IN_SEC
_stream_logs(no_format,
DEFAULT_CHUNK_SIZE,
timeout,
AppendBlobService(
account_name=account_name,
sas_token=sas_token,
endpoint_suffix=endpoint_suffix),
container_name,
blob_name,
blob_client,
raise_error_on_failure)
else:
_stream_artifact_logs(log_file_sas,
Expand All @@ -74,8 +67,6 @@ def _stream_logs(no_format, # pylint: disable=too-many-locals, too-many-stateme
byte_size,
timeout_in_seconds,
blob_service,
container_name,
blob_name,
raise_error_on_failure):

if not no_format:
Expand All @@ -85,7 +76,6 @@ def _stream_logs(no_format, # pylint: disable=too-many-locals, too-many-stateme
stream = BytesIO()
metadata = {}
start = 0
end = byte_size - 1
available = 0
sleep_time = 1
max_sleep_time = 15
Expand All @@ -97,14 +87,12 @@ def _stream_logs(no_format, # pylint: disable=too-many-locals, too-many-stateme
# If the storage call fails, we'll just sleep and try again after.
try:
# Need to call "exists" API to prevent storage SDK logging BlobNotFound error
log_exist = blob_service.exists(
container_name=container_name, blob_name=blob_name)
log_exist = blob_service.exists()

if log_exist:
props = blob_service.get_blob_properties(
container_name=container_name, blob_name=blob_name)
props = blob_service.get_blob_properties()
metadata = props.metadata
available = props.properties.content_length
available = props.size
else:
# Wait a little bit before checking the existence again
time.sleep(1)
Expand All @@ -120,18 +108,13 @@ def _stream_logs(no_format, # pylint: disable=too-many-locals, too-many-stateme

try:
old_byte_size = len(stream.getvalue())
blob_service.get_blob_to_stream(
container_name=container_name,
blob_name=blob_name,
start_range=start,
end_range=end,
stream=stream)
downloader = blob_service.download_blob(offset=start, length=byte_size, max_concurrency=1)
downloader.readinto(stream)

curr_bytes = stream.getvalue()
new_byte_size = len(curr_bytes)
amount_read = new_byte_size - old_byte_size
start += amount_read
end = start + byte_size - 1

# Only scan what's newly read. If nothing is read, default to 0.
min_scan_range = max(new_byte_size - amount_read - 1, 0)
Expand All @@ -153,13 +136,11 @@ def _stream_logs(no_format, # pylint: disable=too-many-locals, too-many-stateme

try:
if log_exist:
props = blob_service.get_blob_properties(
container_name=container_name, blob_name=blob_name)
props = blob_service.get_blob_properties()
metadata = props.metadata
available = props.properties.content_length
available = props.size
else:
log_exist = blob_service.exists(
container_name=container_name, blob_name=blob_name)
log_exist = blob_service.exists()
except AzureHttpError as ae:
if ae.status_code != 404:
raise CLIError(ae)
Expand Down
Loading
Loading