Commit Graph

307 Commits

Author SHA1 Message Date
Flaper Fesp fd0e117579 Encode error messages before sending them to stdout
When an error with non-ascii characters is caught by glanceclient, it
fails at printing it and exists with a UnicodeEncodedError. This patch
encodes errors' messages using strutils before sending them to stdout.

Fixes bug: #1200206

Change-Id: I4dabcd76ffb258840bd6a66ad23c030f34960e86
2013-07-29 09:30:44 +02:00
Jenkins 8d7411d78b Merge "HTTPS response issues" 2013-07-24 22:11:08 +00:00
Jenkins 49a1207266 Merge "Fix SSL certificate CNAME checking" 2013-07-22 21:50:07 +00:00
David Peraza 5d90740f33 HTTPS response issues
Fixes bug 1179392

glanceclient.common.http.HTTPClient.get_connection_kwargs method
explicitly sets the timeout to be a float, while struc.pack is
still using LL as the format string which means 2 Long Integers.
Setting format string to fL which mean a float followed by Long
Integer.

Also, Bad file descriptor error is caused by socket being closed
to soon. Added a close() implementation to VerifiedHTTPSConnection
which will remove reference to socket before returning call to
base HTTPConnection.close(). This will avoid socket to be closed
before response body is read. Socket will close when response
close is called.

Change-Id: I3a973da3b962c7572ae0f61f6996bdd1f0048339
2013-07-22 15:33:38 +00:00
Jenkins 093064caa8 Merge "Increase default page_size value" 2013-07-19 09:45:42 +00:00
Jenkins 46ce865506 Merge "Pass all identity headers received to glance" 2013-07-18 17:45:33 +00:00
Jenkins eb6ed51647 Merge "Expose checksum index image property in client" 2013-07-17 19:00:48 +00:00
Jared Culp 02116565d3 Increase default page_size value
This is a temporary solution. Increasing the default page size (which is being
used everytime, since the client is ignoring nova's --limit param). This should
decrease the number of queries that glance does when nova requests an image
detail list.

Bug 1200257

Change-Id: I7ed4521698570cbae9c20e69ddca8b11b57c65ad
2013-07-16 11:46:47 -04:00
iccha.sethi 95810ef1d2 Pass all identity headers received to glance
There is an upcoming patch in nova which passes identity
headers to glance client. We want to ensure that these get
passed to glance, which in turn with help the no auth
option in glance.

Resolves bug 1200761

Change-Id: Ifbef582aa4e64a2e7a46db43a9cc6cf8c3531dbd
2013-07-15 14:20:37 +00:00
Thomas Leaman 822cd64c07 Fix SSL certificate CNAME checking
Currently, accessing a host via ip address will pass SSL verification;
the CNAME is not checked as intended as part of verify_callback.

'preverify_ok is True' will always return false (int/bool comparison).
preverify_ok will be 1 if preverification has passed.

Fixes bug 1192229

Change-Id: Ib651548ab4289295a9b92ee039b2aff2d08aba5f
2013-07-15 08:50:17 +00:00
Sean Dague 29270bb853 uncap python-keystoneclient version requirement
if any of the projects specify a capped client, it has the
potential for preventing that client from being tested in the
gate. To fix this we have to uncap maximum versions of all
openstack client code in all openstack projects.

Fixes bug #1200214

Change-Id: I664d2f030972a3bbb08ae1c4b1710816b54b44b2
2013-07-12 19:53:46 -04:00
amalaba 09b29aac12 Expose checksum index image property in client
Implement checksum image index property in the python-glanceclient

Change-Id: If1426b7938457014ef27a86d3902d53854161627
Implements: blueprint index-using-checksum-image-property
2013-07-12 15:05:26 +05:30
Jenkins 8427208015 Merge "Rename invalid domain name to be RFC compliant." 2013-07-08 16:16:21 +00:00
Alex Meade aa2ff9a2b7 Flake8 should ignore build folder
This adds 'build' to the exclude list for flake8

Fixes bug 1198329

Change-Id: Ia662f93db6c86c0aedfbc44632a56cd8667df469
2013-07-05 17:05:49 -04:00
Venkatesh Sampath b9c1df8dfc Enable client V2 to update/delete tags for a given image.
Added the CLI option image-tag-update to associate a tag to an image via API V2.
Added the CLI option image-tag-delete to delete a tag associated with an image via API V2.

Related to bp glance-client-v2

Change-Id: I76060e1982223770a6c2c0bd9376d568af0df456
2013-07-02 21:32:49 +05:30
Monty Taylor bd0880cc94 Rename invalid domain name to be RFC compliant.
http://tools.ietf.org/html/rfc6761 and
http://tools.ietf.org/html/rfc2606 define invalid domain names to
be used in contexts such as this. It's good to be compliant with RFCs.

Change-Id: Ibb7f9ee12c0c4331f8a33470def74c3a136ef6d9
2013-06-30 23:33:07 -04:00
Dirk Mueller 62579fbb21 Start using Pyflakes and Hacking
Instead of globally ignoring pyflakes and
hacking warnings, only blacklist those that trigger
very frequently so far, in order to clean them
up in followup commits. Fix and start gating
on the rest already.

Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
2013-06-22 16:00:26 +02:00
Kevin McDonald d8a537c7fe Removes extra slash on endpoints without a path
Change-Id: I5ce54117c5ac276fb9629c71eb16db88e078c947
Fixes: bug #1179984
2013-06-19 15:49:05 +00:00
Jenkins c120aff87f Merge "Fix problem where image data is not read from a pipe." 2013-06-18 12:47:31 +00:00
Monty Taylor 2c84b58a3d Remove explicit distribute depend.
Causes issues with the recent re-merge with setuptools. Advice from
upstream is to stop doing explicit depends.

Change-Id: I75916a4fe2f7cf2eb8db2187c03895438aa58efd
2013-06-11 11:29:06 -07:00
Jenkins a7bc8fe9f6 Merge "python3: Introduce py33 to tox.ini" 2013-06-11 00:27:17 +00:00
Jenkins 34d6c2f4dd Merge "Replace utils.ensure_(str|unicode) with strutils.safe(decode|encode)" 2013-06-06 07:28:08 +00:00
Jenkins 554f938dce Merge "Do not decode headers in v1/images.py" 2013-06-05 23:09:07 +00:00
Jenkins e796c1be9e Merge "Add tests for encodings" 2013-06-05 04:23:49 +00:00
Jenkins 03f1286940 Merge "Rename requires files to standard names." 2013-06-03 23:32:41 +00:00
Flaper Fesp 7818387d4a Replace utils.ensure_(str|unicode) with strutils.safe(decode|encode)
Glanceclient implemented both functions before they landed into oslo.
Since both functions are already in oslo, it is now possible to pull
them in.

There's a small difference between glance's implementation and oslo's,
that is the later does not convert non-str objects - int, bool - to str
before trying to decode / encode them. This patch takes care of that
where necessary, more precisely, while encoding headers before doing a
new request.

Fixes bug: #1172253

Change-Id: I9a0dca31140bae28d8ec6aede515c5bb852b701b
2013-06-04 00:42:32 +02:00
Flaper Fesp 7daa976d14 Do not decode headers in v1/images.py
v1.images._image_meta_to_headers currently encodes headers as a way to
ensure they're an instance of basestring. This is not necessary since
headers will be encoded later during the request. Also, all data within
the client should be already decoded.

Fixes bug: #1187013

Change-Id: I80525adbc6e9e576cfad5b576090ef9ee574c1cf
2013-06-04 00:41:24 +02:00
Hugh Saunders 9fda0dc815 Fix problem where image data is not read from a pipe.
For image-updae and image-create commands, glanceclient attempts to
determine whether image data should be uploaded based on the presence
of data on stdin. Unforunately it is difficult to determine if data is
available, especially when standard in is from a pipe.

This is especially problematic for update operations, where data must
only be uploaded if the image is in queued state. For example data may
be uploaded when the user only wants to rename an image, but the rename
will be rejected because data cannot be uploaded to an unqueued image.

This patch removes the check that attempts to determine if data is
available to read as it didn't work for pipes. It also re-introduces a
check for image state in the update operation, so that glanceclient only
attempts to read data if the image being updated is in queued state.

The image state check is part of the original patchset that was removed
so the patchset could have a single focus [1]

This patch also removes a test for handling empty stdin, and adds a test
for reading stdin from a pipe.

[1] https://review.openstack.org/#/c/27536/3/glanceclient/v1/shell.py

Fixes: bug 1184566
Related to: bug 1173044

Change-Id: I8d37f6412a0bf9ca21cbd75cde6a4d5a174e5545
2013-06-03 18:01:58 +01:00
Flaper Fesp 81e88344fb Add tests for encodings
The patch adds tests for headers encodings, incoming data decoding,
outgoing meta encoding and filters encoding.

Fixes bug: #1187013

Change-Id: I7e59bf6c44b9d188bd3faf32fc09f309f3ad67d3
2013-06-03 17:40:50 +02:00
Chuck Short b586957e1c python3: Introduce py33 to tox.ini
Introduce py33 to tox.ini to make testing with
python3 easier.

Change-Id: I11801a5b3fd736d8e647a8a7152e498f505108f6
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-01 19:57:47 -05:00
Jenkins 7d48783434 Merge "Update importutils and openstack-common.conf format" 2013-05-31 08:05:25 +00:00
Zhenguo Niu 40460cbeb1 Rename requires files to standard names.
Rename tools/pip-requires to requirements.txt and tools/test-requires
to test-requirements.txt. These are standard files, and tools in the
general world are growing intelligence about them.

Change-Id: Ic220b54de5ce7c15f442b8ffcb97cd03c2344f9a
Fixes: bug #1179008
2013-05-29 17:26:33 +08:00
Hugh Saunders a3585ef62d Don't attempt to read stdin if it is empty.
* Check for available data size in v1/shell.py/_set_data_field, don't
   read if 0.
 * Add test_shell.py including tests for 3x stdin scenarios:
	* closed
 	* open and empty
	* open with data

Change-Id: I6ff65b0e226be509de9cd3f021560081529283b0
Fixes: bug #1173044
2013-05-23 13:37:09 +01:00
Flaper Fesp 9e515245a3 Update importutils and openstack-common.conf format
THe patch updates the importutils module and uses a per-line module
specification instead of the old modules= options.

Change-Id: Ieb28780bb9034fd61942305ff1eec21b3637027a
2013-05-23 11:11:56 +02:00
Jenkins 2a56a32edb Merge "Migrate to pbr." 2013-05-22 23:40:31 +00:00
Jenkins 52418e5dd1 Merge "Migrate to flake8." 2013-05-22 23:40:28 +00:00
Jenkins 985c06bea1 Merge "Improve unit tests for python-glanceclient.glanceclient.common.base" 2013-05-22 23:40:25 +00:00
Zhi Yan Liu 8c70c5b08d Convert non-ascii characters within image property to unicode
Convert non-ascii characters within image property (key/value pair) to
unicode but utf-8 to prevent provisioning failure when cloud using qpid
backend.
This change also make the image property encoding consistency between
the image updating and the receiving. Before this, image property
updating use unicode, but receiving (get) result is utf-8.

Fixes: Bug #1180377

Change-Id: I010760c598a7e008c79f1240255708265352cdb5
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
2013-05-21 00:03:31 +08:00
Monty Taylor 4f9d4d051a Migrate to pbr.
Fixes bug 1179007.

Change-Id: I99d571bbf37ef53366a96de088c249cb6fd23b0e
2013-05-18 09:02:07 -07:00
Monty Taylor ca17541f33 Migrate to flake8.
Fixes bug 1172444.

Change-Id: Icec0820d0f780ed9473218b7e46e29c1e3db6541
2013-05-18 08:29:02 -07:00
Tatyana Leontovich 8451a94822 Add test for glanceclient shells
Add unittests for the following modules:
* glanceclient.shell
* glanceclient.v1.shell
* glanceclient.v1.legacy_shell
* glanceclient.v2.shell
Also add mock library to the tools/test-requires

Implements: blueprint glanceclient-shells-unittests
Change-Id: I5ec527c5efff3726932d234d7c67e08149643f89
2013-05-17 19:46:07 +03:00
Tatyana Leontovich ab36778ec3 Improve unit tests for python-glanceclient.glanceclient.common.base
Add several tests for glanceclient.common.base module

Fixes: bug #1144158
Change-Id: Ifc288075c79849ee1384f09f513874ee08cd0248
2013-05-15 17:59:43 +03:00
Jenkins de5f2eea02 Merge "Image Members for glance v2 api" 2013-05-10 17:07:43 +00:00
Jenkins 03a49e2da9 Merge "Expand HACKING with commit message guidelines" 2013-05-09 21:19:38 +00:00
iccha-sethi 18795f590a Image Members for glance v2 api
Lists, creates, deletes, updates image members using glance
v2 api.

Related to bp glance-api-v2-image-members

Change-Id: Ic018a265a1676bb0a5638a55e70a527ce6b447fc
2013-05-09 10:54:12 +00:00
Andy McCrae a3223b9972 Fix inconsistent --debug messages on image-update
image-update --debug message no longer adds '-d "None"' to the curl command that
is output. This keeps the curl output consistent with the client
request.

Fixes bug #1172702

Change-Id: I34ceeb6f4a67c753ca3a805ec11240a99ce38ec4
2013-04-27 13:48:57 +01:00
Alex Meade e750e9b0ed Expand HACKING with commit message guidelines
Add a 'Commit Messages' section to HACKING describing how a commit
message should be formed.

Change-Id: Ife0d6eab18cc0f07ad8e8c79cb2e4198513236d2
2013-04-26 15:26:14 -04:00
Jenkins addd3c3be3 Merge "Prevent WantReadError when using https" 2013-04-24 19:07:03 +00:00
Jenkins 4bbc7b8a9b Merge "Improve Python 3.x compatibility" 2013-04-24 16:38:25 +00:00
Stuart McLaren 2f33f5f283 Prevent WantReadError when using https
If the glance client is instantiated when the socket module has been
monkey patched requests to the server can yield a WantReadError because
the socket has been set to non-blocking but this is not being handled
correctly. When this is the case use eventlet's GreenConnection which
handles non-blocking sockets correctly.

Also, for now, add a required getsockopt method to GreenConnection.
This can be removed once the eventlet fix
(https://bitbucket.org/eventlet/eventlet/commits/609f230) lands.

Fixes bug 1157864.

Change-Id: I187b69f75b8bcfe16facd41e69b1cd0490dae605
2013-04-23 13:48:10 +00:00