Convert to using ClientManager and OpenStackShell from osc-lib.
* Change all internal uses of ClientManager private attributes that are
now public in osc-lib's ClientManager. Leave back-compat copies in
place in OSC's clientManager so we don't break plugins.
* Put some work-arounds in place for changes in osc-lib that we need until
a new release makes it through the g-r and u-c change process.
* Add a test for Unicode decoding of argv in shell.main() to parallel
the one in osc-lib.
Change-Id: I85289740d4ca081f2aca8c9b40ec422ad25d302c
The OpenStack LLC copyrights date from before OpenStack was transferred
to the foundation. These appear to be getting copy-pasted to new files
so at least should reflect the correct entity.
Change-Id: I02953d752cb24ead6aa4ad8bfe257a48317c9f13
Use osc-lib directly for exceptions.
Leave openstackclient.common.exceptions for deprecation period.
Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
OSC don't support to use "X.latest" format in order to talk with the
latest nova microversion API, that is very helpful shortcut usage to
use new nova side features, this patch implement it.
Change-Id: I87918addff1f50fbc6eb72ca82b31813330753b5
Closes-Bug: #1561838
There are files containing string format arguments inside logging messages.
Using logging function parameters should be preferred.
Change-Id: I15b405bf4d4715263fe1e1262982467b3d4bc1f4
Closes-Bug: #1321274
novaclien v2.26.0 includes `discover_extensions` method, which returns
list of all nova extensions based of version. Such method allows us to
reduce imports of novaclient's modules and construct novaclient instance
simpler.
Change-Id: Idbe3ed275fb4a7e3918b11669dcfad47b8de4fb9
`novaclient.client.Client` is a recommended entry point for novaclient.
It supports backward-compatibility and allows Nova-folks to change
interfaces of inner versioned clients classes.
Change-Id: Iaf20714f63c307f88a451759f041ca509fbcf6f8
novaclient 2.27.0 introduced the API microversion discovery and client.Client
now wants an api_version argument to properly work out the correct API
version in use. OSC needs to provide this when required.
Letting the compute client plugin do the version validity checking makes more
sense than encoding it into shell.py, so I've added a new OSC plugin interface
function check_api_version() that is called from shell.py if it exists. If it
either does not exist or it returns False the previous version checking using
API_VERSIONS is still performed.
compute.client.check_api_version() conditionally imports the new
novaclient.api_versions module and uses it if successful. Otherwise
check_api_version() returns False and the previous code path is resumed.
One side-effect of this is that it is now valid to use --os-compute-api-version
with any valid microversion supported by the installed python-novaclient.
Closes-Bug: #1492467
Change-Id: I4535b38a5639a03a9597bf83f6394f9bb45c2b9e
Setting default versions in parsed args makes it so OCC
cannot tell if the argument was parsed, an environment
variable was set or it is just defaulted. In order to
set api versions from OCC, it will have to be defaulted
after processing OCC.
Closes-Bug: #1453229
Change-Id: I4d065919397b783f3bdd4022c986c0234a7a16e6
User should be able to specify the endpoint type through
a CLI optional argument/ENV variable setting. We will name this new
optional argument: --os-endpoint-type (Env: OS_ENDPOINT_TYPE) and
based on the value given, the service API will use that specific
endpoint type. Possible values: public, admin, internal.
DocImpact
Closes-Bug: #1454392
Change-Id: Ife3d4e46b44c0ddcd712b1130e27e362545a9a29
So we really weren't deferring the loading of client libs dadgummit,
do that for real where possible. This shaves a couple of tenths off
the static import times.
Also defer as much import-time procesing as possible. This is a little
ugly in api.auth but this also eliminates import of the auth plugins
until they are needed.
Change-Id: Ia11d4b9cf98231d37449103fc29101dc17afb009
Print a warning message if an unknown api version is supplied.
An attempt will be made to run the command anyway.
Change-Id: Idec8e88fe9621f10ec4b7eecd90708fb3730f56f
As of 2.21.0 novaclient moved all of the v1_1 classes to v2 with a
deprecation warning. The version-non-specific interfaces provided in
novaclient.client are insufficient to support a few specific commands in
OSC so we need to conditionally import directly from the correct classes.
Closes-Bug: #1418024
Change-Id: I864b1908737803069dc1419c9cbca391b985c932
Calls to compute commands ignore region selection. The region is
not passed to the get_endpoint call.
Change-Id: I1ccfc56d7cb27a00b8982232a40ace21f2c0e9a2
Closes-Bug: 1405416
For class-loading purposes we can just use the major version,
so accept that. Only Identity and Compute were affected; Compute
is included just to be pedantically complete.
For command groups we also just use the major version so fix
Compute and the version option handling.
Change the internal default for Identity to a simple '2' so it
is also consistent with the rest of the world.
Then comes microversioning...
Closes-Bug: #1292638
Change-Id: Ibaf823b31caa288a83de38d2c258860b128b87d8
Clients that can use ksc Session don't need the old junk to
fake auth anymore:
* compute
* volume
Clients that still need to be fed credentials can pick directly
from the auth object in clientmanager. The _token attribute is
removed, the token can be retrieved from the auth object:
openstackclient/tests/common/test_clientmanager.py
This change will break any plugin that relies on getting a token
from instance._token. They should be updated to use the above, or
preferable, to use keystoneclient.session.Session to create its
HTTP interface object.
Change-Id: I877a29de97a42f85f12a14c274fc003e6fba5135
The ksc auth plugins do not have support for the original
token-endpoint (aka token flow) auth where the user supplies
a token (possibly the Keystone admin_token) and an API endpoint.
This is used for bootstrapping Keystone but also has other uses
when a scoped user token is provided.
The api.auth:TokenEndpoint class is required to provide the
same interface methods so all of the special-case code branches
to support token-endpoint can be removed.
Some additional cleanups related to ClientManager and creating
the Compute client also were done to streamline using sessions.
Change-Id: I1a6059afa845a591eff92567ca346c09010a93af
In a cloud with AZs, you can get multiple entries back from the service
catalog - one for each AZ and then one that is AZ agnostic that's tied
to the region. If the region_name is plumbed all the way through, this
works as intended.
Change-Id: I3b365ea306e8111fc80830672ae8080a5d1dc8e0
Add support for --timing options. Use cliff via a pseudo-command
'Timing' to support multiple outputformats.
If an output format other than the default 'table' is selected
use CSV since the timing data is in list form.
Will pick up timing data for any client object that has a method
similar to novaclient's get_timings().
TODO:
* Stop instantiating all of the clientmanager client objects just
to check for timing data. Descriptor magic required?
Change-Id: I7f1076b7a250fba6a8b24b2ae9353a7f51b792b2
Since novaclient has support to list extensions, we should add
some of the logic to our list extensions command.
Closes-Bug: #1337684
Change-Id: I3074225780142df265a34add03e60c0f7c64c711
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.
Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
When using the -v option, displays curl equivalent commands and http
messages exchanged with the nova and cinder API servers. Displays the
same messages as those displayed with the --debug option of
python-novaclient and python-cinderclient.
Implements: blueprint curl-commands-in-debugging-messages for nova and
cinder related calls
Change-Id: Ibc8ef79d874334585b81d652b9c7df9e874fffa9
Allows client libraries to have complete access to the rest of the
OSC ClientManager. In addition, extension libraries can define
global options (for API version options/env vars) and define
versioned API entry points similar to the in-repo commands.
The changes to ClientManager exposed some issues in the existing
object api tests that needed to be cleaned up.
Change-Id: Ic9662edf34c5dd130a2f1a69d2454adefc1f8a95
Add --os-cacert and --verify|--insecure options using the same
sematics as the other project CLIs. --verify is included for
completeness.
Bug: 1236608
Change-Id: I8a116d790db5aa4cb17a2207efedce7cb229eba3
Change the global auth options to use 'project', leave the original
tenant options in place but silent for compatability with the existing
project CLI auth options. This is the only compatibility for tenant
usage in this changeover.
Change-Id: I3cce6e552f18822cc9f445ec5f301b0f5d9003f8
Made all the necessary changes to pass new PEP8 standards.
Also cleaned up docstrings to conform to the HACKING stanards.
Change-Id: Ib8df3030da7a7885655689ab5da0717748c9edbe
* Specific versions supported are managed in XXXXXX.client.py with a
mapping from version to client class. This is based on the scheme
that is included in novaclient; none of the other client libs have
that capability.
Change-Id: I930b197f1189e7f52c3b0096e73e0773cf925542
* move auth option checking back to OpenStackShell() to keep the shell-level
interaction at that level; add checking for token flow options
* make identity.client.make_client() configure keystoneclient.v2_0.Client()
properly for both password flow and token flow auth
* eliminated ClientManager.init_token(), set _service_catalog in __init__()
* compute client handles token flow
Change-Id: I42481b5424489387798c4ec6d3e2a723ab1e6067
* Make the Identity client in identity.client.make_client()
* Auth via ClientManager.identity
* Skip extra auth roundtrip in compute client
Change-Id: I0190639e38f83997c233195f6cc27ff3afdfba10
blueprint client-manager
blueprint nova-client
bug 992841
Move the authentication logic into a new ClientManager class so that only commands that need to authenticate will trigger that code.
Implement "list server" and "show server" commands as examples of using the ClientManager, Lister, and ShowOne classes.
Change-Id: I9845b70b33bae4b193dbe41871bf0ca8e286a727