Skip to content

Commit

Permalink
[Storage] az storage blob upload: Add back --socket-timeout which…
Browse files Browse the repository at this point in the history
… has been renamed by SDK (#23146)

* blob upload socket-timeout

* pop connection timeout

* retest
  • Loading branch information
calvinhzy authored Jul 22, 2022
1 parent 70cec65 commit 4306570
Show file tree
Hide file tree
Showing 5 changed files with 352 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def cf_blob_service(cli_ctx, kwargs):
account_url = get_account_url(cli_ctx, account_name=account_name, service='blob')
credential = account_key or sas_token or token_credential

return t_blob_service(account_url=account_url, credential=credential, **client_kwargs)
return t_blob_service(account_url=account_url, credential=credential,
connection_timeout=kwargs.pop('connection_timeout', None), **client_kwargs)


def get_credential(kwargs):
Expand All @@ -250,7 +251,8 @@ def cf_blob_client(cli_ctx, kwargs):
kwargs.pop('blob_name')
return t_blob_client.from_blob_url(blob_url=kwargs.pop('blob_url'),
credential=credential,
snapshot=kwargs.pop('snapshot', None))
snapshot=kwargs.pop('snapshot', None),
connection_timeout=kwargs.pop('connection_timeout', None))
if 'blob_url' in kwargs:
kwargs.pop('blob_url')

Expand Down
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/storage/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,8 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.extra('tags', arg_type=tags_type, arg_group="Additional Flags")
c.argument('metadata', arg_group="Additional Flags")
c.argument('timeout', arg_group="Additional Flags")
c.extra('connection_timeout', options_list=('--socket-timeout'), type=int,
help='The socket timeout(secs), used by the service to regulate data flow.')

# pylint: disable=line-too-long
with self.argument_context('storage blob upload-batch', resource_type=ResourceType.DATA_STORAGE_BLOB) as c:
Expand Down
Loading

0 comments on commit 4306570

Please sign in to comment.