diff --git a/src/azure-cli/azure/cli/command_modules/storage/_validators.py b/src/azure-cli/azure/cli/command_modules/storage/_validators.py index 0ab62590c3f..745dbcfc0bb 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_validators.py @@ -617,6 +617,7 @@ def validator(cmd, namespace): clear_content_settings = ns.pop('clear_content_settings', False) # retrieve the existing object properties for an update + props = None if update and not clear_content_settings: account = ns.get('account_name') key = ns.get('account_key') @@ -672,12 +673,12 @@ def validator(cmd, namespace): ) # if update, fill in any None values with existing - if update: + if update and props: if not clear_content_settings: for attr in ['content_type', 'content_disposition', 'content_encoding', 'content_language', 'content_md5', 'cache_control']: if getattr(new_props, attr) is None: - setattr(new_props, attr, getattr(props, attr)) # pylint: disable=used-before-assignment + setattr(new_props, attr, getattr(props, attr)) else: if guess_from_file: new_props = guess_content_type(ns[guess_from_file], new_props, settings_class)