49 Commits

Author SHA1 Message Date
Jenkins
7c68f6f6df Merge "cinderclient accepts arguments after metadata without -- separator" 2015-03-16 16:52:02 +00:00
rajiv
57c9bf17b3 cinderclient accepts arguments after metadata without -- separator
Added a function, which parse arguments and add -- separator
after metadata subcommand

Change-Id: I907eb89209d549dcdad361d88352491110eaadb9
Closes-Bug: #1379486
2015-03-10 09:45:00 +05:30
Kallebe Monteiro
d76387cc9f Add -d short option for --debug
A short option for --debug is a convenience.
This commit adds the -d short option as a shortcut for --debug

Glance already provides -d.

Change-Id: Iefae6cee566f9c7d7375e89c3f8603f149e555ef
Closes-Bug: #1421210
2015-02-12 10:52:17 -03:00
Vincent Hou
7a50182fbe Add the parameter bypass_url to the cinder client
If the bypass_url is specified in the http client, there is no need
to get it from Keystone.

Change-Id: I891849f77ad2ba98a83c993b401121216c8cfff6
closes-bug: #1350702
2014-12-01 02:43:52 +00:00
John Trowbridge
122bf5bdcc Adds tty password entry for cinderclient
Added functionality from keystoneclient to fallback to the tty for password
entry if no password is given via the environment or the --os-password option.

Change-Id: If5b27cb8c67712860faa24d543ed48eaa542f28b
Closes-Bug: 1357559
2014-10-24 15:43:04 +00:00
Boris Pavlovic
6f5fd37ee9 Add profiling support to cinderclient
To be able to create profiling traces for Cinder, client should be
able to send special HTTP header that contains trace info.

This patch is as well important to be able to make cross project
traces. (Typical case nova calls cinder via python client, if
profiler is initialized in nova, cinder client will add extra
header, that will be parsed by special osprofiler middleware in cinder
api)

Don't worry no security issue here, trace information is signed by HMAC
key that is setted in api-paste.ini. So only person that knows HMAC key
is able to send proper header.

Main patch (in Cinder) is:
https://review.openstack.org/#/c/103415/

Change-Id: I53bb1b92e62841a02f941bdafaed7f8ed5db7ce1
2014-10-08 19:30:10 +04:00
git-harry
36dd138aa6 Enables debug mode for keystone session object
This fixes the lack of debug messages introduced by commit 84af49c.

Change-Id: I7bf3e98c21f09bd4f3c2d5d3bc372f60d717c9d5
Closes-bug: #1370152
2014-09-18 17:14:19 +01:00
Jamie Lennox
b4acbd2586 Move debug logging to shell
Adding channels to a logger is not the responsibility of a library. This
sort of thing should be handled by an application so move the logging
over to the shell.

Change-Id: Ie11571d428913eba1aae5aa42a6e925228ba6808
2014-07-29 12:26:33 -06:00
Haneef Ali
b4906c855f Fix version discovery and auth_plugins
V3Client support added version discovery and session supports. Most
of the external auth system doesn't support this. This fix bypasses
version discovery if the idenity service doesn't support that. Session
is used only if  no external auth plugin is used

Change-Id: Ia84a2ad45940d35c5ef740727f5f7477c72ea9d4
Closes-Bug: #1333961
2014-07-01 09:22:06 -07:00
Matt Fischer
8d317c47dc Remove deprecated command-line args
Some command-line args were deprecated in Diablo and slated for removal
in Folsom. They're being removed in Juno instead.

Change-Id: I02339ba08c997fecca5a6639382360962e668bfd
2014-06-26 18:49:28 +00:00
haneef ali
e8e06ee289 Added support for keystone v3client
Change-Id: I7bbc74c9e73f36f942f5800a7af0da717da0bc64
2014-06-17 13:10:32 -07:00
Jenkins
12347c1a47 Merge "Ambiguous option error should not appear if Arg is SUPPRESS" 2014-05-08 19:21:36 +00:00
Diane Fleming
0d2bf657ae Update help strings for cinder client
Make text consistent and clear.
Add periods to end of sentences.
Adjust test suite for change

Closes-Bug: #1275881

Change-Id: I1dfde51636e8dc4b42e4c4810c27c1c4ac513d82
2014-04-23 09:06:21 -05:00
Juan Manuel Olle
2b182c7e34 Ambiguous option error should not appear if Arg is SUPPRESS
Due to backward compatibility there are arguments hidden.
For example:

--tenant-id and --tenant_id

On those case the abbreviation mechanism if a user enter
--tenant throw that there is an ambiguity but the helps only
show --tenant-id as an optional argument.
This change remove this ambiguity if one of them is hidden.

Change-Id: I413f1ebafc68b3e02b5abadce1608e6d48207b01
Closes-Bug: #1252457
2014-04-16 15:10:55 -03:00
Cory Stone
d5334aa929 Add auth_plugin support to cinderclient
With CINDER_RAX_AUTH being rightfully removed, cinderclient is no longer
compatible with Rackspace/any non-keystone auth. To fix this, I stole
auth_system/auth_plugin from novaclient's implementation.

See https://review.openstack.org/#/c/23820/.

Change-Id: If5f84003f868ef02bb7eb7da67cf62018602e8f0
Closes-Bug: 1280393
2014-02-14 15:09:44 -06:00
huangtianhua
5aaa68f09e Fix typo in cinderclient
sematics --> semantics
hypen-separated --> hyphen-separated
typicaly --> typically

Change-Id: I5df277ef7036082d0e4b079c23d41da809e5270f
Closes-Bug: #1254587
2013-11-28 09:28:05 +08:00
Jay S. Bryant
84ea630be0 Override endpoint URL check for API version
get_volume_api_version_from_endpoint currently assumes that the
management_url will always be in the format of
http://<ip>:<port>/vX/<tenant_id>. Customers using a gateway, however,
can get a mangement_url in a different form like
https://<ip>:<port>/<resource>/vX/<tenant_id>.  This causes the
get_volume_api_version_from_endpoint to find the resource portion of the
url when looking for the Volume API version which makes the
cinder client unusable.

To resolve this I have implemented an exception handler in the case that
get_volume_api_version_from_endpoint fails.  If the exception is thrown, I
check for OS_VOLUME_API_VERSION in the environment and use the value of that
environment variable, if it is set, to determine the API version to use.

There are proposals to fix this via changes to keystone in future releases,
but this provides a way for IaaS Gateway users to proceed with Havana.

Change-Id: I8b978a6ecd87b81c6ae34938e37623ad1cc33994
Closes-Bug: 1233311
2013-10-17 15:03:55 -05:00
Jenkins
0c2839414f Merge "python3: Refactor dict for python2/python3 compat" 2013-10-13 05:53:35 +00:00
Chuck Short
b0b8afaf55 python3: Refactor dict for python2/python3 compat
Python3 changed the behavior of dict.keys such that it is now
returns a dict_keys object, which is iterable but not indexable.
You can get the python2 result back with an explicit call to list.

Refactor list(*.keys()) so that it just uses list().

Change-Id: Ib2e9646ac967e9bd7cc4f47e2099f5d1358808a9
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-10-11 09:04:49 -04:00
Eric Harney
98e9df62ee Fix DeprecationWarning when printing exception
On Python 2.6, this results in an error like:
/usr/lib/python2.6/site-packages/cinderclient/shell.py:524:
DeprecationWarning: BaseException.message has been deprecated as of
Python 2.6
  message = e.message

Should use the method from novaclient commit 8c4e145b92, which
works well with python2 and python3.

Change-Id: Ifbd78ad158ae87670bdee4e247469091efaa3260
2013-10-09 17:31:49 -04:00
ZhiQiang Fan
5ad95e9fd2 Replace OpenStack LLC with OpenStack Foundation
NOTE:
* openstack/common/* should be synced from oslo, so i leave them
untouched.
* add (c) symbol for related lines, leave others untouched.

Change-Id: I46a87c7f248d3468b1fdf5661411962faf2fb875
Fixes-Bug: #1214176
2013-09-28 23:13:54 +08:00
Mike Perez
34c7c8c2e2 Add support for multiple cinder endpoints
Before v1 and v2 were set to the same service_type, so you could only
have one set at a time. This assumes the catalog is setup for v1
service_type 'volume' and v2 service_type 'volumev2'.

For backwards compatibility, we will allow v2 to be setup with
service_type 'volume' for existing installations.

Change-Id: Ife6d2cdb12d894b84ea3b276767fb93d487355d5
2013-08-08 11:07:36 -07:00
John Griffith
3d30126e93 Revert "Use exceptions from oslo"
This reverts commit a7cce08eab5e2e42275b84bd56127bd09b00f5bf

Change-Id: I6c0047adbc33d0d6b5890f11853974578c36c78c
2013-07-15 10:30:05 -06:00
Alessio Ababilov
a7cce08eab Use exceptions from oslo
These exceptions can be used in novaclient, keystoneclient,
glanceclient, and other client projects.

Partially implements: blueprint common-client-library

Change-Id: I43918316622b1c1d722872fe30199db6a3a7bb76
2013-07-01 11:55:31 +03:00
Jenkins
dcc2f67bee Merge "Connectivity between the endpoint version and OS_VOLUME_API_VERSION." 2013-06-25 16:29:09 +00:00
Anastasia Latynskaya
6adda93c9d Connectivity between the endpoint version and OS_VOLUME_API_VERSION.
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
2013-06-25 13:01:33 +00:00
Chuck Short
1197fb3701 python3: Strutils is not needed
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>
2013-06-22 12:50:23 -05:00
Chuck Short
3044671b36 python3: Fix traceback while running tests
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>
2013-06-19 20:52:22 -05:00
Chuck Short
4b1cdab2fe python3: Basic python3 compatibility.
Basic python3 compatibilty.

Change-Id: I4388f5956cf397f8e33d20085aae6c6a728dbbda
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-12 07:59:44 -05:00
Jenkins
e7cfd77ba3 Merge "Minor typo/message fixes" 2013-04-09 15:26:12 +00:00
Eric Harney
fd3351ffa8 Minor typo/message fixes
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
2013-04-08 17:11:16 -04:00
Jenkins
222f501d9f Merge "Add OS_TENANT_ID as authentication option" 2013-04-05 12:59:08 +00:00
Flaper Fesp
03a4806d97 Decodes input and encodes output
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
2013-03-29 13:50:48 +01:00
Liam Kelleher
f80509ff1a Add OS_TENANT_ID as authentication option
bug 1160898

Change-Id: I8849ab8f552801b8a317cd0394251c2db1ba8e9a
2013-03-27 16:14:39 +00:00
Eric Harney
36ba504d52 Catch KeyboardInterrupt
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
2013-03-20 13:10:34 -04:00
Mike Perez
636ec5eccd adding v2 support to cinderclient
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
2013-02-13 00:58:17 -08:00
Dirk Mueller
8cc89fdfe5 Avoid UnicodeEncodeError exception on exception
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
2013-02-06 17:26:44 +01:00
Frederic Lepied
33c897d87e Fixed documentation of the cinder shell command.
Updated README.rst and shell.rst to match changes
in the cinder command and novaclient README.rst.

Change-Id: Ifaa53d5c06e6d7d8e3d4d858672717954303bea7
Fixes: bug #1074125
2013-01-31 20:41:47 +01:00
Eric Harney
c74994597f Change Nova -> Cinder in credentials error message
Change-Id: I410360ca23388e93bcbbf3dce053cae99c84a431
2013-01-21 17:34:59 -05:00
Anita Kuno
fbddead1cb Fixed Version Functionality
In accordance with bug-1068521, cinder version functionality is available via the shell.

Change-Id: If9608291f318057fc8fa61151328d6503a79d70d
2013-01-17 17:50:15 +00:00
Dean Troyer
82e47d0866 Use requests module for HTTP/HTTPS
* 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
2012-12-18 13:58:05 -06:00
Dean Troyer
e30724df5b Bring back the output from client.http_log()
Ported from novaclient https://review.openstack.org/9241
Support CINDERCLIENT_DEBUG as synonym for --debug

Change-Id: Ic03b9e7d84c8db14f6e193ca2b478fd0d70d1299
2012-12-13 15:56:00 -06:00
Christian Berendt
79dc21d171 show help when calling without arguments
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
2012-11-08 23:33:14 +01:00
Cory Stone
112bd60d4e Add retries to cinderclient.
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
2012-11-07 11:11:54 -06:00
John Griffith
dcbebd7b78 Revert "Add retries to cinderclient."
This reverts commit 3b1eda3b3bb6678e9c9ec3e783e3e12b0c42f0a4
2012-11-02 22:17:03 +00:00
Cory Stone
3b1eda3b3b Add retries to cinderclient.
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
2012-11-01 14:42:09 -05:00
Dean Troyer
d7b09bd097 Change '_' to '-' in options
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
2012-08-23 14:40:09 -05:00
John Griffith
93f9fa75fa Set pep8 version to 1.1 in test_requires
* Fixes bug 1007520
* Changes in pep8 cause new failures

Change-Id: Ie678f01a5008b0df6ef43a360b599890cab40776
2012-06-15 13:56:39 -06:00
Jenkins
471704df64 Initial split from python-novaclient. 2012-05-21 16:32:35 -04:00