Skip to content

Commit

Permalink
Merge branch 'release-1.3.20'
Browse files Browse the repository at this point in the history
* release-1.3.20:
  Bumping version to 1.3.20
  Update changelog with latest changes
  Add customizations for cloudsearchdomain command
  • Loading branch information
jamesls committed Jun 26, 2014
2 parents 1f8ed75 + ff8c8fc commit d6c4980
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 13 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
CHANGELOG
=========

1.3.20
======

* feature:``aws cloudsearchdomain``: Add support for the
Amazon CloudSearch Domain command.
* feature:``aws cloudfront``: Update the Amazon CloudFront
command to the latest version


1.3.19
======

Expand Down
2 changes: 1 addition & 1 deletion awscli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
import os

__version__ = '1.3.19'
__version__ = '1.3.20'

#
# Get our data path to be added to botocore's search path
Expand Down
6 changes: 5 additions & 1 deletion awscli/clidriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ def main(self, args=None):
parser = self._create_parser()
command_table = self._get_command_table()
parsed_args, remaining = parser.parse_known_args(args)
self._handle_top_level_args(parsed_args)
try:
# Because _handle_top_level_args emits events, it's possible
# that exceptions can be raised, which should have the same
# general exception handling logic as calling into the
# command table. This is why it's in the try/except clause.
self._handle_top_level_args(parsed_args)
return command_table[parsed_args.command](remaining, parsed_args)
except UnknownArgumentError as e:
sys.stderr.write(str(e) + '\n')
Expand Down
1 change: 1 addition & 0 deletions awscli/customizations/argrename.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'datapipeline.*.query': 'objects-query',
'emr.*.job-flow-ids': 'cluster-ids',
'emr.*.job-flow-id': 'cluster-id',
'cloudsearchdomain.search.query': 'search-query',
}


Expand Down
29 changes: 29 additions & 0 deletions awscli/customizations/cloudsearchdomain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
"""Customizations for the cloudsearchdomain command.
This module customizes the cloudsearchdomain command:
* Add validation that --endpoint-url is required.
"""

def register_cloudsearchdomain(cli):
cli.register('top-level-args-parsed', validate_endpoint_url)


def validate_endpoint_url(parsed_args, **kwargs):
if parsed_args.command == 'cloudsearchdomain' and \
parsed_args.endpoint_url is None:
raise ValueError(
"--endpoint-url is required for cloudsearchdomain commands")
2 changes: 2 additions & 0 deletions awscli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from awscli.customizations.globalargs import register_parse_global_args
from awscli.customizations.cloudsearch import initialize as cloudsearch_init
from awscli.customizations.emr.emr import emr_initialize
from awscli.customizations.cloudsearchdomain import register_cloudsearchdomain


def awscli_initialize(event_handlers):
Expand Down Expand Up @@ -92,3 +93,4 @@ def awscli_initialize(event_handlers):
datapipeline.register_customizations(event_handlers)
cloudsearch_init(event_handlers)
emr_initialize(event_handlers)
register_cloudsearchdomain(event_handlers)
9 changes: 8 additions & 1 deletion awscli/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,14 @@ def run_cmd(self, cmd, expected_rc=0):
captured_stdout = six.StringIO()
with mock.patch('sys.stderr', captured_stderr):
with mock.patch('sys.stdout', captured_stdout):
rc = self.driver.main(cmdlist)
try:
rc = self.driver.main(cmdlist)
except SystemExit as e:
# We need to catch SystemExit so that we
# can get a proper rc and still present the
# stdout/stderr to the test runner so we can
# figure out what went wrong.
rc = e.code
stderr = captured_stderr.getvalue()
stdout = captured_stdout.getvalue()
self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# The short X.Y version.
version = '1.3.'
# The full version, including alpha/beta/rc tags.
release = '1.3.19'
release = '1.3.20'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import awscli


requires = ['botocore>=0.53.0,<0.54.0',
requires = ['botocore>=0.54.0,<0.55.0',
'bcdoc>=0.12.0,<0.13.0',
'six>=1.1.0',
'colorama==0.2.5',
Expand Down
62 changes: 62 additions & 0 deletions tests/unit/customizations/test_cloudsearchdomain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from awscli.testutils import unittest
from awscli.testutils import BaseAWSCommandParamsTest
from awscli.customizations.cloudsearchdomain import validate_endpoint_url

import mock


class TestSearchCommand(BaseAWSCommandParamsTest):
prefix = 'cloudsearchdomain search '

def test_search_with_query(self):
cmd = self.prefix.split()
cmd += [
'--endpoint-url', 'http://example.com/',
# Note we're also verifying that --query is renamed to
# --search-query from argrename.py.
'--search-query', 'George Lucas',
'--query-options',
'{"defaultOperator":"and","fields":["directors^10"]}']

result = {
'headers': {},
'uri_params': {
'query': 'George Lucas',
'queryOptions':
'{"defaultOperator":"and","fields":["directors^10"]}'}}

self.assert_params_for_cmd(cmd, result, ignore_params=['payload'])
# We ignore'd the paylod, but we can verify that there should be
# no payload for this request.
self.assertIsNone(self.last_params['payload'].getvalue())

def test_endpoint_is_required(self):
cmd = self.prefix.split()
cmd += ['--search-query', 'foo']
stderr = self.run_cmd(cmd, expected_rc=255)[1]
self.assertIn('--endpoint-url is required', stderr)


class TestCloudsearchDomainHandler(unittest.TestCase):
def test_validate_endpoint_url_is_none(self):
parsed_args = mock.Mock()
parsed_args.endpoint_url = None
parsed_args.command = 'cloudsearchdomain'
with self.assertRaises(ValueError):
validate_endpoint_url(parsed_args)


if __name__ == "__main__":
unittest.main()
16 changes: 8 additions & 8 deletions tests/unit/test_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@

COMPLETIONS = [
('aws ', -1, set(['autoscaling', 'cloudformation', 'cloudsearch',
'cloudtrail', 'cloudwatch', 'configure', 'datapipeline',
'directconnect', 'dynamodb', 'ec2',
'elasticache', 'elasticbeanstalk', 'elastictranscoder',
'elb', 'iam', 'importexport', 'kinesis',
'opsworks', 'rds', 'redshift', 'route53', 's3', 's3api',
'ses', 'sns', 'sqs', 'storagegateway', 'sts',
'support', 'swf'])),
'cloudsearchdomain', 'cloudtrail', 'cloudwatch',
'configure', 'datapipeline', 'directconnect', 'dynamodb',
'ec2', 'elasticache', 'elasticbeanstalk',
'elastictranscoder', 'elb', 'iam', 'importexport',
'kinesis', 'opsworks', 'rds', 'redshift', 'route53',
's3', 's3api', 'ses', 'sns', 'sqs', 'storagegateway',
'sts', 'support', 'swf'])),
('aws cloud', -1, set(['cloudformation', 'cloudsearch',
'cloudtrail', 'cloudwatch'])),
'cloudsearchdomain', 'cloudtrail', 'cloudwatch'])),
('aws cloudf', -1, set(['cloudformation'])),
('aws cloudfr', -1, set([])),
('aws foobar', -1, set([])),
Expand Down

0 comments on commit d6c4980

Please sign in to comment.