Skip to content

Commit ca0d882

Browse files
committed
Merge branch 'release-1.4.2'
* release-1.4.2: (25 commits) Bumping version to 1.4.2 Updated the changelog for new features. Update changelog with latest changes. Update changelog with no sign request option Renamed the recently added classes. Fix completer test with new --no-sign-request arg Add a --no-sign-request argument More updates from the AWS doc team (elb) Rename "--filter" to "--filters" Add missing test for list-structure(list-scalar, scalar) docs Show syntax for specifying multiple shorthand pairs Fix describe-vpc-peering-connection with correct filter syntax Fixed describe-reserved-instances with correct --filter syntax Correct syntax for describe-volumes example Update example to quote entire Key value Fixed unwieldy description in s3/_concepts.rst and the related subcommand test. re-added lines from commit fb84aaf Small correction to get-metric-statistics example Synced changes with doc team sources. Add ``InfoSetter`` class. ...
2 parents 32021da + a53bfa3 commit ca0d882

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+710
-294
lines changed

.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
branch = True
3+
include =
4+
awscli/*

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ python:
44
- "2.7"
55
- "3.3"
66
install:
7-
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install --use-mirrors unittest2; fi
8-
- pip install --use-mirrors -r requirements.txt
7+
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi
8+
- pip install -r requirements.txt
99
- python setup.py develop
10-
script: nosetests tests/unit
10+
- pip install coverage python-coveralls
11+
script: nosetests tests/unit --cover-erase --with-coverage --cover-package awscli
12+
after_success: coveralls

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
CHANGELOG
33
=========
44

5+
1.4.2
6+
=====
7+
8+
* feature:``aws cloudsearchdomain``: Added sigv4 support.
9+
* bugfix:Credentials: Raise an error if an incomplete profile is found
10+
(`issue 690 <https://github.com/aws/aws-cli/issues/690>`__)
11+
* feature:Signing Requests: Add a ``--no-sign-request`` option that,
12+
when specified, will not sign any requests.
13+
* bugfix:``aws s3``: Added ``-source-region`` argument to allow transfer
14+
between non DNS compatible buckets that were located in different regions.
15+
(`issue 872 <https://github.com/aws/aws-cli/pull/872>`__)
16+
17+
518
1.4.1
619
=====
720

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ aws-cli
66
:target: https://travis-ci.org/aws/aws-cli
77
:alt: Build Status
88

9+
10+
.. image:: https://coveralls.io/repos/aws/aws-cli/badge.png
11+
:target: https://coveralls.io/r/aws/aws-cli
12+
13+
914
This package provides a unified command line interface to many
1015
Amazon Web Services.
1116

awscli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"""
1818
import os
1919

20-
__version__ = '1.4.1'
20+
__version__ = '1.4.2'
2121

2222
#
2323
# Get our data path to be added to botocore's search path

awscli/argprocess.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,19 +326,23 @@ def _create_name_to_params(self, param):
326326
return dict([(v, None) for v in param.keys.enum])
327327

328328
def _docs_list_scalar_list_parse(self, param):
329-
s = 'Key value pairs, where values are separated by commas.\n'
329+
s = ('Key value pairs, where values are separated by commas, '
330+
'and multiple pairs are separated by spaces.\n')
330331
s += '%s ' % param.cli_name
331332
inner_params = param.members.members
332333
scalar_params = [p for p in inner_params if p.type in SCALAR_TYPES]
333334
list_params = [p for p in inner_params if p.type == 'list']
335+
pair = ''
334336
for param in scalar_params:
335-
s += '%s=%s1,' % (param.name, param.type)
337+
pair += '%s=%s1,' % (param.name, param.type)
336338
for param in list_params[:-1]:
337339
param_type = param.members.type
338-
s += '%s=%s1,%s2,' % (param.name, param_type, param_type)
340+
pair += '%s=%s1,%s2,' % (param.name, param_type, param_type)
339341
last_param = list_params[-1]
340342
param_type = last_param.members.type
341-
s += '%s=%s1,%s2' % (last_param.name, param_type, param_type)
343+
pair += '%s=%s1,%s2' % (last_param.name, param_type, param_type)
344+
pair += ' %s' % pair
345+
s += pair
342346
return s
343347

344348
def _docs_list_scalar_parse(self, param):
@@ -348,8 +352,10 @@ def _docs_list_scalar_parse(self, param):
348352
def _docs_list_key_value_parse(self, param):
349353
s = "Key value pairs, with multiple values separated by a space.\n"
350354
s += '%s ' % param.cli_name
351-
s += ','.join(['%s=%s' % (sub_param.name, sub_param.type)
352-
for sub_param in param.members.members])
355+
pair = ','.join(['%s=%s' % (sub_param.name, sub_param.type)
356+
for sub_param in param.members.members])
357+
pair += ' %s' % pair
358+
s += pair
353359
return s
354360

355361
def _docs_special_key_value_parse(self, param):

awscli/customizations/globalargs.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
def register_parse_global_args(cli):
2020
cli.register('top-level-args-parsed', resolve_types)
21+
cli.register('top-level-args-parsed', no_sign_request)
2122

2223

2324
def resolve_types(parsed_args, **kwargs):
@@ -48,3 +49,16 @@ def _resolve_verify_ssl(value):
4849
else:
4950
verify = os.environ.get('AWS_CA_BUNDLE')
5051
return verify
52+
53+
54+
def no_sign_request(parsed_args, session, **kwargs):
55+
if not parsed_args.sign_request:
56+
# In order to make signing disabled for all requests
57+
# we need to set the signature_version to None for
58+
# any service created. This ensures that get_endpoint()
59+
# will not look for auth.
60+
session.register('service-created', disable_signing)
61+
62+
63+
def disable_signing(service, **kwargs):
64+
service.signature_version = None

awscli/customizations/s3/filegenerator.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from dateutil.parser import parse
1818
from dateutil.tz import tzlocal
1919

20-
from awscli.customizations.s3.fileinfo import FileInfo
2120
from awscli.customizations.s3.utils import find_bucket_key, get_file_stat
2221
from awscli.customizations.s3.utils import BucketLister
2322
from awscli.errorhandler import ClientError
@@ -46,6 +45,20 @@ def __init__(self, directory, filename):
4645
super(FileDecodingError, self).__init__(self.error_message)
4746

4847

48+
class FileStat(object):
49+
def __init__(self, src, dest=None, compare_key=None, size=None,
50+
last_update=None, src_type=None, dest_type=None,
51+
operation_name=None):
52+
self.src = src
53+
self.dest = dest
54+
self.compare_key = compare_key
55+
self.size = size
56+
self.last_update = last_update
57+
self.src_type = src_type
58+
self.dest_type = dest_type
59+
self.operation_name = operation_name
60+
61+
4962
class FileGenerator(object):
5063
"""
5164
This is a class the creates a generator to yield files based on information
@@ -54,7 +67,8 @@ class FileGenerator(object):
5467
under the same common prefix. The generator yields corresponding
5568
``FileInfo`` objects to send to a ``Comparator`` or ``S3Handler``.
5669
"""
57-
def __init__(self, service, endpoint, operation_name, follow_symlinks=True):
70+
def __init__(self, service, endpoint, operation_name,
71+
follow_symlinks=True):
5872
self._service = service
5973
self._endpoint = endpoint
6074
self.operation_name = operation_name
@@ -86,10 +100,9 @@ def call(self, files):
86100
sep_table[dest_type])
87101
else:
88102
dest_path = dest['path']
89-
yield FileInfo(src=src_path, dest=dest_path,
103+
yield FileStat(src=src_path, dest=dest_path,
90104
compare_key=compare_key, size=size,
91105
last_update=last_update, src_type=src_type,
92-
service=self._service, endpoint=self._endpoint,
93106
dest_type=dest_type,
94107
operation_name=self.operation_name)
95108

awscli/customizations/s3/fileinfo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class FileInfo(TaskInfo):
140140
def __init__(self, src, dest=None, compare_key=None, size=None,
141141
last_update=None, src_type=None, dest_type=None,
142142
operation_name=None, service=None, endpoint=None,
143-
parameters=None):
143+
parameters=None, source_endpoint=None):
144144
super(FileInfo, self).__init__(src, src_type=src_type,
145145
operation_name=operation_name,
146146
service=service,
@@ -156,6 +156,7 @@ def __init__(self, src, dest=None, compare_key=None, size=None,
156156
else:
157157
self.parameters = {'acl': None,
158158
'sse': None}
159+
self.source_endpoint = source_endpoint
159160

160161
def _permission_to_param(self, permission):
161162
if permission == 'read':
@@ -256,7 +257,8 @@ def delete(self):
256257
"""
257258
if (self.src_type == 's3'):
258259
bucket, key = find_bucket_key(self.src)
259-
params = {'endpoint': self.endpoint, 'bucket': bucket, 'key': key}
260+
params = {'endpoint': self.source_endpoint, 'bucket': bucket,
261+
'key': key}
260262
response_data, http = operate(self.service, 'DeleteObject',
261263
params)
262264
else:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
from awscli.customizations.s3.fileinfo import FileInfo
14+
15+
16+
class FileInfoBuilder(object):
17+
"""
18+
This class takes a ``FileBase`` object's attributes and generates
19+
a ``FileInfo`` object so that the operation can be performed.
20+
"""
21+
def __init__(self, service, endpoint, source_endpoint=None,
22+
parameters = None):
23+
self._service = service
24+
self._endpoint = endpoint
25+
self._source_endpoint = endpoint
26+
if source_endpoint:
27+
self._source_endpoint = source_endpoint
28+
self._parameters = parameters
29+
30+
def call(self, files):
31+
for file_base in files:
32+
file_info = self._inject_info(file_base)
33+
yield file_info
34+
35+
def _inject_info(self, file_base):
36+
file_info_attr = {}
37+
file_info_attr['src'] = file_base.src
38+
file_info_attr['dest'] = file_base.dest
39+
file_info_attr['compare_key'] = file_base.compare_key
40+
file_info_attr['size'] = file_base.size
41+
file_info_attr['last_update'] = file_base.last_update
42+
file_info_attr['src_type'] = file_base.src_type
43+
file_info_attr['dest_type'] = file_base.dest_type
44+
file_info_attr['operation_name'] = file_base.operation_name
45+
file_info_attr['service'] = self._service
46+
file_info_attr['endpoint'] = self._endpoint
47+
file_info_attr['source_endpoint'] = self._source_endpoint
48+
file_info_attr['parameters'] = self._parameters
49+
return FileInfo(**file_info_attr)

0 commit comments

Comments
 (0)