20 Commits

Author SHA1 Message Date
Arundhati Surpur
ed0b2c0f43 Removed extra word 'method' from the NOTE
Removed extra 'method' word from the file
api_versions.py

Change-Id: Ie0f89bdab5e3a0bd66f3cd992e03c45bda01ef1d
2017-07-07 05:30:28 +00:00
jichenjc
4c18c8bd97 Remove version 1.1 support
v2 and v2.1 is supported now and it ask user to use v2.x API
should be what we wanted , this already deprecated for a
couple of release, so we can remove it now

Change-Id: I8de6fdbf21ccc4969297044a49590ffcd9cd27d8
2017-03-26 17:58:58 +08:00
libing
736ed310ac Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I4c8c83315897c7e64b05402c233b0fa67eb03a6e
2017-03-25 14:03:26 +08:00
Matt Riedemann
20b721e1ad Cap image API deprecated methods at 2.35
The image proxy API GET/DELETE methods are deprecated
at microversion 2.36 and will return a 404 after that.

This adds the wraps decorator to those python API methods
so set the cap at 2.35 so rather than get a 404 you'll
get a more uesful VersionNotFoundForAPIMethod.

Note that set_meta and delete_meta are not decorated
because we missed deprecating the image-metadata proxy API
with the 2.36 microversion. That will be fixed in Ocata.

Related to blueprint deprecate-api-proxies

Change-Id: Ie65efadb5c65e8a624ffd0315a634accd49f1c30
2016-08-19 16:25:07 -04:00
Dan Smith
aaebeb05a0 Deprecate all the nova-network functions in the python API
Per the plan, this marks all nova-network-related functions as
deprecated for removal.

Change-Id: I511793cd9a01669e77e1ae5ecb391ce937477309
2016-08-19 09:41:03 -07: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
Chris Dent
082ed80369 Update to microversion 2.27
This enables the use of the OpenStack-API-Version header, in
addition to the older X-OpenStack-Nova-API-Version header.

If the client knows that it is in a version less than 2.27, it
will not send the newer header.

If the client knows that is in a version >= 2.27 if it gets a
response that does not have the expected response header (the
newer one) it will warn. If it is in an older version, it will
warn about the other one missing.

A server that is 2.27 or beyond will accept both headers and
respond with both.

Change-Id: I1f7b1ca0fe795e4ecd333de761d96fff117969c0
2016-06-01 13:49:57 +00:00
Dao Cong Tien
a967e40185 Fix typos in docstrings and comments
Change-Id: Ib94c2b999f8295ec526d4e44883b86ab8b5a0688
2016-04-06 09:36:28 +07:00
Takashi NATSUME
18a64d3ab1 Fix string interpolation at logging call
Skip creating the formatted log message
if the message is not going to be emitted
because of the log level.

TrivialFix
Change-Id: Ic35b67bc43c77a086409bed57b846f729300d5c0
2016-02-22 02:31:03 +00:00
Jenkins
802b016a9f Merge "[microversions] share one object for shell arguments" 2016-01-05 15:50:18 +00:00
Andrey Kurilin
fd450d8c60 [microversions] share one object for shell arguments
I8d599b712b17dcfc0be940a61c537d2dfe1b715b change provides a wrong fix for
an issue with cli arguments.

_find_actions method is designed to find all action methods(do_server_list,
do_server_show and etc). Since one module can include several versions of
one action(after microversion implementation) and only the last one will
be registrated in module, _find_actions method was adopted to handle
versioned methods.
Now it checks that discovered method is related to versioning stuff and
replace it by appropriate(in terms of microversions) functions. In this case,
the substituation is used only to determine function name and that it relates
to versioning methods. That is why the change(see a change-id above) is not
help at all.

We should share list object named "arguments"(it used by all action methods to
store cli arguments) with substitution and original method(which will be used
by _find_action). It will allow to put api_versions.wraps and cliutils.arg
decorators in any order.

Change-Id: Ief316a8597555db6cb02c9f23406b9f1f09f8313
2015-12-22 15:17:12 +02: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
Ghanshyam
aa73df2649 Fix H404/405 violations in client.py,base.py,api_version.py
There is a lot of H404/405 violations in novaclient, and it is better
to fix those to have a better doc string for class/methods.

This patch fixes these violations for below files-
-api_versions.py
-base.py
-client.py

As there are lot of violations and cannot be fixed in single patches,
So separating those in multiple patches for easy review.

Change-Id: I30a714fc3b0b317f7ffa4a99fbb224b4d5f5477b
Partial-Bug: #1521899
2015-12-03 11:45:22 +09:00
Andrey Kurilin
4393d90524 Check response headers for microversions
novaclient provides version negotiation on CLI layer. In case of usage
novaclient as a lib, user can specify api_version with microversion part
and can try communicate with Nova endpoint which doesn't support
microversions. Nova endpoint will not check X-OpenStack-Nova-API-Version
header and will execute request(it can be correct or not). It this case
we should warn user about his mistake and about "incorrect" response.

Change-Id: I7a5ab964b7b2b2a49cc80c22bf67ad5548afb30b
2015-11-23 20:13:13 +02:00
Jenkins
17a37e5760 Merge "Copy cli arguments in api_versions.wraps decorator" 2015-08-17 16:18:58 +00:00
Andrey Kurilin
a570b60d67 Copy cli arguments in api_versions.wraps decorator
novaclient.api_versions.wraps decorator can be used in shell. Most of shell
function has cli arguments which are added via another decorator.
Currently, to keep this cli arguments, novaclient.api_versions.wraps
decorator should be used in the top of decorators. Something like:

    @api_versions.wraps("123.456")
    @cliutils.arg("name", help="Name of the something")
    @cliutils.arg("action", help="Some action")
    def do_something(cs, args):
        pass

This patch adds ability to put api_versions.wraps decorator everywhere:

    @api_versions.wraps("123.456")
    @cliutils.arg("name", help="Name of the something")
    @cliutils.arg("action", help="Some action")
    def do_something_1(cs, args):
        pass

    @cliutils.arg("name", help="Name of the something")
    @cliutils.arg("action", help="Some action")
    @api_versions.wraps("123.456")
    def do_something_2(cs, args):
        pass

Related to bp api-microversion-support

Change-Id: I8d599b712b17dcfc0be940a61c537d2dfe1b715b
2015-08-11 14:40:05 +03:00
Andrey Kurilin
9f19f9a285 Change docstring of api_versions.discover_version
Change-Id: I814bedf45980fb90002b2d253c8b38ff0d289f82
2015-08-11 13:08:03 +03:00
Andrey Kurilin
9ed9ab68f7 Add version discover and check in CLI
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
2015-08-04 16:15:01 +08:00
Andrey Kurilin
936cf572df Implements 'microversions' api type - Part 2
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
2015-07-25 15:57:17 +08:00
Andrey Kurilin
ea0b3bd608 Implements 'microversions' api type - Part 1
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
2015-07-16 16:06:28 +03:00