36 Commits

Author SHA1 Message Date
Takashi Kajinami
00cdc83150 Drop unused simplejson
simplejson is used only when the json module is not avaialble, but
recent runtime versions provide the built-in json module.

Change-Id: Ife04be18ed3804a90e52025d3a7f688e6daec849
2023-11-05 18:30:02 +09:00
Takashi Kajinami
1941116aad Drop implementation to keep compatibility with Python 2.5
... because this library no longer supports such old python runtime.

Change-Id: Id662d6d68cac940f6d0f61ab49653e7642b3e190
2023-11-05 18:26:07 +09:00
wangzihao
17d2d5175e Remove six
Remove all usages of six.

Change-Id: I6ea8d1cdc3060d5c2a4311c7454b66ba75109b0c
2020-10-13 11:02:06 +08:00
Hervé Beraud
e2bf7cff22 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I73b532283079d346b75a925e2aee707c4de8fa9e
2020-06-02 20:54:04 +02:00
Gábor Antal
ccceffa7f5 Handle log message interpolation by the logger
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

Also, upgraded hacking requirement, to enable H904 check.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Co-Authored-By: jiansong <jian.song@easystack.cn>
Change-Id: I3f020b6bcb1b9bf6d18a3b4f738c13cccd1bbff8
Closes-Bug: #1596829
2017-03-08 10:00:34 -08:00
Steve Martinelli
eed19c835f move old apiclient code out of openstack/common
As part of the first community-wide goal [1], teams were asked
to remove the openstack/common package of their projects
if one existed. This was a byproduct of the old oslo-incubator
form of syncing common functionality.

The package, apiclient, was moved to a top level location
and cliutils was moved to the common module. There are no oslo
specific libraries, the recommended solution is to move it
in tree and maintain it there.

Specifically in this patch, I also rearranged some of the
imports to make them match up with the hacking guidelines
while I was re-ordering them for the refactor anyway.

Lastly, the apiclient/fake_client.py was deleted since it
was not used.

[1] http://governance.openstack.org/goals/ocata/remove-incubated-oslo-code.html

Change-Id: Ib7b691240b819c9c91b100ca47ffaba75b281c78
2016-11-10 10:02:08 -05:00
jiansong
4dc495e948 Delete unnessary as e
It seems that this as e is not used,so we can delete it

Change-Id: Ia1ff3854943478d502ebae1daf3af84f43c6cd79
2016-09-22 21:54:44 -07:00
Steve Martinelli
fff88e0a9c switch to keystoneauth
move troveclient to keystoneauth as keystoneclient's auth session,
plugins and adapter code has been deprecated.

Change-Id: I3d57dde9c013038accbab8cc30d9622a142d0f71
2016-05-22 22:06:51 -04:00
LiuNanke
8ed42da06b Keep py3.X compatibility for urllib
Use six.moves.urllib.parse instead of urllib

Change-Id: Ia728005ee0af307a7df042f23f0276f922926465
Closes-Bug: #1280105
2016-01-14 02:36:30 +08:00
Sushil Kumar
ad68fb2897 Fixes the non-existent exception NoTokenLookupException
Found that troveclient.client raises a non-existent exception,
resolved the same.

Change-Id: I678cf6c1d82aca07fc950032bc6d5de55f8f52b8
Closes-Bug: #1454783
2015-06-03 08:31:26 +00:00
Doug Hellmann
8612fd048d Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: I2a8caa859830b3416bfe54e4261dd3415ac5a76a
2015-05-06 19:45:44 +00:00
Mayuri Ganguly
9f1466372e Fixed issues while using --bypass-url
Python-troveclient 1.0.8 introduced a regression where the usage
of --bypass-url results in an AuthSystemNotFound exception.
Removing some redundant code, which was due to a previous merge
conflict, fixed the issue.

Closes-bug 1416120

Change-Id: I1c949f69ee08447ce88aeefa92c60f361ab54832
2015-03-05 10:53:52 -08:00
Jenkins
51aa1a8dbd Merge "Pass all kwargs through to adapter" 2015-02-15 23:25:50 +00:00
Amrith Kumar
dca7bfe1e6
Handle obsolete and unused oslo modules
The python-troveclient module still had references to strutils, and
gettextutils which are now obsolete.

Change-Id: Ia54a565c00966b0a1cb5f18c6e17e1237b2bfee6
Partial-Bug: #1380789
2015-01-23 07:49:23 -05:00
Jamie Lennox
2322d30706 Pass all kwargs through to adapter
Part of the benefit of clients using the keystoneclient adapter to
manage the session object is that we can have a standard set of kwargs
that can be controlled from the adapter. This only works if the unknown
kwargs are passed through to the adapter.

Change-Id: I78f195ef739dbfe33a08f4dc1922b14ec77ae833
2015-01-16 15:26:59 +10:00
Jenkins
06dd75c8d4 Merge "Remove RAX-specific auth in troveclient" 2014-12-10 21:07:02 +00:00
Zhi Yan Liu
1cd9228647 Add profiling support to Trove client
To be able to create profiling traces for Trove, 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 horizon calls Trove via python client, if
profiler is initialized, Trove client will add extra header, that
will be parsed by special osprofiler middleware in Trove 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 Trove is: I580cce8d2b3c4ec9ce625ac09de6f14e1249f6f5

We prepared a common BP in oslo-spec due to integration change is
similar to all projects: I95dccdc9f274661767d2659c18b96da169891f30
Currently there are 2 other projects are using osprofiler: Glance &
Cinder, and some others are working in progress.

Change-Id: I5a76e11d428c63d33f6d2c2021426090ebf8340c
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
2014-12-10 03:41:18 +08:00
Swapnil Kulkarni
cd58da5213 Remove RAX-specific auth in troveclient
Author: Swapnil Kulkarni <swapnilkulkarni2608@gmail.com>
Co-Authored-By: Nikhil Manchanda <SlickNik@gmail.com>
Co-Authored-By: Craig Vyvial <cp16net@gmail.com>

Change-Id: I250777890a1f5240c5f14290cf02eb5a7b34b434
Closes-Bug: #966329
2014-12-09 13:33:33 -06:00
Bob Thyne
4f1fb53ecb Adds support for Keystone V3 API
Updated trove client to support Keystone V3 API. The
Keystoneclient session object is used for authentication, retrieving
the service catalog and HTTP connection/session management.

Added additional CLI parameters for Keystone V3.

Added tests using requests_mock instead of mocking completely the
session object like the previous failed patch:

https://review.openstack.org/#/c/102315

Change-Id: Ib804c0a45b3b4d3f8670ec642b2c2fd1be6cd656
2014-12-01 15:58:36 -08:00
Amrith Kumar
d4c2887854 Reverse fix for 1323866 as it regressed trove CLI
Trove CLI appears to be broken (fresh checkout, devstack as well as
openstack gate). All commands fail with

ERROR: __init__() got an unexpected keyword argument 'http_log_debug'

Correcting the obvious place where this appears to be an issue is
causing additional failures and as it is time-critical to get this
back up and running, I'm proposing a reversal of the change from
3c47a1855b7ee1345dadfb00ae90a6279b7c424e while that change is
completely reworked.

I will ping trove core for an approval on this and if I don't get an
approval, I'll fast track this reversal.

Change-Id: Icac028cfafac57c7e3ef03d4277ae2b7833bf58f
Partial-Bug: 1391840
2014-11-10 12:25:29 -05:00
daniel-a-nguyen
3c47a1855b Adds support for Keystone V3 API
Updated trove client to support Keystone V3 API. The
Keystoneclient session object is used for authentication, retrieving
the service catalog and HTTP connection/session management.

Added additional CLI parameters for Keystone V3.

Change-Id: I800c252234be2ff11d818cf7513c61c5431eb15c
Closes-Bug: 1323866
2014-11-05 15:54:16 -08:00
Sushil Kumar
8bc695bd70 Enabled F821, H306, H402, and H404 flake8 rule
Reasons:
- F821 is disabled.
- H306 is disabled.
- H402 is disabled.
- H404 is disabled.

Changes:
- Updates tox.ini to enable F821, H306, H402 and H404 rules.
- Updates code for F821, H306, H402 and H404 violation.

Change-Id: I772270bb833ac774e080fc63e330d6b333f23de2
2014-05-09 08:54:39 +00:00
He Yongli
59ec2bb433 Remove vim header
No need to set tabstop tons of times, this can be set in your vimrc
file instead.

More disucssion:
http://openstack.10931.n7.nabble.com/Remove-vim-modelines-td21780.html

Change-Id: I45766d91f0c0b3622bbdc7dc5517497c87ebee8c
Closes-Bug: #1229324
2014-02-16 13:08:07 +08:00
Craig Vyvial
8bc981aba5 adds support for configurations management
Reason:
Adding configuration group support for the python-troveclient

Changes:
adding configuration api calls
adding the compat client for tests and xml
added the shell cmds for the configurations in the client
made the path to datastore/version/parameters
added unit tests

partially implements blueprint configuration-management

Change-Id: Ifc0b4077c93a805898b4cd157e33172f64e85b55
2014-02-05 16:34:27 -06:00
Nilakhya
1fe0e4ee60 Fixes troveclient raising undefined exception ConnectionError
Reason: ConnectionError exception is raised which is not defined in
        python-troveclient/troveclient/openstack/common/apiclient/exceptions.py

Change: ConnectionError should be renamed to ConnectionRefused.

Closes-Bug: #1240950

Change-Id: I73219d29efd71185cdf6ff56a7fe41165541681f
2014-01-30 22:52:18 +05:30
Denis Makogon
69c865695f Ignore fewer PEP8/flake8 rules
Reasons:
- code should be pythonicaly clean,
  that is why number of ignored rules should reduced

Changes:
- E125, F811, H102, H103, F201, H23,
  H302, F841, H301, H702, H703 rules are now enabled

Change-Id: Ibf4025162244d3c2f1278b49a76ec1527a729042
2013-12-10 18:49:20 +02:00
Debasish Chowdhury
9c7120959e Removes unused import statements
Change-Id: If229aa3f6e1009e1abfba13aba3970bdf2dd3761
closes-bug: #1255885
2013-11-30 18:52:19 +05:30
Jenkins
00507ae54f Merge "Add --bypass-url option to trove client" 2013-10-25 19:52:20 +00:00
Michael Basnight
af4d4ed4f7 Fixing copyright and license headers
* Added HP copyrights as appropriate

Change-Id: If4f30b0caf03b16f5fb4f54185ba80d9fa41d0b0
2013-10-22 11:21:33 -07:00
daniel-a-nguyen
e9c5eddc51 Add --bypass-url option to trove client
Change-Id: Ie0596f2dd302eec293f3a5ab3306d56fb0fdcdb8
Closes-Bug: #1240285
2013-10-21 16:49:31 -07:00
Michael Basnight
fd43cbd73b Massive refactoring to the troveclient
The new client adheres to the standards of the other clients
now. It prints out tables, uses ENVVAR's for auth, no longer
stores pickled json in a login token, uses openstack common,
and moves the cli operations into a v1 module for the future
of trove when it has a v2 api.

Please note for compatibility, the troveclient.compat module
has the old cli. In order to deploy it, amend the setup.cfg
to include the compat module.

implements blueprint cli-compliance-upgrade

Change-Id: Ie69d9dbc75ce90496da316244c97acca1877a327
2013-10-09 19:21:08 -07:00
Vipul Sabhaya
12a577f15a Remove trove as default value for Service Name
* This causes service catalog lookup issues when the Catalog
  contains service_type = database, but service_name = somethine_else

fixes bug 1228372

Change-Id: I1f7eebb06d7f57c0ecc95d8c05104f43e803c406
2013-09-23 14:56:11 -07:00
ZhiQiang Fan
e3a301ff28 Replace OpenStack LLC with OpenStack Foundation
Some files still use trademark OpenStack LLC in header, which
should be changed to OpenStack Foundation.

Change-Id: Ib30cd06cdd13b9f949e028753716aa55736f4a40
Fixes-Bug: #1214176
2013-09-20 05:09:59 +08:00
Sushil Kumar
c47d8c36a7 Adds support for admin to create flavors through mgmt API
Extending the management API to allow for an admin to
create flavors categorized on service type in trove.

Change-Id: I8d5910e6dd9e497d1a8be4ffd58aa339d12db74f
Implements: blueprint service-type-filter-on-flavors
2013-09-10 20:04:23 +00:00
Dirk Mueller
4ddb58ce9e Start using pyflakes
Instead of globally disabling pyflakes warnings,
disable only those that occur frequently and
fix the rest. Enable gating on those.

Change-Id: I774d809ebcda2339b30c104b031211a3b2c491bd
2013-06-26 13:48:18 +02:00
Michael Basnight
9916c8f273 Rename from reddwarf to trove.
Implements Blueprint reddwarf-trove-rename

Change-Id: Ib2d694c7466887ca297bea4250eca17cdc06b7bf
2013-06-21 20:15:23 +00:00