It is time to signal that we're fully committed to delivering a pure
OSC experience.
Based on the neutron change from 6 (!!) years ago [1]
[1] 3a64a7a166
Change-Id: Ib80548e104a751179f36f2a6ebff9916d38fdf1e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Using the novaclient without a subcommand while
passing an optional argument triggers the raw Python
error `ERROR: 'Namespace' object has no attribute
'func'`. This bug can be reproduced by issuing the
command `nova --os-compute-api-version 2.87`.
Added a default value to `func` and an empty value to
`command` as placeholders so that a help message is
shown instead of the Python error.
Change-Id: Ic3e87b67f6d27d40b03d7d8e520fa0f79a4d09e5
Closes-Bug: #1903727
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
These particular imports are no longer needed
in a Python 3-only world.
Change-Id: I405b32c8cdd60fb19270a8f6fe2e2728022f7c6e
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
Instead of passing through whatever the user provides and exposing this
bug in the REST API, simply make the opt a boolean one in expectation of
a day where the API issues have been resolved.
This also introduces machinery necessary to use more of these types of
opts in the future.
Change-Id: I9033540ac65ac0ee7337f16bdd002060652092ea
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Mostly a find-replace job. Let's do this now so we don't have to carry
it for the next decade.
Change-Id: I7bef9fb7c6895f746cee1aca6522786f38b9857c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
The ``--endpoint-override`` command line argument has been deprecated.
It is renamed to ``--os-endpoint-override`` to avoid misinterpreting
command line arguments.
It defaults to the ``OS_ENDPOINT_OVERRIDE`` environment variable.
The deprecated ``--bypass-url`` command line argument has been removed.
Change-Id: Ic8a6559cd62d46b837fa9c04b482a46ceba829db
Closes-Bug: #1778536
Added support for parsing OS_PROJECT_DOMAIN_ID, OS_PROJECT_DOMAIN_NAME,
OS_USER_DOMAIN_ID, and OS_USER_DOMAIN_NAME options.
Change-Id: I9e1a3426f174c2e6d9f4f6bf10e9aecb62bad8d0
Closes-Bug: #1744118
There are 2 known issues which breaks token auth method in CLI:
* The wrong check of flag (the check should be for --os-token since
arguments are not parsed at that moment) is performed in CLI inner method
`_append_global_identity_args`. It led to usage of "password" auth
type by default[1] even if `--os-token` cli argument is specified.
If `--os-auth-type` is specified to token, keystoneauth1 library makes
the right decision[2].
* Based on an auth type, keystoneauth library registers different CLI
arguments[3]. It means that `--os-username` argument is available only
in password auth type, `--os-token` is available only in token auth
type, etc.
It also affects the way in which the python code should access such
arguments. The arguments which are unrelated to the selected auth type
are omitted from the parsed arguments object.
That sounds reasonable, but unfortunately the code assumes the
unrelated arguments are always present which leads to an
AttributeError.
Combination of these 2 issues made token auth type broken in CLI layer.
[1] ee2221f052/novaclient/shell.py (L255-L257)
[2] 14dd37b34c/keystoneauth1/loading/cli.py (L51-L52)
[3] 14dd37b34c/keystoneauth1/loading/cli.py (L65-L73)
Closes-Bug: #1659015
Change-Id: Ibc861d396b71fe105288d8336623cc22cf92523e
This code hasn't worked for over two years when
9ed9ab68f7 was added
which does API version discovery, which requires auth,
which happens before the SecretsHelper is used. That was
back in the 2.27.0 release in the Liberty series.
Given how long this has been broken without anyone noticing,
and it's undocumented and untested (basically), and
python-openstackclient properly handles prompting for a password,
we should just remove this code rather than try to fix it.
Change-Id: I62188e73a48f6878ce920a3b4724dba101564aef
Closes-Bug: #1732744
--profile argument can be loaded from OS_PROFILE environment variables
to avoid repeating --profile in client commands.
Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com>
Change-Id: I52415354f0c7a7483eddaa48f2acafcdecbb26fd
The following warning is emitted for every nova command using devstack,
stable/ocata.
site-packages/novaclient/client.py:278:
UserWarning: The 'tenant_id' argument is deprecated in Ocata and
its use may result in errors in future releases. As 'project_id'
is provided, the 'tenant_id' argument will be ignored.
See the following commit for related changes:
Clarify meaning of project_id var
9bbe5a87b7
Change-Id: Ifa5ed16f10a43c9961e98b03fc0535e12d7977ba
To be able to create profiling traces for Nova, client should be
able to send special HTTP header that contains trace info.
This patch is also important to be able to make cross project
traces. (Typical case heat calls nova via python client, if
profiler is initialized in heat, nova client will add extra
header, that will be parsed by special osprofiler middleware in nova
api.)
Security considerations: trace information is signed by one of the
HMAC keys that are set in nova.conf. So only person who knows HMAC key
is able to send proper header.
oslo-spec: https://review.openstack.org/#/c/103825/
Based on: https://review.openstack.org/#/c/105089/
Co-Authored-By: Dina Belova <dbelova@mirantis.com>
Co-Authored-By: Roman Podoliaka <rpodolyaka@mirantis.com>
Co-Authored-By: Tovin Seven <vinhnt@vn.fujitsu.com>
Partially implements: blueprint osprofiler-support-in-nova
Depends-On: I82d2badc8c1fcec27c3fce7c3c20e0f3b76414f1
Change-Id: I56ce4b547230e475854994c9d2249ef90e5b656c
Since all authentication plugins should be stored in Keystone, there is no
need to share responsibility for authentication stuff with Keystone team.
Let's use convinient and the right way to use keystone - keystone sessions.
We have own adapter for it - novaclient.client.Session which can be used in
100% cases of novaclient usage. Let's create session object if it is not
transmitted via arguments and get rid of novaclient.client.HTTPClient
implementation.
NOTE: novaclient.client.HTTPClient and all related code will be removed
separately.
Co-Authored-By: Clenimar Filemon <clenimar@lsd.ufcg.edu.br>
Change-Id: Ibb99fdafbf02b3e92f1a5d04d168151b3400b901
We need cert, project_domain_id, project_domain_name, user_domain_id,
user_domain_name arguments to constract SessionClient in proper way.
These variables will be used in further patches
Change-Id: I44416de7f4dc18916aecb6884158b416e696227e
Meaning of project_id (argument of novaclient.client) was not clear.
In different cases, it can be tenant/project id or name (in terms of
Keystone).
* tenant_id - this variable is deprecated now and project_id should be
used instead;
* project_id - meaning of this variable is clarified now and it expects
Project ID (in terms of keystone) now.
Change-Id: Ie3fc6b50260203c0debe8664bb87a7d72fb645d7
* there are two terms in openstack which describes the same thing:
bypass_url and endpoint_override
* endpoint_override is more wide term. It is used in Keystone)
* since not all openstack folks knows that bypass_url and endpoint_override
are the same, bypass_url (variable which was used in novaclient) was not
transmitted to SessionClient
NOTE: name of variable in inner class HTTPClient was not changed, since
this class will be abandoned soon.
Change-Id: I2d45820c01851b271de8ea66e0d59ec494040c04
novaclient can't process the resource if the name is 'help',
like 'nova show help', 'nova flavor-show help', 'nova delete help',
etc. We should encourage user to use 'nova help xxxx' to show
subcommand usage, rather than 'nova xxxx help`.
Change-Id: I65204a908dc2378b6264297ddd87fcb8912a5770
Closes-Bug: #1641048
The support for non-keystone auth systems and plugins
was deprecated with 1f11840dd8
back in the 3.1.0 release in mitaka.
Now that we're working on shoring up the support for
keystone auth sessions in the client and eventually moving
to remove support for the non-session HTTPClient, we should
also remove the support to load non-keystone auth plugins.
The whole concept of non-keystone auth systems/plugins is
a legacy artifact and is a barrier to interoperability which
is a goal of nova and OpenStack in general.
Change-Id: Ia649db257c416ca054977812ecb3f1a8044fa584
Used '%' instead of format() because "%" formatting operation
returns a unicode string for both unicode and non-unicode
format strings.
Encoded the exception error message in novaclient.shell.main and
novaclient.utils.do_action_on_many method to avoid
"UnicodeEncodeError" and print valid message.
NOTE:
Not used u'{0}.format(<str>) because in python 3 everything
is unicode so no need to add explicit 'u' to format string.
Closes-Bug: #1403379
Change-Id: I13f1ef2e1b41299b417cad3759a5cda241890df7
We just released novaclient 5.0.0 so this fixes the deprecation
message for the --volume-service-name option, not only for the
version but also the timeline for removal (to be consistent with
other things we'll remove like image and baremetal proxies).
Change-Id: I138f0ff05861a18b74cff650ea72f38d80a247fb
Parameter insecure is read using env parameter
NOVACLIENT_INSECURE, this could be string, and
string is handled as True in the rest code,
which is not correct, we should transform it
into boolean to handle it correctly.
Change-Id: I536763e45b8399b394c7dfa92d327bb4bfaa509f
Closes-bug: #1602076
Clean up all deprecated CLI options that are marked to
be removed in version 3.3.0 as we are already in
version 4.0.0
Change-Id: Ia9c5602df1be987e7c12f625d4f8359590678a19
The `--volume-service-name` name option needs to be deprecated
since the volume proxy API and CLI have been deprecated.
Change-Id: I8af9b62e56c5ab7bffa79b2700b3c9213aaad65d
Closes-Bug: 1570593
Current implementation of novaclient.api_versions.wraps allow to use
versioned methods for shell functions and resource managers. As resource
managers can have versioned methods, resource objects can have it too, but
it was not implemented yet. This patch fixes this omission.
Changes:
- Add api_version property to base resource class. It is mapped to
api_version property of manager class;
- Move `novaclient.utils.generate_function_name` to
`novaclient.api_versions._generate_function_name`, since this method is
specific to microversion stuff and should not used outside api_versions
module;
- Rewrite _generate_function_name to handle class(owner) name. Previously,
it was improssible to have two classes in one module with versioned
methods with equal names.
- Remove call of generate_function_name from novaclient.shell. Shell module
should not take care about function identifiers. get_substitutions accepts
object with __id__ property now.
- Mark _add_substitution as private method, since it should not be used
outside api_versions module
- Split all versioned methods of Server resource from novaclient.v2.servers
module.
Change-Id: Icfce16bfa6f919d7f8451d592f4a8e276b1f1709
Add the function to log 'x-openstack-request-id' or
'x-compute-request-id' in each API call.
If the caller (e.g. heat) uses oslo.log,
the caller's request id in oslo.context and
the callee's request id can be output in the same
log message (same line).
Change-Id: I29312ce278ecfae41a688a0ddf76c24cfa0eaf6b
Implements: blueprint log-request-id
Keystone V3 requires that the options os_user_domain_id/os_user_domain_name
and os_project_domain_id/os_project_domain_name be set. These options do not
have default values and novaclient will fail if they are not set by user.
This patch adds default values for os_project_domain_id and
os_user_domain_id in case of Keystone V3 env.
This is consistent with what the OpenStack CLI does.
Also, two functional tests are added to check authentication via
Keystone V2 and V3.
Partial-Bug: #1522402
Change-Id: Ieb41a7fbf24107f7250ef34218604fba96531195
The 'positive_non_zero_float' method has not been used
since Ifc9ddc08614e28358229db84cb9b54552ca36d51.
TrivialFix
Change-Id: Ice0c8f15dbc1a027710e0ace6c8fa872b964c3b6
We can use novaclient/utils directly and get rid
of openstack/common folder.
This is the first part.
Change-Id: Iaec234fbcf4d0f8c7e8f2175eae11d3083a62090
Partial-Bug: #1551603
If command has arguments with one name, but for different versions(see an
example below), both arguments will be displayed. This patch fixes this
issue.
Example of arguments:
@cliutils.args("name",
help="Name of a good action.",
start_version="2.1",
end_version="2.20")
@cliutils.args("name",
help="Name of a very good action.",
start_version="2.21")
def do_something_good(cs, args):
pass
Example of helpoutput before patch:
Positional arguments:
<name> Name of a good action. (Supported by API versions '2.0' - '2.20')
<name> Name of a very good action. (Supported by API versions '2.21' -
'2.latest')
Change-Id: I59f155675e2aae642a5b90cb70008eb5647ffe79
We have had deprecated command line options in novaclient for a long
time, but no warnings about the deprecations were ever emitted, despite
the help text being suppressed. It would be nice to finally get rid of
those deprecated options. This change sets up the precondition to
accomplish this, by emitting appropriate warnings when a deprecated
option is used.
Note: The "use" text for the deprecated options has been deliberately
chosen to reduce the number of translations required.
Change-Id: Ibe13faa56c5abca97f85f9c5172ef5a5591b5f71
Reviewing the import of novaclient 3.1.0 into the CLI Reference (change
Ib39cdfdd563a2a53f0e6de1f8d2dc4f8c4678c15), a few inconsistencies where
found and fixed:
* Missing "." at end of help string
* Inconsistent capitalization of "DEPRECATED, use"
* Inconsistent capitalization of "Set or delete"
* It's IPv4 and IPv6
* It's ID
Change-Id: I425cd6575ca31efd92fc7f0be6192031886fcc41
oslo-incubator was deprecated and all modules used by novaclient were
removed from oslo-incubator master branch. This patch removes all unused
code from novaclient's repo.
Change-Id: Ie3c542d19da6ed4d25ec490faf6a86a82f48cd34
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 d045019f0f 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