Commit Graph

261 Commits

Author SHA1 Message Date
David Wlazlo e464940f39 Typo - nova CLI deprecation warning
Change-Id: I1e604867bd00d51caebcb049777bbc675a398969
2023-05-17 12:21:29 +10:00
Stephen Finucane 0fb7190c06 Deprecate nova CLI
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>
2022-04-06 14:17:59 +01:00
Takashi Natsume e85d845b1a Fix undesirable raw Python error
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>
2021-01-04 13:49:20 +09:00
Takashi Natsume e93a00b24e Remove future imports
These particular imports are no longer needed
in a Python 3-only world.

Change-Id: I405b32c8cdd60fb19270a8f6fe2e2728022f7c6e
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-04-26 07:19:26 +00:00
Stephen Finucane ea092b2988 Make 'server list --config-drive' a boolean option
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>
2020-04-08 17:27:33 +01:00
Stephen Finucane c4c44bcb2d Remove six
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>
2020-02-21 09:48:38 +00:00
Takashi NATSUME a7ea3fb09b Remove deprecated options
Remove the following deprecated options.

* --endpoint-override
* --instance-name ('nova list' command)

Change-Id: Ic6a78f04a98c1616750e6ecd6225f2750c214dd7
2019-03-21 13:50:41 +00:00
ZhijunWei 85e9b58e9b Update hacking version
1. update hacking version to latest
2. fix the pep8 failed

Change-Id: I484a40fe3cb868d223a807edcd3e20f5e0ebdf4e
2019-01-04 14:46:07 +08:00
Takashi NATSUME 2e6ef0c45a Rename --endpoint-override to --os-endpoint-override
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
2018-07-09 22:02:13 +09:00
shilpa.devharakar ab1f6bd763 Modify novaclient to support basic attributes
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
2018-06-15 11:51:31 +05:30
Andrey Kurilin 6049be67c0 [CLI] Fix token auth type
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
2018-04-19 18:43:45 +00:00
Matt Riedemann 8bfcd2b0e6 Remove SecretsHelper
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
2017-11-16 12:45:51 -05:00
Tovin Seven c23324ef48 Make --profile load from environment variables
--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
2017-06-19 13:37:51 +07:00
Stephen Finucane 3a76240124 Remove various deprecated options
These are all deprecated with at least one release and can be removed
now.

Change-Id: I5d11eda2a6b35de98f0484492f597a87df882013
Related-Bug: 1570593
2017-05-18 14:35:57 +01:00
Diana Clarke 1a9bfc424a Fix devstack python-novaclient warning
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
2017-02-23 14:42:55 -05:00
Boris Pavlovic 0fed79fd8f Add profiling support to novaclient
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
2017-01-19 03:50:06 +00:00
Andrey Kurilin 0bdd24518e Deprecate volume_service_name argument
We forgot about it while removing all methods related to Volume API.

Change-Id: I465b91a17e2633ae876c0011bc8af6ec475c8d48
2016-12-17 17:51:57 +00:00
Andrey Kurilin 8409e006c5 Create keystone session instance if not present
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
2016-12-16 12:56:10 +00:00
Andrey Kurilin 2163e6661a Transmit all auth related vars from cli to inner methods
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
2016-12-16 12:55:34 +00:00
Andrey Kurilin 9bbe5a87b7 Clarify meaning of project_id var
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
2016-12-15 19:49:04 +02:00
Andrey Kurilin 1ce917ef25 Rename bypass_url to endpoint_override
* 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
2016-12-15 19:49:03 +02:00
int32bit 2446755606 Fix can't process the resource with name 'help'
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
2016-12-07 10:11:11 +08:00
Matt Riedemann daa9bdc823 Remove support for non-keystone auth systems
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
2016-10-20 12:04:58 -04:00
bhagyashris d8c07006dd Fix 'UnicodeEncodeError' for unicode values
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
2016-08-30 15:30:16 +05:30
Matt Riedemann 6edb7517e3 Fix deprecation message for --volume-service-name
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
2016-07-18 16:45:48 -04:00
Kevin_Zheng 8c1d8fbe81 Correctly handle NOVACLIENT_INESCURE
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
2016-07-13 14:49:00 +08:00
Kevin_Zheng 6f8667990c Clean up deprecated CLI options
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
2016-07-04 11:37:12 +08:00
Jenkins 262b2393c9 Merge "Deprecated the `--volume-service-name` option" 2016-07-01 11:50:45 +00:00
Kristi Nikolla 74c3da93f5 Deprecated the `--volume-service-name` option
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
2016-06-29 12:00:45 -04:00
Andrey Kurilin f9bdba2dd7 Extend microversion stuff to support resource classes
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
2016-06-16 05:57:59 +00:00
Takashi NATSUME d16c3692e6 Log request_id for each api call
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
2016-06-08 00:10:55 +00:00
Dao Cong Tien a967e40185 Fix typos in docstrings and comments
Change-Id: Ib94c2b999f8295ec526d4e44883b86ab8b5a0688
2016-04-06 09:36:28 +07:00
Jenkins 7897740f28 Merge "Add default values for domain related options" 2016-04-04 14:55:41 +00:00
Andrey Kurilin e458fab8ef Add default values for domain related options
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
2016-04-04 10:57:41 +00:00
Jenkins df80402fa7 Merge "Remove an unused method in novaclient/shell.py" 2016-03-07 18:30:27 +00:00
Takashi NATSUME 8691eeccd8 Remove an unused method in novaclient/shell.py
The 'positive_non_zero_float' method has not been used
since Ifc9ddc08614e28358229db84cb9b54552ca36d51.

TrivialFix
Change-Id: Ice0c8f15dbc1a027710e0ace6c8fa872b964c3b6
2016-03-07 13:46:48 +09:00
Kevin_Zheng 93913c84b6 Use novaclient/utils directly and remove openstack/common (1/4)
We can use novaclient/utils directly and get rid
of openstack/common folder.

This is the first part.

Change-Id: Iaec234fbcf4d0f8c7e8f2175eae11d3083a62090
Partial-Bug: #1551603
2016-03-03 01:23:34 +00:00
Bartosz Górski e43c66a0aa Adds missing internationalization for help message
Change-Id: I676daed583cac49f72593c79e9f79f7c9908a57c
Related-Bug: #1491492
Signed-off-by: Bartosz Górski <bartosz@codilime.com>
2016-02-25 07:05:35 +00:00
Andrey Kurilin ca5b06f6ae [microversions] fix help msg for versioned args
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
2016-02-24 20:10:31 +02:00
Kevin L. Mitchell 08c4b746b2 Add a mechanism to call out deprecated options
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
2016-01-07 11:07:44 -06:00
Jenkins 86a9cc8371 Merge "Fix help strings" 2016-01-04 13:32:43 +00:00
Andreas Jaeger 8f320313f3 Fix help strings
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
2015-12-28 08:10:44 +01:00
Andrey Kurilin 01961d68a2 Cleanup needless code from oslo-incubator
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
2015-12-18 08:46:12 +00:00
Jenkins 88ef0542dc Merge "Migrate to keystoneauth from keystoneclient" 2015-12-16 15:06:19 +00:00
Monty Taylor 1f11840dd8 Migrate to keystoneauth from keystoneclient
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
2015-12-12 20:39:57 -08:00
Andrey Kurilin 8aaf0a9080 Fix help message in case of microversions
novaclient should display help message of the proper versioned method
(based on api_version value).

Closes-Bug: #1523649
Closes-Bug: #1523651

Change-Id: I67f7fc2befde9d312400e9a1569e590bd763156e
2015-12-08 17:09:31 +02:00
He Jie Xu 28bf8ddb06 Correct usage of API_MAX_VERSION and DEFAULT_OS_COMPUTE_API_VERSION
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
2015-10-21 11:07:32 +08:00
Matt Riedemann d045019f0f Set DEFAULT_OS_COMPUTE_API_VERSION to 2.5
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
2015-10-01 14:18:05 -07:00
Andreas Jaeger 3e99d3f875 Improve help strings
For consistency:
* Adjust capitalization, e.g. use ID or UUID.
* Slight wording improvements.
* Add "." at end of all strings.

Change-Id: I252c023438c4fe82873a1616b36391f2a2048853
2015-09-19 15:00:08 +02:00
Jenkins 4d5cfdead0 Merge "Fix nova bash-completion needs authentication" 2015-09-17 20:50:44 +00:00