Skip to content

Commit

Permalink
raise error for non-storagev2 accounts (Azure#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
williexu authored Jan 2, 2019
1 parent 87d322d commit 4f845e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/storage-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
0.2.1 (tbd)
+++++++++++
* fixed missing `--auth-mode` from data-plane commands
* add validation for StorageV2 account when using static website

0.2.0 (2018-12-14)
++++++++++++++++++
Expand Down
4 changes: 3 additions & 1 deletion src/storage-preview/azext_storage_preview/operations/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# --------------------------------------------------------------------------------------------

from __future__ import print_function
from knack.util import CLIError


def set_service_properties(client, parameters, delete_retention=None, days_retained=None, static_website=None,
Expand All @@ -18,6 +19,8 @@ def set_service_properties(client, parameters, delete_retention=None, days_retai
parameters.delete_retention_policy.days = days_retained

if any([static_website, index_document, error_document_404_path]):
if getattr(parameters, 'static_website', None) is None:
raise CLIError('Static websites are only supported for StorageV2 (general-purpose v2) accounts.')
kwargs['static_website'] = parameters.static_website
if static_website is not None:
parameters.static_website.enabled = static_website
Expand All @@ -29,7 +32,6 @@ def set_service_properties(client, parameters, delete_retention=None, days_retai
# checks
policy = parameters.delete_retention_policy
if policy.enabled and not policy.days:
from knack.util import CLIError
raise CLIError("must specify days-retained")

client.set_blob_service_properties(**kwargs)
Expand Down

0 comments on commit 4f845e3

Please sign in to comment.