From 0fe1b87ff7a0097ca65f8c88f5e574140db34054 Mon Sep 17 00:00:00 2001 From: Travis Prescott Date: Thu, 15 Dec 2016 12:30:35 -0800 Subject: [PATCH 1/2] Fix #1109. --- src/azure-cli-core/azure/cli/core/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/application.py b/src/azure-cli-core/azure/cli/core/application.py index 68cbc5273b2..8de97568c8a 100644 --- a/src/azure-cli-core/azure/cli/core/application.py +++ b/src/azure-cli-core/azure/cli/core/application.py @@ -225,7 +225,7 @@ def _load_file(path): if path == '-': content = sys.stdin.read() else: - with open(path, 'r') as input_file: + with open(os.path.expanduser(path), 'r') as input_file: content = input_file.read() return content[0:-1] if content[-1] == '\n' else content From e6ca3476d9bb0db19b81ed6e5251998d9f56b8a9 Mon Sep 17 00:00:00 2001 From: Travis Prescott Date: Thu, 15 Dec 2016 12:45:56 -0800 Subject: [PATCH 2/2] Fix #1577. --- src/azure-cli-core/azure/cli/core/application.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/application.py b/src/azure-cli-core/azure/cli/core/application.py index 8de97568c8a..e9f63459417 100644 --- a/src/azure-cli-core/azure/cli/core/application.py +++ b/src/azure-cli-core/azure/cli/core/application.py @@ -202,13 +202,15 @@ def _register_builtin_arguments(**kwargs): @staticmethod def _maybe_load_file(arg): ix = arg.find('@') - if ix == -1: + if ix == -1: # not found + return arg + + if ix == len(arg) - 1: # allow simply the value '@' (used by DNS for example) return arg if ix == 0: return Application._load_file(arg[1:]) - - if arg[ix - 1] == '=': + elif arg[ix - 1] == '=': return arg[:ix] + Application._load_file(arg[ix + 1:]) return arg