Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle file:// values containing leading/trailing spaces #640

Merged
merged 1 commit into from
Feb 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion awscli/argprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def get_parse_method_for_param(self, param, value=None):
if isinstance(value, list):
check_val = value[0]
else:
check_val = value
check_val = value.strip()
if isinstance(check_val, str) and check_val.startswith(('[', '{')):
LOG.debug("Param %s looks like JSON, not considered for "
"param shorthand.", param.py_name)
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/elb/test_register_instances_with_load_balancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ def test_two_instance_from_file(self):
cmdline += ' --instances file://%s' % data_path
self.assert_params_for_cmd(cmdline, TWO_INSTANCE_EXPECTED)

def test_json_file_with_spaces(self):
data_path = os.path.join(os.path.dirname(__file__),
'test_with_spaces.json')
cmdline = self.prefix
cmdline += ' --load-balancer-name my-lb'
cmdline += ' --instances file://%s' % data_path
self.assert_params_for_cmd(cmdline, TWO_INSTANCE_EXPECTED)

def test_two_instance_shorthand(self):
cmdline = self.prefix
cmdline += ' --load-balancer-name my-lb'
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/elb/test_with_spaces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[{"InstanceId": "i-12345678"},
{"InstanceId": "i-87654321"}]