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
There are a few things currently wrong with bash-completion as it stands now:
1) IDs are currently required to be UUIDs. This is an arbitrary limitation
and doesn't make sense for certain kinds of objects, like `Flavors`
where a valid ID could be `performance-16gb`.
2) The code is spread out between Oslo's `Resource` and Novaclient's
`Manager` class. This makes it difficult to improve the code because it
requires changes to two separate projects. We should centralize the
code in Novaclient until the API is stable, then import the code into
Oslo in its entirety, not partially like it is now.
3) The completion code is handled by the `Manager` of which there is one
per Resource-type. In the interest of centralizing this functionality,
we should create a `CompletionCache` class and hang it off of `Client`
of which there is one-per-session.
4) The completion-code currently runs by default even in headless mode
(e.g. novaclient without the shell). It'd be much more efficient to
only write to the completion cache if we're accessing the `Client` from
the novaclient shell. We can make this an option to support third-party
CLI clients that want to use the completion-cache as well.
NOTE:
* The corresponding Oslo patch is here:
https://review.openstack.org/#/c/101376/
* This patch was tested in multithreaded mode to prevent any regression
from:
https://bugs.launchpad.net/python-novaclient/+bug/1213958.
Change-Id: Idada83de103358974b739f81d4f392574f9e1237
Closes-Bug: 1332270
Overwrite the HelpFormatter constructor in the class
OpenStackHelpFormatter to modify the default value of the
max_help_position to extend the width of the argument column
in the help output.
example output before this patch:
volume-snapshot-create
Add a new snapshot.
volume-snapshot-delete
Remove a snapshot.
volume-snapshot-list
List all the snapshots.
volume-snapshot-show
Show details about a snapshot.
example output after this patch:
volume-snapshot-create Add a new snapshot.
volume-snapshot-delete Remove a snapshot.
volume-snapshot-list List all the snapshots.
volume-snapshot-show Show details about a snapshot.
Change-Id: I517098748947e7bded03160a15e778bf79475d0d
Closes-Bug: #1326471
Currently, in order to use a bypass URL, you need to specify it using the
`--bypass-url` command-line option each time, which is inconvenient if you
plan on always using a bypass URL.
This patch adds a `NOVACLIENT_BYPASS_URL` environment variable which can be
placed in the `novarc` to persistently set this option.
Change-Id: I49e67ee1fc3570a43e49dc1d78d8ca0b26945bc8
Closes-Bug: 1326134
Python 3 changed the map built-in to return an iterable instead of a list.
When tested in a boolean context, this always returns True, even if it
would not return anything when iterated.
Instead of the usage being printed, this error was printed:
ERROR: 'Namespace' object has no attribute 'func'
Use list comprehension instead to ensure that an iterable isn't returned
Change-Id: Ie15f2fa8ee93ab26490e371133fa0f944430737b
Closes-bug: 1295356