Commit Graph

495 Commits

Author SHA1 Message Date
liuqing 9b9f3befed Use immutable arg rather mutable arg
Passing mutable objects as default args is a known Python pitfall.
We'd better avoid this. This commit changes mutable default args with
None.

Change-Id: I78323383c8b6a9a516a2a217303124870822418b
2014-07-03 15:10:54 +08:00
liuqing 1c46c769e8 Add CONTRIBUTING.rst
There is no CONTRIBUTING.rst file, so i add it.

Change-Id: Icaafaf86c3b4314e2e20611e5e08956f1ea993ea
2014-07-01 15:01:36 +08:00
Flavio Percoco caa1a54fd9 Added release notes for 0.13.0
Change-Id: I51374661a5ce58cd2a970a75893b1251ab6e176b
2014-06-30 11:33:34 +02:00
Jenkins abd0812d05 Merge "Add wheels section to the setup.cfg" 2014-06-30 08:52:38 +00:00
Jenkins 6d4a4b7ecb Merge "Add missing classifiers" 2014-06-30 08:52:36 +00:00
Jenkins 4ea01682da Merge "Add license to setup.cfg" 2014-06-30 08:52:33 +00:00
Jenkins 195384223f Merge "Fix CA certificate handling" 2014-06-30 08:52:31 +00:00
Flavio Percoco 438bfa3b9c Add wheels section to the setup.cfg
Glance client's setup.cfg was missing the wheels section. This commit
adds it and makes the client's setup.cfg consistent with other clients.

Change-Id: I16030c0379dae3c3c07bd73f09798c2160310811
2014-06-30 08:53:29 +02:00
Flavio Percoco 50dc35991c Add missing classifiers
This commit adds 2 more classifiers to setup.cfg. An environment
classifier that specifies glanceclient is a console tool and a
development classifier that specifies it is production ready.

Change-Id: Ia60ea76798503b0a729c384298f1a633d695a1ab
2014-06-30 08:52:29 +02:00
Flavio Percoco 7b19682984 Add license to setup.cfg
Glance client's setup.cfg was missing the license attribute. This commit
adds it to make it consistent with other clients and server libraries.
The value of the license attribute reflects the license in the LICENSE
file.

Change-Id: Ia2e8c3be4fe7eaf0db5eb397646068c83076c2ff
2014-06-30 08:51:11 +02:00
Stuart McLaren 6626f38cda Fix CA certificate handling
If --os-cacert was passed to the cli the following error was
triggered: "cafile must be None or a byte string". This is
because 'load_verify_locations' requires a byte string to
be passed in.

We fix this by explicitly converting the argument to a byte
string.

We do this in 'VerifiedHTTPSConnection' rather than sooner, eg
during arg handling, as it will no longer be required should we
move to a different http library (eg requests).

Fixes bug 1301849.

Change-Id: I9014f5d040cae9f0b6f03d8f13de8419597560cb
2014-06-25 13:45:46 +00:00
Longgeek eca5fc22ca Add the six module dependency
Change-Id: Ie57c4e8bad2934acb5217a88713099374c20dde9
Closes-Bug: #1333872
2014-06-25 09:17:45 +00:00
Jenkins e62ed4d267 Merge "Set purge-props header correctly in image update" 2014-06-24 15:00:22 +00:00
Jenkins e82f773385 Merge "Prepend '/' to the delete url for the v2 client" 2014-06-24 13:21:00 +00:00
Jenkins 37cf7178a9 Merge "Change assertTrue(isinstance()) by optimal assert" 2014-06-24 04:01:09 +00:00
Manuel Desbonnet a945b3d448 Prepend '/' to the delete url for the v2 client
... and update tests to match.

The missing slash results in a non-absolute DELETE request
being sent to the API.
E.g.
DELETE v2/images/62fac489-23b4-4929-87af-2e7236e8542b HTTP/1.1

This is not strictly valid http/1.1 - rfc2616 specifies that the path must
be absolute.
This doesn't cause a problem for the API server, but this can cause
problems if the API server is fronted by something else (see #133161).

It also means that the curl command logged in debug mode has a
bad url.
E.g.
curl -i -X DELETE ... http://10.0.0.13:9292v2/images/...

Change-Id: Ib0c749dedbfcf07303fcddae4512db61b0f3fd78
Closes-bug: #1327101
2014-06-23 15:22:57 +01:00
Maithem cddc37dcab Set purge-props header correctly in image update
Currently when an image is updated, the purge property
header is only set to true in some cases, but when
required it isn't set to false

Change-Id: I885a82643d2620f393f21c36b3ad95cb7ed43f2c
Closes-Bug: 1318079
2014-06-19 17:35:26 -07:00
OpenStack Proposal Bot 938031ad52 Updated from global requirements
Change-Id: I3f2a517c6a02285c804adcee95cb66f1f6502744
2014-06-19 01:12:29 +00:00
Jenkins e6579f43cc Merge "Reuse class Manager from common code" 2014-06-18 19:46:02 +00:00
Michael Still dec9c9f352 Change a debug line to prevent UnicodeDecodeError issue
This debug line is causing tracebacks in the n-cpu logs for
tempest runs. Its because the logged data is sometimes unicode:

Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 846, in emit
    msg = self.format(record)
  File "/opt/stack/new/nova/nova/openstack/common/log.py", line 710, in format
    return logging.StreamHandler.format(self, record)
  File "/usr/lib/python2.7/logging/__init__.py", line 723, in format
    return fmt.format(record)
  File "/opt/stack/new/nova/nova/openstack/common/log.py", line 674, in format
    return logging.Formatter.format(self, record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1234: ordinal not in range(128)
Logged from file http.py, line 153

The change used correct encoding error handling policy for the log
which may includes non-ascii char.

Closes-bug: 1320655
Change-Id: I97f5f14b9beddcceb7fbd371062caf5a38a62a20
2014-06-18 23:01:25 +08:00
Jenkins 3b694ca89f Merge "Add support for location parameters in v2 commands" 2014-06-17 09:13:41 +00:00
Jenkins 2739317260 Merge "progress flag not supported in v2 API" 2014-06-17 05:38:14 +00:00
David Koo 323d32cc6d Add support for location parameters in v2 commands
Currently glanceclient's v2 commands don't support modification
operations on an image's location attribute - the argparse specification
for the location attribute of the image-update command causes the image
id argument to be included in list of locations and so the command
parsing fails (because it causes the image id to appear to be missing).

Furthermore even if the 'locations' argument were to be accepted by
argparse (e.g. by changing the argument specs and using --id to specify
the image id) the command would still fail because the arguments are
passed directly to the schema which expects the value of the 'locations'
argument to be a valid dictionary (there is nobody to convert the
argument string to a python dictionary that the schema expects).

This commit adds the following location related commands to
glanceclient:
    --location-add: Add a new location to the list of image locations.
    --location-delete: Remove an existing location from the list of
        image locations.
    --location-update: Update the metadata of existing location.

The glanceclient.v2.images.Controller class has been agumented with
three new methods to support the commands listed above:
    - add_location
    - delete_locations
    - update_location

The server has not been modified, i.e. all location related API requests
are passed to the server via HTTP PATCH requests and handled by the
server's image update function.

The v2 'image' and 'shell' related tests have also been supplemented.

Note that in order to use these options the server must be first
configured to expose location related info to the clients (i.e.
'show_multiple_locations' must be set to 'True").

I also added a mailmap entry for myself.

DocImpact
Closes-bug: #1271452
Co-Author: David Koo (koofoss) <david.koo@huawei.com>

Change-Id: Id1f320af05d9344645836359758e4aa227aafc69
2014-06-16 21:56:41 +00:00
Cindy Pallares 04fb3c2624 Convert passed integer values into int in v1 shell
Add the type to the parameters that require an integer
in the V1 shell to avoid sending an improper request.

Change-Id: Idb1ed39b11ca737fdd42d24e297c142f28dce35c
2014-06-12 15:59:49 +00:00
Andrey Kurilin d54faad042 Reuse class Manager from common code
Class `Managers` from `glanceclient.common.base` module is similar to
class `apiclient:ManagerWithFind` from common code.

In this patch:
- class glanceclient.common.base:Managers replaced by
apiclient:ManagerWithFind
- module glanceclient.common.base marked as 'deprecated'

Related to bp common-client-library-2

Change-Id: I41da4a9188e97ca2c07b6234fc2ac0a877553d3f
2014-06-12 14:42:46 +03:00
Jenkins dbefc1a3b1 Merge "Fix help text in image-create" 2014-06-10 19:46:58 +00:00
Jenkins c4e3edcdd5 Merge "Python 3: use next(foo) instead of foo.next()" 2014-06-09 04:24:58 +00:00
Jenkins 08aaa468d1 Merge "Remove auth token from http logging" 2014-06-04 18:36:51 +00:00
Juan Manuel Olle 083986ad7e Fix help text in image-create
Image-create help text makes reference of a non existing
parameter --copy_from

Change-Id: I26d584c350734bb26a6cf965a2198f0782dd0a9f
2014-06-03 17:15:01 -03:00
Cyril Roelandt 7f3153c5ea Python 3: use next(foo) instead of foo.next()
This is compatible with both versions of Python.

Change-Id: I50f9b2fa0c2333010c10eb4db34d972aa379f0e3
2014-06-02 00:57:54 +02:00
Jenkins 803eed6083 Merge "Finalize Python3 support" 2014-05-28 16:57:34 +00:00
Tom Leaman 6149e1db31 Remove auth token from http logging
This redacts the X-Auth-Token header value from the logs by replacing
it with '***'.

Change-Id: I6b80cc94d42a44f9db801de78fa23218e6eca0ee
2014-05-27 15:09:06 +00:00
Jenkins 8f89a14c9f Merge "fixed typos found by RETF rules" 2014-05-22 09:05:15 +00:00
Jenkins e9e933145e Merge "Return request ID to callers" 2014-05-20 21:42:11 +00:00
Jenkins d84311f1f1 Merge "Remove py3k module" 2014-05-20 15:10:59 +00:00
Frederic Lepied 628c541a69 Finalize Python3 support
Set the environment variable PYTHONHASHSEED to 0 to have
predictive tests under Python 3.

Change-Id: Ia15a9383e0f20bd0e4572e9f9b9772f1704dff86
2014-05-20 16:42:10 +02:00
Christian Berendt afcf3a5611 fixed typos found by RETF rules
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos

Change-Id: I70245e5ddf342762eb76d8e2e74b6363767726ef
2014-05-05 10:55:02 +02:00
OpenStack Proposal Bot b68d13bf83 Updated from global requirements
Change-Id: Ied7b0c3e2b0fc13abb04c859ec6887d7a8533c15
2014-04-30 02:46:18 +00:00
Dirk Mueller 7bdf2526b7 Remove py3k module
This module is obsolete and has been dropped from oslo-incubator.
Use six instead (which is already done here).

Change-Id: I8e0b49cdfbddcf2d44a601ad06be2e75897905fc
2014-04-28 18:23:46 +02:00
Chris Buccella f0635ecf39 Return request ID to callers
Currently, calls (create, get, etc.) return only the Image to a
caller. In order to log a mapping the request IDs of both glanceclient
and the caller, the x-openstack-request-id header value is needed on
the server side. This change allows that value to be bubbled up and
returned to the caller so that the appropriate logging can occur.
The return_req_id parameter can be set by services that are logging
request IDs. Glance's request ID will then be returned via the
return_req_id parameter.

This is a prerequisite for Log Request ID Mappings nova-spec to
be completed; Change Ib9b820a0feeb0c0e828ed3e4fab8261f8761ba9a

Change I43be05c351f901cee5509c76cff6d69f060c0b3f is an example of
a caller using this.

Implements: blueprint return-req-id
Change-Id: Ia82aa14db5f0e453010514fffb9a25d7b0fc2fd1
2014-04-25 10:26:40 -04:00
Jenkins f2e0610628 Merge "Fix the parameter order of assertEqual in glanceclient v2 test" 2014-04-23 16:05:58 +00:00
Jenkins ae2b5d046a Merge "Fix the parameter order of assertEqual in glanceclient test" 2014-04-21 09:12:09 +00:00
Jenkins 59b04bde11 Merge "Fix for invalid literal ValueError parsing ipv6 url(s)" 2014-04-17 02:40:29 +00:00
Jenkins a70f9c57a6 Merge "Adding network_utils module from oslo-incubator" 2014-04-17 02:40:27 +00:00
Jenkins 306c5d20dc Merge "Sync with oslo-incubator" 2014-04-17 02:40:25 +00:00
wanghong 8619100597 progress flag not supported in v2 API
Currently only download method supports --progress flag in v2 API.
This patch let upload method in v2 API support this flag too.

Change-Id: I1d22379c320adb47a2178697e546413b9257f987
Closes-Bug: #1286265
2014-04-16 06:20:08 +00:00
Davanum Srinivas 078819cf9e Fix for invalid literal ValueError parsing ipv6 url(s)
Switch to using network_utils for splitting the URL. The code
in oslo-incubator supports ipv6 urls

Change-Id: I76be6173b97eb000319d30b4e9232a5a7c4a5aba
Closes-Bug: #1298137
2014-04-02 21:38:20 -04:00
Davanum Srinivas 58ee451286 Adding network_utils module from oslo-incubator
Needed for fixing bug 1298137

Change-Id: I6803f1af8b0ff036bed634c8aa1cffc52bc508e0
2014-04-02 21:36:10 -04:00
Davanum Srinivas ff0c87eeca Sync with oslo-incubator
Head of oslo-incubator is commit id:
2fd457bf2ccbeb2b84ffb204778b6417cd5405ba

includes a fix for gettextutil.Message handling of deep copy
failures and adding a license header

Change-Id: Ie89de1f95bb6fb9d11058413e682c441c39524f1
2014-04-02 21:30:22 -04:00
Eiichi Aikawa 5528ba536f Fix the parameter order of assertEqual in glanceclient v1 test
On assertEqual, the order of parameters should be (expected, observed).
But, some part of glanceclient v1 test were written with invalid order.
This patch fixes this problem.

Change-Id: If361309041a257c56bfc1fbbccf1b905839b0c18
Partially-bug: #1277104
2014-03-17 17:14:14 +09:00