Adds functionality which allows user to work with
that cinder API version which is the same as
the endpoint version.
Fixes: bug #1169455
Change-Id: I9bb46e602d15856d2da502a6ac2b6c25e76f4fa3
strutils is used to safely encode and decode unicode strings
for python2.7. Since unicode strings are the default in python3,
ignore the use of strutils when running with python3.
Change-Id: I9a8e296b4f2153b1ef4302a7dcd797fbb4561c35
Signed-off-by: Chuck Short <chuck.short@canonical.com>
The testsuite is full of the following:
TypeError: 'dict_keys' object does not support indexing
This is due to the fact in python3 dict methods dict.keys(),
dict.items() and dict.values() return “views” instead of lists.
Change-Id: Ifa5383e6485fdbabf363fd1442877b2452346c1c
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Correct it's -> its in force-delete message
Print whole bash_completion message in "cinder help"
Reformat some doc strings per PEP-0257
Change-Id: I013b849508beac5c9fe5c6f9d4cdfae54676c29c
Currently cinderclient doesn't handle properly incoming and outgoing
encode / decode process. As a solution for this, this patch implements a
decoding process for all data incoming from the user side and encodes
everything going out of the client, i.e: http requests, prints, etc.
This patch introduces a new module (strutils.py) taken from
oslo-incubator in order to use 2 of the functions present in it:
About safe_(decode|encode):
Both functions try to encode / decode the incoming text using the
stdin encoding, fallback to python's default encoding if that
returns None or to UTF-8 as the last option.
In both functions only basestring objects are accepted and they both
raise TypeError if an object of another type is passed.
About the general cinderclient changes:
In order to better support non-ASCII characters, it is a good
practice to use unicode interanlly and encode everything that has to
go out. This patch aims to do that and introduces this behaviour in
the client.
Testing:
A good test (besides using tox) is to use cinder client with and
without setting any locale (export LANG=).
Fixes bug: 1130572
Change-Id: Idb7d06954c29e003f68a0c4aa0b80ecc7017cbc9
When a user Ctrl-C's the client, this will cause a short message to
be printed rather than an ugly backtrace.
This will not catch all instances of this (can still Ctrl-C before
reaching this code, etc.), but it should catch most of them, and those
for long-running sessions.
The specific message was chosen to match one recently added to the
glance client.
Change-Id: Ib748835ad1f94fb901b4941dc5e3797b719e197f
This will allow the cinderclient to speak to the v2 rest api if it's
enabled in the cinder config. Includes additional v2 tests as well.
blueprint cinderclient-v2-support
Change-Id: I004134d9f528a6eadefdaa89eb48087bcae2691f
When an exception message contained a non-ascii
character, the str() conversion raised an UnicodeEncodeError.
Avoid this by simply passing the message itself.
Python handles the encoding to locale already.
Change-Id: I3c4440fc238d8c8136a9bd93a0040668f82bda6e
Updated README.rst and shell.rst to match changes
in the cinder command and novaclient README.rst.
Change-Id: Ifaa53d5c06e6d7d8e3d4d858672717954303bea7
Fixes: bug #1074125
* Implement correct certificate verification
* Add --os-cacert
* Rework tests for requests
Pinned requests module to < 1.0 as 1.0.2 is now current in pipi
as of 17Dec2012.
Blueprint: tls-verify
Change-Id: I71066ff7297f3b70c08b7ae1c8ae8b6a1b82bbae
Ported from novaclient https://review.openstack.org/9241
Support CINDERCLIENT_DEBUG as synonym for --debug
Change-Id: Ic03b9e7d84c8db14f6e193ca2b478fd0d70d1299
When calling cinder without arguments you'll receive the following
output:
error: too few arguments
Try 'cinder help ' for more information.
With this change the help is also shown when calling cinder
without arguments. I think that's the expected behavior.
Change-Id: I8f46f67b7fef472ac344bb74f80cf1b77c4c4745
HTTPClient now supports a retries argument. It will reissue requests
for any 5xx or socket (400 with n/a) errors. This retry loop was
"inspired" by swiftclient's loop. It reauths one extra time if
necessary. It uses backoff times of 1, 2, 4... seconds.
The default is 0 retries. It is also exposed to the shell as well with
a --retries arg.
Change-Id: I67bed02d65155f4a4d5d879bb233f56cc78849fa
HTTPClient now supports a retries argument. It will reissue requests
for any 5xx or socket (400 with n/a) errors. This retry loop was
"inspired" by swiftclient's loop. It reauths one time if necessary.
It uses backoff times of 1, 2, 4... seconds.
The default is 0 retries. It is also exposed to the shell as well with
a --retries arg.
Change-Id: I75d9a13d6c4ba16a5da13d4bf5cad78a777d67d7
This changes every command-line option with a '_' in its name
and changes them to '-'. The old option names are maintained
for backward compatibility but are no longer in the help text.
BP command-options
Change-Id: If926bb3b8fa85d628aea197496cf976f71bcdd08