43 Commits

Author SHA1 Message Date
Dean Troyer
6a15f90dae osc-lib: shell
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
2016-08-05 13:48:55 -05:00
Dean Troyer
6357202971 Fix foundation copyrights
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
2016-06-14 09:49:28 -05:00
Dean Troyer
e5e29a8fef osc-lib: utils
Use osc-lib directly for utils.

Leave openstackclient.common.utils for deprecation period.

Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
2016-06-13 10:50:44 -05:00
Dean Troyer
d20c863ebc osc-lib: exceptions
Use osc-lib directly for exceptions.

Leave openstackclient.common.exceptions for deprecation period.

Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
2016-06-13 10:50:01 -05:00
Huanxuan Ao
95d5d9f761 Fix some missing i18n support problems in compute
Found and Fix some missing i18n support problems in compute/client.py

Change-Id: I54374f4eddafd9f80b6ccdaf8f8c30e098df105e
Partial-bug: #1574965
2016-06-03 12:15:22 +08:00
Rui Chen
a5a343a5a8 Support X.latest format for OS_COMPUTE_API_VERSION
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
2016-04-20 03:24:47 +00:00
ting.wang
5a978b9ec1 Replace string format arguments with function parameters
There are files containing string format arguments inside logging messages.
Using logging function parameters should be preferred.

Change-Id: I15b405bf4d4715263fe1e1262982467b3d4bc1f4
Closes-Bug: #1321274
2016-02-20 14:16:25 +08:00
Andrey Kurilin
9e6f99e2ab Use discover_extensions for novaclient
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
2015-09-11 16:23:54 +03:00
Andrey Kurilin
c513f05ce9 Use novaclient.client.Client for initialization Nova client
`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
2015-09-09 18:00:50 +03:00
Dean Troyer
3abfea083a Fix compute API version snafu
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
2015-09-04 16:25:55 -05:00
TerryHowe
b3335b3474 Do not set default versions in parsed args
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
2015-07-18 06:28:09 -06:00
TerryHowe
36391a81a3 Rename endpoint type to interface
Change-Id: I4e21d09bc747e8210f4f79a1d6c4c7ccf2f25d1c
Closes-Bug: #1454392
2015-07-15 10:11:59 -06:00
Roxana Gherle
5521e4c504 Add --os-endpoint-type cli optional argument
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
2015-07-02 10:10:46 -07:00
Jenkins
a5e79d58ae Merge "Defer client imports" 2015-04-19 03:23:12 +00:00
Dean Troyer
f43c1f7655 Defer client imports
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
2015-04-15 22:40:52 -05:00
TerryHowe
a0fe37e189 Add warning message if unknown version supplied
Print a warning message if an unknown api version is supplied.
An attempt will be made to run the command anyway.

Change-Id: Idec8e88fe9621f10ec4b7eecd90708fb3730f56f
2015-04-13 16:21:50 -06:00
Dean Troyer
5d92fc0d0a Handle novaclient >2.20.0
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
2015-03-03 13:02:11 +00:00
Terry Howe
1927b03cc7 Compute calls ignore region selection
Calls to compute commands ignore region selection.  The region is
not passed to the get_endpoint call.

Change-Id: I1ccfc56d7cb27a00b8982232a40ace21f2c0e9a2
Closes-Bug: 1405416
2014-12-24 06:08:19 -07:00
Dean Troyer
2b02beaa51 Liberalize version matching a bit
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
2014-11-16 11:37:52 -06:00
Dean Troyer
0de67016c7 Remove now-unnecessary client creation hacks
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
2014-10-18 00:01:45 -05:00
Jenkins
68130fa921 Merge "Add plugin to support token-endpoint auth" 2014-10-17 23:27:28 +00:00
Dean Troyer
c3c6edbe8a Add plugin to support token-endpoint auth
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
2014-10-12 16:48:43 -05:00
Monty Taylor
3af547a1a6 Fix operation on clouds with availability-zones
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
2014-10-11 14:30:04 -07:00
Jenkins
bc6495c6a1 Merge "Add basic timing support" 2014-07-11 18:22:06 +00:00
Jenkins
69138c7912 Merge "Clean up make_client() logging" 2014-07-08 15:48:28 +00:00
Dean Troyer
4844a25779 Add basic timing support
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
2014-07-08 02:04:00 -05:00
Dean Troyer
21bd4619ae Clean up make_client() logging
Change-Id: I0b6760a6401b50e3dfb891af75424ae89df42ebc
2014-07-08 01:44:55 -05:00
Steve Martinelli
270c7fe967 Add support to list compute extensions
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
2014-07-03 23:53:57 -04:00
Christian Berendt
3b485de6b0 replace string format arguments with function parameters
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
2014-05-20 13:49:56 +02:00
Florent Flament
a5e087e7a9 Displaying curl commands for nova and cinder calls
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
2014-01-02 11:08:53 +01:00
Dean Troyer
9062811d10 Expand support for command extensions
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
2013-11-21 01:27:10 -06:00
Dean Troyer
3f9c68f1c6 Add options to support TLS certificate verification
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
2013-10-07 18:17:48 -05:00
Dean Troyer
0aa3c206a3 Remove tenant round 1 - global options
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
2013-07-31 10:07:50 -05:00
Josh Kearney
b26cb5bf68 Upgraded to PEP8 1.3.3 to stay aligned with Nova, etc.
Made all the necessary changes to pass new PEP8 standards.

Also cleaned up docstrings to conform to the HACKING stanards.

Change-Id: Ib8df3030da7a7885655689ab5da0717748c9edbe
2013-01-31 13:31:41 -06:00
Josh Kearney
0a4912f9fb Standardize on a copyright header and ensure all files have them.
Change-Id: I64812bca01ca655c9cf9239a0daea84907082a29
2013-01-24 12:02:23 -06:00
Josh Kearney
c1ea298904 Clean up test environment and remove unused imports.
First round of adding more complete unit test coverage.

Change-Id: Ic1979c499ca6fcb784892a95954a3527539c4e53
2013-01-22 11:44:18 -06:00
Dean Troyer
90a1c65f3a Update compute client bits
* add server create, delete, pause, reboot, rebuild
  resume, suspend, unpause commands

Change-Id: I728ec199e4562bd621c3a73106c90d8b790b459a
2012-09-05 16:06:49 -05:00
Dean Troyer
fa4a4a37d6 Move get_client_class() to common.utils
* add constants for API_NAME

Change-Id: I8ccf72f032227e0a452d96303181549b1b11a5d1
2012-05-11 13:49:45 -05:00
Dean Troyer
712a8c7f9c Add API versioning support
* 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
2012-05-10 15:52:15 -05:00
Dean Troyer
3b2129f0b8 Add copyright notices and update dates
Change-Id: I54a7d99328143205ab97ea930aeeeb69fe92c76c
2012-05-10 14:58:16 -05:00
Dean Troyer
6fb1a4e496 More identity client config
* 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
2012-05-10 13:54:58 -05:00
Dean Troyer
70b3246a19 Add Identity to ClientManager
* Make the Identity client in identity.client.make_client()
* Auth via ClientManager.identity
* Skip extra auth roundtrip in compute client

Change-Id: I0190639e38f83997c233195f6cc27ff3afdfba10
2012-05-04 16:37:18 -05:00
Doug Hellmann
5e4032150d Fix "help" command and implement "list server" and "show server"
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
2012-05-04 09:35:40 -04:00