Skip to content

Commit

Permalink
[Storage] Fix #23262: az storage blob metadata: Add --lease-id ba…
Browse files Browse the repository at this point in the history
…ck (#23330)
  • Loading branch information
evelyn-ys authored Jul 26, 2022
1 parent 05bd04a commit 5fc7511
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 88 deletions.
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/storage/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.register_precondition_options()
c.extra('snapshot', help='The snapshot parameter is an opaque DateTime value that, when present, '
'specifies the blob snapshot to retrieve.')
c.argument('lease_id', help='Required if the blob has an active lease.')
c.extra('lease', options_list=['--lease-id'], help='Required if the blob has an active lease.')

# pylint: disable=line-too-long
with self.argument_context('storage blob upload', resource_type=ResourceType.DATA_STORAGE_BLOB) as c:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,12 +925,12 @@ def _copy_file_to_blob_container(blob_service, source_file_service, destination_
raise CLIError(error_template.format(source_path, destination_container, ex))


def show_blob_v2(cmd, client, lease_id=None, **kwargs):
blob = client.get_blob_properties(lease=lease_id, **kwargs)
def show_blob_v2(cmd, client, **kwargs):
blob = client.get_blob_properties(**kwargs)

page_ranges = None
if blob.blob_type == cmd.get_models('_models#BlobType', resource_type=ResourceType.DATA_STORAGE_BLOB).PageBlob:
page_ranges = client.get_page_ranges(lease=lease_id, **kwargs)
page_ranges = client.get_page_ranges(**kwargs)

blob.page_ranges = page_ranges

Expand Down
Loading

0 comments on commit 5fc7511

Please sign in to comment.