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
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
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
* 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
THe patch updates the importutils module and uses a per-line module
specification instead of the old modules= options.
Change-Id: Ieb28780bb9034fd61942305ff1eec21b3637027a
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>
Lists, creates, deletes, updates image members using glance
v2 api.
Related to bp glance-api-v2-image-members
Change-Id: Ic018a265a1676bb0a5638a55e70a527ce6b447fc
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
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
Some mechanical translation of the deprecated
except x,y construct. Should work with Python >= 2.6
just fine
Change-Id: I394f9956b9e3e3d9f5f1e9ad50c35b13200af2a1
handles the case where an image-update command is issued from a cron job with an
invalid standard input file descriptor: consider no image data is provided when
no --file option present.
Change-Id: I5eb3433311e5faf0a3fb7eb36f6a01e5df7efe4c
copy_from was ignored which resulted in "glance add" attempting to read from
stdout.
Fixes bug 1167899
Change-Id: I57fd85f7bb655bef69222d4fdf6b8274088ca827
When running the image-list command the user should have the option
to list images according to whether or not the image is was set
to public. A new test is included to verify this behavior.
Change-Id: If645e7390fcf850648cda780a04ea37a26d855a2
Fixes bug: 1118799
Currently a KeyboardInterrupt can be triggered by the user while the
client is communicating with keystone. This patch moves the trap
higher up in the stack.
Fixes bug: 1157905
Change-Id: I16889c2d97bc4694ab27c863c62c27333e264b60
When a user attempts to terminate the CLI with CTL+C a stack
trace is printed to the screen. When downloading files the
partial amount downloaded will not be cleaned up. In most
cases the user redirects to stdout, thus this program cannot
clean that up.
Fixes Bug: 1130390
Change-Id: If9f8ffc72b422d5dbd5969eecde8904238dd8860
Errors in name resolution have been logged previously with the url path
rather than the hostname. That resulted in incorrect errors like:
InvalidEndpoint: Error finding address for
/v1/images/detail?is_public=none&limit=20: [Errno -2]
Name or service not known
rather than one mentioning hostname itself. This patch changes the log
message to fit the situation.
Change-Id: I1eecbcb22d41b1341c214937b9cbfd046fd301a0
Currently glanceclient doesn't support non-ASCII characters for images
names and properties (names and values as well). This patch introduces 2
functions (utils.py) that will help encoding and decoding strings in a
more "secure" way.
About the ensure_(str|unicode) functions:
They both try to use first the encoding used in stdin (or python's
default encoding if that's None) and fallback to utf-8 if those
encodings fail to decode a given text.
About the changes in glanceclient:
The major change is that all inputs will be decoded and will kept as
such inside the client's functions and will then be encoded before
being printed / sent out the client.
There are other small changes, all related to encoding to str,
around in order to avoid fails during some conversions. i.e: quoting
url encoded parameters.
Fixes bug: 1061150
Change-Id: I5c3ea93a716edfe284d19f6291d4e36028f91eb2
When using 'insecure' no callback is executed.
Make it more obvious that the set_verify callback
won't be called by replacing it with a lambda.
Fixes bug 1112361.
Change-Id: Ib5d43a8883f7ed76383971d8154e2111f5ab2869
If the image id contains a space it needs to be quoted or else
it will construct an improper header.
Fixes bug 1111948
Change-Id: I4db2e74401b57de9666d40b38151182b2a76cd1b
The image-update help page reversed the DISK_FORMAT
and CONTAINER_FORMAT metavars.
Fixes bug #1111054
Change-Id: Iec8374782d00e8e9102141fb1e1c16d7f6ac136c
VerifiedHTTPSConnection inherits from HTTPSConnection so 'port' should be
an optional argument. If not present it will be set by HTTPSConnection
in the usual way: by parsing the host string (eg 'localhost:8443')
or setting to the default of '443'.
Addresses bug 1102944.
Change-Id: I2c2cb92f824acf15b0ff54590b5614cf206b57e0
Now a user should specify ID as an image by glance command, and I feel
it is easy-use that a user can specify name also as an image like nova
command(ex. "nova boot").
By applying this patch, a user can specify name as image like the
following examples:
$ glance image-show cirros-0.3.0-x86_64-uec
$ glance image-update --name root-fs cirros-0.3.0-x86_64-uec
$ glance image-delete cirros-0.3.0-x86_64-uec
$ glance image-download cirros-0.3.0-x86_64-uec
$ glance member-create cirros-0.3.0-x86_64-uec 94b0e63a27ca43348fe056622fe3fe94
$ glance member-delete cirros-0.3.0-x86_64-uec 94b0e63a27ca43348fe056622fe3fe94
Fixes bug 1093380
Change-Id: Ia0a070eed6ae3853ef02032f479087edb1d75a67
Current glance command does not show the details of error message.
For example, the glance command shows HTTPBadRequest only if some
necessary parameter is not specified.
$ glance image-create --file root-fs.img --name cirros-0.3.0-x86_64-uec
Request returned failure status.
HTTPBadRequest (HTTP 400)
$
By only the above message, it is not easy that a user understand the reason
of an error. glance-api server returns the details of reason, but glance
command does not show it.
This patch adds details, which is gotten from glance-api server, to error
message. And a user will be able to understand the reason of a error like
the following:
$ glance image-create --file root-fs.img --name cirros-0.3.0-x86_64-uec
Request returned failure status.
400 Bad Request
Invalid disk format 'None' for image.
(HTTP 400)
$
Fixes bug 1094917
Change-Id: I49192c3ebbc8a70b63dcfcede9fd13f1688388cf
* Rename --ca-file to --os-cacert (--ca-file deprecated for
backward compatibility)
* Add cacert to keystoneclient initialization to verify the
keystone server certificate
This aligns glanceclient with keystoneclient for option naming
and the use of TLS for the keystone auth connection. It does not
change the use of TLS/SSL for the glance connection.
Change-Id: If8b05655aea5f3c62612d77bf947dd790f77eddf