Skip to content

Commit

Permalink
[Storage] Fix errors for storage blob update (#11907)
Browse files Browse the repository at this point in the history
* fix validator

* update history.rst
  • Loading branch information
Juliehzl authored Jan 20, 2020
1 parent 6ce5bba commit 14c2cfb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Release History
**Storage**

* Add a new command group `az storage share-rm` to use the Microsoft.Storage resource provider for Azure file share management operations.
* Fix issue #11415: permission error for `az storage blob update`

2.0.80
++++++
Expand Down
29 changes: 15 additions & 14 deletions src/azure-cli/azure/cli/command_modules/storage/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,16 @@ def get_config_value(section, key, default):
if auth_mode == 'login':
n.token_credential = _create_token_credential(cmd.cli_ctx)

# give warning if there are account key args being ignored
account_key_args = [n.account_key and "--account-key", n.sas_token and "--sas-token",
n.connection_string and "--connection-string"]
account_key_args = [arg for arg in account_key_args if arg]

if account_key_args:
logger.warning('In "login" auth mode, the following arguments are ignored: %s',
' ,'.join(account_key_args))
return
if hasattr(n, 'token_credential') and n.token_credential:
# give warning if there are account key args being ignored
account_key_args = [n.account_key and "--account-key", n.sas_token and "--sas-token",
n.connection_string and "--connection-string"]
account_key_args = [arg for arg in account_key_args if arg]

if account_key_args:
logger.warning('In "login" auth mode, the following arguments are ignored: %s',
' ,'.join(account_key_args))
return

if not n.connection_string:
n.connection_string = get_config_value('storage', 'connection_string', None)
Expand Down Expand Up @@ -369,13 +370,13 @@ def validator(cmd, namespace):
key = ns.get('account_key')
cs = ns.get('connection_string')
sas = ns.get('sas_token')
token_credential = ns.get('token_credential')
if _class_name(settings_class) == _class_name(t_blob_content_settings):
client = get_storage_data_service_client(cmd.cli_ctx,
t_base_blob_service,
account,
key,
cs,
sas)
service=t_base_blob_service,
name=account,
key=key, connection_string=cs, sas_token=sas,
token_credential=token_credential)
container = ns.get('container_name')
blob = ns.get('blob_name')
lease_id = ns.get('lease_id')
Expand Down

0 comments on commit 14c2cfb

Please sign in to comment.