Skip to content

Commit

Permalink
More informative exception message for malformed connection string (A…
Browse files Browse the repository at this point in the history
…zure#5983)

* More informative exception message for connection string

* clierror import on lower scope
  • Loading branch information
williexu authored and tjprescott committed Apr 3, 2018
1 parent 769bd67 commit 617cad7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/command_modules/azure-cli-storage/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

2.0.31
++++++
* Better error message for malformed connection strings.

2.0.30
++++++
* Fix issue of upload file with size between 195GB and 200GB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ def get_config_value(section, key, default):
# if connection string supplied or in environment variables, extract account key and name
if n.connection_string:
conn_dict = validate_key_value_pairs(n.connection_string)
n.account_name = conn_dict['AccountName']
n.account_key = conn_dict['AccountKey']
n.account_name = conn_dict.get('AccountName')
n.account_key = conn_dict.get('AccountKey')
if not n.account_name or not n.account_key:
from knack.util import CLIError
raise CLIError('Connection-string: %s, is malformed. Some shell environments require the '
'connection string to be surrounded by quotes.' % n.connection_string)

# otherwise, simply try to retrieve the remaining variables from environment variables
if not n.account_name:
Expand Down
2 changes: 1 addition & 1 deletion src/command_modules/azure-cli-storage/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}

VERSION = "2.0.30"
VERSION = "2.0.31"
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
Expand Down

0 comments on commit 617cad7

Please sign in to comment.