61 Commits

Author SHA1 Message Date
Jenkins
eaedc41ddd Merge "Don't use sessions if third party plugin is used" 2015-02-03 15:25:09 +00:00
Aaron Rosen
0b38d75a44 Leverage openstack.common.importutils import_class
This patch drops the import_class method from utils and instead
leverages the one in openstack.common.importutils.

Change-Id: I9f740b9941d477776597c4c4ab88a65a39fb4fb8
Closes-bug: 1365273
2015-01-12 22:58:00 +00:00
Jenkins
9c1ec1d19c Merge "Fix incorrect variable name" 2015-01-06 19:52:00 +00:00
Robert Myers
7783767f23 Don't use sessions if third party plugin is used
If an auth_plugin is used do not try to load the session
from the default keystone providers.

Change-Id: If2a87e23cabde006833de70e5c7aa066d95dbf50
Closes-Bug: #1380729
2014-12-09 11:41:27 -06:00
Jenkins
3398e424bf Merge "client HTTPClient __init__ fails if auth_url None" 2014-12-02 09:48:02 +00:00
Jenkins
b2b0489283 Merge "Use newer features from keystoneclient" 2014-12-02 01:16:14 +00: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
Jamie Lennox
a68ba9417b Use newer features from keystoneclient
There are a number of functions that were implemented in keystoneclient
in response to needs from cinder and other clients.

Now that these were released in 0.11 cinderclient should make use of
them rather than keep its own versions.

Change-Id: I6444fc5bfd2d0505f9a7eb2c6068ab945ae5bb9b
2014-12-01 02:16:44 +00:00
Jamie Lennox
384b8825b4 Fix incorrect variable name
valid_versions does not exist here, it is obviously supposed to mean
_VALID_VERSIONS.

Closes-Bug: #1386232
Change-Id: I477baa7642feba72f80d884d6183512185b02cf1
2014-10-27 14:41:54 +00:00
Christine Wang
a6b434ee05 cinderclient does not retry with TimeoutException
Added retry support when encounter requests.exceptions.Timeout
during HTTP request.

Closes-Bug: #1379505

Change-Id: I6253a109c3a76dd2f15c96a349da68936f9bfff4
2014-10-24 11:57:42 -04: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
Bill Arnold
f7d391e5cb client HTTPClient __init__ fails if auth_url None
The initializer for the python-cinderclient HTTPClient class
fails if passed a None for an auth_url.
This patch modifies the inializer to not call rstrip
if auth_url is None, matching the initalizers in
python-novaclient and python-neutronclient

Change-Id: I19dd6911816639a0e0d6175ba910e9777a4b5981
Closes-bug: #1358926
2014-09-09 18:40:31 +00:00
Jamie Lennox
84af49ce97 Use adapter from keystoneclient
The keystoneclient provides an adapter which maintains the client state
around the session. We should re-use this rather than copy it and it
also means we will get new adapter functions and parameters as they
become available.

Change-Id: I05c0d650dcdd69f7e77a06563d735efe521a41ae
2014-09-02 12:38:03 +10:00
Jenkins
c9e7818f3f Merge "Change "Connection refused" to "Connection error"" 2014-08-03 18:41:37 +00:00
Jenkins
d5c5bacb67 Merge "Mask passwords in client debug output" 2014-08-02 16:31:32 +00:00
Jay S. Bryant
80582f2b86 Mask passwords in client debug output
This change looks for the use of 'password' in the data that
is sent and uses mask_password() to remove the actual password
text.  This change will prevent debug output that is being
saved from saving passwords.

A test case is added to verify that password output is being removed.

Change-Id: I93bde838ea21101df08c0e824d9f9457ed2ad077
Closes-Bug: 1341735
2014-07-30 13:43:32 -05: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
Eric Harney
20060b102a Change "Connection refused" to "Connection error"
The python-requests documentation indicates that the
ConnectionError exception can be raised for reasons other than
"connection refused".  Let's just say "error" rather than
implying the wrong type of failure.

Change-Id: I2205e27c7c68164db430cdfdc71b57b3002b24be
2014-07-24 17:40:03 -04:00
Xu Chen
fd8aa39458 Retry when connection to cinder is refused
Currently, cinder client does not retry when connections to cinder
service is refused. There are many legitimate scenarios under which
retry should be attempted:
1) cinder service being restarted;
2) cinder service is running on multiple API nodes behind a LB, which
might be temporarily overwhelmed or being maintained.

In any scenario, retry with a backoff timer does not seem to hurt.

Change-Id: I3c290c59fa67262c4a3473815b4380ee39e24332
Closes-Bug: 1347843
2014-07-24 11:31:13 -04: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
Jenkins
9485337b0e Merge "Use region_name in service catalog" 2014-06-30 09:31:23 +00:00
haneef ali
e8e06ee289 Added support for keystone v3client
Change-Id: I7bbc74c9e73f36f942f5800a7af0da717da0bc64
2014-06-17 13:10:32 -07:00
Jenkins
338755aa17 Merge "Add auth_plugin support to cinderclient" 2014-04-17 17:20:40 +00:00
Jamie Lennox
58e2a2d7cd Use region_name in service catalog
Using attr and filter is no longer necessary. We provide a region_name
filter directly that works with both v2 and v3 service catalogs.

Change-Id: I67b50fcaa5e4df5c2bb7b2966b5ef2040e6286e7
2014-04-04 14:42:15 +10:00
Shao Kai Li
1b0ea8768c Import access module from keystoneclient to handle V3 endpoints
* service_catalog.py will be used only by nova(cinder.py), it will be removed if nova
uses access instead of service_catalog. Then service_catalog.py and
test_service_catalog.py will be removed from cinderclient if necessary.

* Some unit tests are modified.

* Because of JSON format's modification, functions that process cinder
credentials and cinder endpoints are changed.

* Add dependency for keystoneclient in requirements.txt.

Change-Id: Icf7badfdddcf5f55536d95db7242aff58aa34b6e
Closes-Bug: #1263876
bp: service-catalog
2014-03-03 01:16:26 -05: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
Swapnil Kulkarni
fbee97cf19 Remove RAX-specific auth in cinderclient
Change-Id: Idd36694a322f467ba5e8c1f58bfac701bff8f3f8
Closes-Bug: #966329
2014-01-25 08:22:13 +05:30
Jenkins
873bed99a8 Merge "Fix the failure of fetching the version in cinder endpoint" 2013-10-14 20:00:40 +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
jenny-shieh
f96dcd714e Fix the failure of fetching the version in cinder endpoint
To search for verion in cinder endpoint string, instead of using
hard code position

Implements: search for verion in cinder endpoint string
Closes-Bug: #1227307
Change-Id: Ie38806ad995e6fd49155f448abf9b2ef43f24a0e
2013-10-09 12:05:53 -05: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
Jenkins
2f5c937d4c Merge "Add timeout parameter in requests" 2013-08-14 06:49:45 +00:00
Christian Berendt
c95e59f510 convert third-party exception to ConnectionError
fixes bug #1207635

Change-Id: I37da522e812286e72706409b8a6d4652515f720f
2013-08-06 12:11:24 +02:00
Yaguang Tang
fd409626fa Add timeout parameter in requests
Fix bug #1207260

Change-Id: I0f57a9b27c2da2521adb6aebfe3fa072c6b56808
2013-08-01 18:26:01 +08: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
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
Jenkins
9ab7cdcef9 Merge "python3: Basic python3 compatibility." 2013-06-12 16:39:22 +00:00
Chuck Short
b4ea550ba7 python3: fix imports compatibility
Python3 reorganized the standard library and moved several functions
to different modules. Six provides a consistent interface
to them through the fake six.moves module.

However, the urlparse, urllib2, etc modules have been combined
into one module which Six does not support so do it the old
fashioned way.

Change-Id: Ieb7cc7ee2a4a97807873cfe2fc3fa0a5cf3c3980
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-12 08:32:19 -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
Dirk Mueller
7359c976d1 Start Gating on Pyflakes and Hacking
Instead of globally ignoring Pyflakes and Hacking
warnings, only blacklist those that occur frequently
and fix the others. Start gating on those checks.

Change-Id: Ice032c16d445ef08ef018bcdc5c221ab3c323755
2013-06-09 13:29:23 +02:00
Nicolas Simonds
2a446c5b6b Only add logging handlers if there currently aren't any
This corrects an odd problem where Horizon would stand up multiple
client objects, which would cause duplicate/triplicate/dozens of
repeated log lines in its log files, due to multiple identical
handlers being added to the logging object

Fixes Bug 1182678

Change-Id: I198f3ecbb687bff69a06a166574b998cce54f2ac
2013-05-21 16:19:38 -07:00
Chuck Short
2ed5cdcb5f Add license information.
Several files were missing the license issue, so simply
add them.

Change-Id: I866ec03096a72fe8ae7d776e2ffe040379ec5bc6
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-05-09 10:49:35 -05:00
Jenkins
c5f542fd5a Merge "Fix X-Auth_Token -> X-Auth-Token header name" 2013-04-07 10:37:24 +00:00
Eric Harney
5e4a985246 Remove unused "import sys"
Cleaning up with pyflakes.

Change-Id: I24878f1bb1693af13b2a7f0f7d6fe455f8747e91
2013-04-04 16:46:55 -04:00
Eric Harney
952970acbd Fix X-Auth_Token -> X-Auth-Token header name
Fixes bug 1163546

Change-Id: Idb2c5f23a1c57676984ffa33f64d27c461b0de15
2013-04-04 10:36:48 -04:00
Cory Stone
f2ac10f282 Debug output the http body
Output the kwargs[data] instead of kwargs[body] which was deleted.

Change-Id: I233e37cceb7079ec78b9bde093967dea9ad94441
Fixes: bug #1155655
2013-03-15 10:20:36 -05:00
Ollie Leahy
458ff24513 Fix typo breaking --debug option to cinder client
Fixes LP bug #1130730

Change-Id: Ia105e8a561b8d45c60e9a3c6ed46a953cc6df96f
2013-02-20 15:49:52 +00:00