As a stepping stone to the os-client-config patch, first switch to
using keystoneauth, its Session and its argparse registration and
plugin loading to sort out any issues with that level of plumbing.
The next patch will layer on the ability to use os-client-config
for argument processing and client construction.
Change-Id: Id681e5eb56b47d06000620f7c92c9b0c5f8d4408
novaclient should display help message of the proper versioned method
(based on api_version value).
Closes-Bug: #1523649
Closes-Bug: #1523651
Change-Id: I67f7fc2befde9d312400e9a1569e590bd763156e
Commit d045019f0f2d28f26730b3617f7d7b993506b6e8 use the variables
API_MAX_VERSION and DEFAULT_OS_COMPUTE_API_VERSION with wrong way.
API_MAX_VERSION means the max version of client supported. This
variable only be changed when client support the new version. And
it's must bumped sequentially.
DEFAULT_OS_COMPUTE_API_VERSION is default value of option
'--os-compute-api-version', this value decided the default behaviour
of nova client. The nova client CLI behaviour should be that client
negotiate with server side to find out most recent version betweeyn
client and server. So the value should be '2.latest'. And it won't
be changed except we decided to change the default behaviour of nova
client CLI.
Change-Id: Iba9bfa136245bd2899c427ac0c231a30c00bd7f3
Closes-Bug: #1508244
The client currently implements support for microversions 2.2, 2.4 and
2.11.
According the nova API microversion history:
http://docs.openstack.org/developer/nova/api_microversion_history.html
2.3 just returns extra attributes in the response so it's not a problem
for the client. We should expose those at some point but it's not a
breaking change.
2.5 is a server-side only change since the client allows filtering
servers by IPv6 address but the server wasn't honoring that until 2.5.
There are no client side changes for that microversion.
2.6 is the first backwards incompatible microversion since it replaces
the old specific console APIs (RDP/serial/SPICE/VNC) with a new generic
remote-consoles API. The client must be updated to handle this since
requesting any microversion >=2.6 for consoles will fail right now. This
is exposed on the CLI right now because the CLI defaults to the 2.latest
microversion.
So even though the client actually supports the 2.11 microversion, we
shouldn't default to higher than 2.5 because we have gaps in handling
2.6->2.10.
This change fixes the default for the CLI by setting
DEFAULT_OS_COMPUTE_API_VERSION=2.5.
Partial-Bug: #1500688
Change-Id: I52074f9a3e7faa6a7a51c3fa9766100acf25dee2
For consistency:
* Adjust capitalization, e.g. use ID or UUID.
* Slight wording improvements.
* Add "." at end of all strings.
Change-Id: I252c023438c4fe82873a1616b36391f2a2048853
CLI-Reference generator requires
(openstack-doc-tools/bin/doc-tools-update-cli-reference)
that command line help and bash-completion running without authentication.
For this purpose, remove authentication check in command and its test.
Fix nova bash-completion works without authentication.
Fix nova bash-completion test without setting authentication infomation.
Define skip_auth for descriminate "nova bash-completion" and do_help.
Change-Id: Ic1a7f84b1b9cb7e8be6721c1b8096f49e9e9ab33
Closes-Bug: #1495424
shell.main() uses safe_encode() to encode the exception name and
exception message. On Python 3, it displays:
ERROR (b'Exception'): b'message'
instead of:
ERROR (Exception): message
Don't encode exception name and message on Python 3. Use
exception_to_unicode() of oslo_utils.encodeutils to get the exception
message as Unicode. On Python 2, let print() encodes the Unicode to
the encoding of sys.stderr.
Blueprint nova-python3
Change-Id: Ib5568546d2aedb2b28c05d840b9ba34f697384ec
os_password is not set anywhere for auth_plugins. It is only set for
keystone sessions. This makes sure that it gets set before being passed
to Client.
Closes-Bug: #1493977
Change-Id: I94421fd6fa58be391dfe8a9a14479bb4c17c5231
Since heat already patched to use discover_extensions [1],
_discover_extensions is no longer used by any other project, it
could be safely removed.
[1]: https://review.openstack.org/#/c/180812/
Change-Id: If527e15dcb9fb19cf9440084f50a2c6551cbd3b3
It would be nice to use "latest" version of api by default.
Related to bp api-microversion-support
Change-Id: Ife981c87d32011f01fcbdf871071a9d8273ebb92
This patch adds version discovery when user request with latest version.
The latest version means the most recently version between server and
client.
Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I0b7a95e77371aef6e349bf54b5dd6ce6c6d2732c
New decorator "novaclient.api_versions.wraps" replaces original method with
substitution. This substitution searches for methods which desire specified
api version.
Also, this patch updates novaclient shell to discover versioned methods and
arguments.
Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I1939c19664e58e2def684380d64c465dc1cfc132
When debug logging is enabled, set the log level of iso8601 to WARNING
to effectively silence its logging.
Change-Id: I17d7e6d5776b2369a2f8c42fd88f6c6790ad1b80
Closes-bug: #1441639
Compute API version will be transmitted to API side via
X-OpenStack-Nova-API-Version header, if minor part of version is presented.
New module "novaclient.api_versions" was added as storage for all api versions
related functions, classes, variables and etc.
`novaclient.api_versions.APIVersion` class is similar to
`nova.api.openstack.api_version_request.APIVersionRequest`. The main
difference relates to compare methods(method `cmp` is missed from Py3) and
processing "latest" version.
Related to bp api-microversion-support
Change-Id: I0e6574ddaec11fdd053a49adb6b9de9056d0fbac
The client.keyring_saver attribute was not being reliably set so the
client._save_keys function was not storing any new tokens in the
keyring.
Add a unit test to ensure keyring_saver is being property set.
Closes-Bug: #1397732
Change-Id: If0df24c819d71b4df302309d049079a867a11c76
Heat uses `novaclient.shell.OpenStackComputeShell._discover_extensions`
function, which is private currently. It's better to change this method
to public for public use.
Change-Id: I15879d56db2ec88a9bef99b6af8924ebd4ad169b
Closes-bug: #1440779
Module novaclient.v1_1 is already deprecated, so it's time to stop using it
inside novaclient.
Since support of v3 nova is undocumented feature, which uses v2
implementation, we can remove code related to it.
Also, this patch removes redundant check for compute api version != 1.0.
Change-Id: I06b349f704d5ae2c592d8d286da268870f2a69e9
The expected behavior is when timing is True, then we record each
request's time, then we should call reset_timings() to release memory.
However, the shell, client.{HTTPClient,SessionClient} will record each
request's time no matter what timing is set, then after long running
time in service like ceilometer-agent-compute, the memory keeps increasing.
We'd better not record request's time when timing is set to False.
Users are not responiable to call reset_timings() when they don't want
timing functionality.
Change-Id: I3e7d2fadf9a21be018781d528a1b6562228da6dd
Closes-Bug: #1433491
other openstack clients like glance, cinder use --endpoint-type
(internal|admin|public). This allows users to use the same arguments
with the nova cli.
Partial-bug: #1367389
Change-Id: Ia55cad797ac0dca7fa60f55c1f2dfba0b64d0fd3
This reverts commit 4c8cefb98a425382204df2f38f24e6b5b71520dd.
The cache completion was causing a bug where 'nova volume-attach' would
then try to query Nova for volume information using a URL that was not
valid. This caused it to appear that the attach had failed.
Additionally the idea of making extra API queries for a bash completion
cache should be thought through more.
Conflicts:
novaclient/client.py
novaclient/shell.py
novaclient/v2/client.py
novaclient/v3/client.py
Closes-Bug: #1423695
Change-Id: I6676a11f9b5318a1cda2d03a5d4550bda549d5c2
Module novaclient.v1_1 is used as implementation of V1.1, V2 and V3.
Since future development(microversioning) will be done across V2,
implementation should be done in appropriate module(to prevent misleading).
Despite the fact that implementation for all versions are equal, discover
method for contrib path worked only for v1.1. This patch fixes this bug and
modifies shell tests to check all versions.
Change-Id: Ib6798f4dfe177586302141f522dc593560ce6a5b
To remove aliases for `arg` and `env` functions in novaclient.utils,
we should use `arg` and `env` directly from cliutils in novaclients modules.
This patch removes aliases in `novaclient.utils` and starts using
`args` and `env` from novaclient.openstack.common.cliutils directly.
Change-Id: I4585adae62bc66ad6bc9d19be10d4679bb3dc5a1
Fix E128 failures in novaclient/client and
novaclient/shell and enable check for E128
E128 continuation line under-indented for visual indent
Change-Id: Id3ac46ccdbb8a9f97e54b4643240d93b06fac6ea
This changeset enables support for Keystone V3 authentication
on the Nova CLI. This provides consistency between using
novaclient as the Nova CLI and using it as a library
as the Keystone V3 support already exists for the libary usecase.
The bulk of the change surrounds the use of the keystoneclient
session object for authentication, retriving the service catalog,
and HTTP connection/session management.
Co-Authored-By: Morgan Fainberg <morgan.fainberg@gmail.com>
Change-Id: Iece9f41320a8770176c7eeb5acd86be4d80cc58f
This change makes the handling of the endpoint_type setting in the nova
client more consistent while keeping backwards compatibility. The
NOVA_ENDPOINT_TYPE environment variable is checked first, and if it is
not set then the more generic OS_ENDPOINT_TYPE variable is checked. A
--os-endpoint-type command line option was added as well.
Change-Id: I0d96f9f87106fc41a9853920f557ffad724859e7
Closes-Bug: 1382249
The novaclient implemented it's own version of the CLI arguments that
are now provided by keystoneclient's session object. This changeset
converts nova over to utilizing the shared argument registration.
Change-Id: Ifc9ddc08614e28358229db84cb9b54552ca36d51
Co-Authored-By: David Hu <david.hu@hp.com>
Module gettextutils from oslo-incubator was graduated to separate
library (oslo.i18n) and removed from repository, so we should use
new library.
Change-Id: I15d36ac5a2bb88b332ffa38d29488b75c55a20a9
argparse.ArgumentParser allows to specify partially options:
nova boot ... --key-nam mykey
# is equivalent to
nova boot ... --key-name mykey
an error is raised if the provided prefix matchs 0 or 2+ options:
nova boot ... --os value
# raises an "ambiguous option" error because --os could match
# --os-username, --os_username ...
even if the provided prefix matchs only the current/deprecated
forms of the same attribute:
nova boot ... --key mykey
# raises an "ambiguous option" error because --key could match
# --my-key, --my_key ...
This change extends argparse.ArgumentParser to avoid raising an
"ambiguous option" when the provided prefix matchs only the current and
deprecated forms of the same attribute.
Change-Id: I1089901de769df3312d4a15b6d6e5e60b1ed51e0
when keyboard interrupt is received by novaclient, the return code as
of now is 1.
But since the client was terminated by an keyboard interrupt, the return
code should be 130. (http://tldp.org/LDP/abs/html/exitcodes.html)
It is useful when people are writing automation test cases and want to
validate based on the return code.
I have also changed the message that is printed on shell to match other
clients.
Change-Id: If544ade154c53b1f18518773f4d49cd335a394d0
Closes-Bug: #1373231
Module `novaclient.utils` contains a lot of functions which are
presented in modules from common code.
* service_type -> novaclient.openstack.common.cliutils.service_type
* get_service_type -> novaclient.openstack.common.cliutils.get_service_type
* pretty_choice_list ->
novaclient.openstack.common.cliutils.pretty_choice_list
* import_class -> oslo.utils.importutils.importclass
* HookableMixin -> novaclient.openstack.common.apiclient.base.HookableMixin
Change-Id: Ia6cac058da12c852d92f26875a66ae31cc4c63d4
Modules `strutils`, `timeutils` and `network_utils` from common code are
graduated in `oslo.utils`, so we can:
1. remove `novaclient.openstack.common.network_utils` and use
`oslo.utils.netutils` instead.
2. use `oslo.utils.encodeutils` and `oslo.utils.strutils` instead of
`novaclient.openstack.common.strutils`.
3. use `oslo.utils.timeutils` instead of
`novaclient.openstack.common.timeutils`.
Additional information:
- modules `importutils`, `strutils` and `timeutils` from
`novaclient.openstack.common` cannot be removed, because:
- importutils is used by apiclient and jsonutils;
- strutils is used by apiclient, cliutils and jsonutils;
- timeutils is used by jsonutils
- additional check for `safe_encode` in Py3 is required, since
If91a866d864a22d28a352152beff4c7406a27b7b was merged.
Change-Id: Ib8d79d9c85af4916e87a76a1a67a13488ddaa111
When running 'nova' with '--service-type' option, it raises an variable
error.
$ nova --service-type compute list
ERROR: local variable 'os_compute_api_version' referenced before
assignment
When '--service-type' option is given, the default value of
'os_compute_api_version' does not apply.
Change-Id: I19554756e8eb56e3a5984ed3078137af9687f986
Closes-bug: 1315368
* E265 block comment should start with '# '
* H302 import only modules
Do not check docs/source/conf.py. The file is imported from the
cookiecutter template.
Documented why checks are ignored and if they should be enabled
in the future.
Change-Id: I367064ecaa6d1fd9d918f7ce003303e2db660647