<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/openstack/python-novaclient.git/novaclient/tests/unit/test_api_versions.py, branch master</title>
<subtitle>opendev.org: openstack/python-novaclient.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/'/>
<entry>
<title>Use unittest.mock instead of third party mock</title>
<updated>2020-04-26T10:12:09+00:00</updated>
<author>
<name>Takashi Natsume</name>
<email>takanattie@gmail.com</email>
</author>
<published>2020-04-26T07:08:53+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=7ef2c28bf3b38917e4465205031e8476c5938195'/>
<id>7ef2c28bf3b38917e4465205031e8476c5938195</id>
<content type='text'>
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I4d45ae17f6f84f945f5dd049a929216ce6b6b58e
Signed-off-by: Takashi Natsume &lt;takanattie@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I4d45ae17f6f84f945f5dd049a929216ce6b6b58e
Signed-off-by: Takashi Natsume &lt;takanattie@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use more specific asserts in tests</title>
<updated>2016-12-06T08:43:12+00:00</updated>
<author>
<name>Gábor Antal</name>
<email>antal@inf.u-szeged.hu</email>
</author>
<published>2016-09-05T14:08:04+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=ce184797f07675d403245a541de42cd48450d320'/>
<id>ce184797f07675d403245a541de42cd48450d320</id>
<content type='text'>
I changed asserts with more specific assert methods.
e.g.: from assertTrue(sth == None) to assertIsNone(*) or
assertTrue(isinstance(inst, type)) to assertIsInstace(inst, type) or
assertTrue(not sth) to assertFalse(sth).

The code gets more readable, and a better description will be shown on fail.

Change-Id: I8be876e0d2a1ea5d6f8454ca973e2d874d10283d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I changed asserts with more specific assert methods.
e.g.: from assertTrue(sth == None) to assertIsNone(*) or
assertTrue(isinstance(inst, type)) to assertIsInstace(inst, type) or
assertTrue(not sth) to assertFalse(sth).

The code gets more readable, and a better description will be shown on fail.

Change-Id: I8be876e0d2a1ea5d6f8454ca973e2d874d10283d
</pre>
</div>
</content>
</entry>
<entry>
<title>Deprecate all the nova-network functions in the python API</title>
<updated>2016-08-19T16:41:03+00:00</updated>
<author>
<name>Dan Smith</name>
<email>dansmith@redhat.com</email>
</author>
<published>2016-07-28T18:12:50+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=aaebeb05a03e34281a091dc6dfc4672b01cdfbbb'/>
<id>aaebeb05a03e34281a091dc6dfc4672b01cdfbbb</id>
<content type='text'>
Per the plan, this marks all nova-network-related functions as
deprecated for removal.

Change-Id: I511793cd9a01669e77e1ae5ecb391ce937477309
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Per the plan, this marks all nova-network-related functions as
deprecated for removal.

Change-Id: I511793cd9a01669e77e1ae5ecb391ce937477309
</pre>
</div>
</content>
</entry>
<entry>
<title>Extend microversion stuff to support resource classes</title>
<updated>2016-06-16T05:57:59+00:00</updated>
<author>
<name>Andrey Kurilin</name>
<email>akurilin@mirantis.com</email>
</author>
<published>2016-04-21T09:00:04+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=f9bdba2dd707ee77ffdc67869c5517078a26a014'/>
<id>f9bdba2dd707ee77ffdc67869c5517078a26a014</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>Update to microversion 2.27</title>
<updated>2016-06-01T13:49:57+00:00</updated>
<author>
<name>Chris Dent</name>
<email>cdent@anticdent.org</email>
</author>
<published>2016-05-31T12:17:47+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=082ed8036996266d623d725a59527d30846a66d2'/>
<id>082ed8036996266d623d725a59527d30846a66d2</id>
<content type='text'>
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 &gt;= 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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &gt;= 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
</pre>
</div>
</content>
</entry>
<entry>
<title>Use novaclient/utils directly and remove openstack/common (1/4)</title>
<updated>2016-03-03T01:23:34+00:00</updated>
<author>
<name>Kevin_Zheng</name>
<email>zhengzhenyu@huawei.com</email>
</author>
<published>2016-03-01T08:35:01+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=93913c84b67d3aefe79bef106fbe9a83f0bcdb71'/>
<id>93913c84b67d3aefe79bef106fbe9a83f0bcdb71</id>
<content type='text'>
We can use novaclient/utils directly and get rid
of openstack/common folder.

This is the first part.

Change-Id: Iaec234fbcf4d0f8c7e8f2175eae11d3083a62090
Partial-Bug: #1551603
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can use novaclient/utils directly and get rid
of openstack/common folder.

This is the first part.

Change-Id: Iaec234fbcf4d0f8c7e8f2175eae11d3083a62090
Partial-Bug: #1551603
</pre>
</div>
</content>
</entry>
<entry>
<title>[microversions] share one object for shell arguments</title>
<updated>2015-12-22T13:17:12+00:00</updated>
<author>
<name>Andrey Kurilin</name>
<email>akurilin@mirantis.com</email>
</author>
<published>2015-12-15T15:51:33+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=fd450d8c60e174677ccc9d4f08dec17eb053b644'/>
<id>fd450d8c60e174677ccc9d4f08dec17eb053b644</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>Check response headers for microversions</title>
<updated>2015-11-23T18:13:13+00:00</updated>
<author>
<name>Andrey Kurilin</name>
<email>akurilin@mirantis.com</email>
</author>
<published>2015-11-23T13:16:06+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=4393d9052423851a530b1a9df056d31aeec0597a'/>
<id>4393d9052423851a530b1a9df056d31aeec0597a</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>workaround for RAX repose configuration</title>
<updated>2015-09-03T18:13:33+00:00</updated>
<author>
<name>Sean Dague</name>
<email>sean@dague.net</email>
</author>
<published>2015-09-03T15:13:21+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=e4b0d46c4b5b99973a7f65c294a9b73c8adfefb7'/>
<id>e4b0d46c4b5b99973a7f65c294a9b73c8adfefb7</id>
<content type='text'>
The RAX Repose environment is blocking access to the API version
information by local policy, returning a 401 before we even get to
Nova itself. While this in clearly incorrect behavior, it is behavior
in the field, and we should not break all our users on that cloud.

This catches the 401 and translates that so that it's the equivalent
of only supporting v2.0. We will be taking these API calls to defcore,
and intend to remove this work around once that is done.

Change-Id: I2072095c24b41efcfd58d6f25205bcc94f1174da
Related-Bug: #1491579
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The RAX Repose environment is blocking access to the API version
information by local policy, returning a 401 before we even get to
Nova itself. While this in clearly incorrect behavior, it is behavior
in the field, and we should not break all our users on that cloud.

This catches the 401 and translates that so that it's the equivalent
of only supporting v2.0. We will be taking these API calls to defcore,
and intend to remove this work around once that is done.

Change-Id: I2072095c24b41efcfd58d6f25205bcc94f1174da
Related-Bug: #1491579
</pre>
</div>
</content>
</entry>
<entry>
<title>Copy cli arguments in api_versions.wraps decorator</title>
<updated>2015-08-11T11:40:05+00:00</updated>
<author>
<name>Andrey Kurilin</name>
<email>andr.kurilin@gmail.com</email>
</author>
<published>2015-08-07T18:03:39+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-novaclient.git/commit/?id=a570b60d674d6bbdf90f26440e68771f22b704db'/>
<id>a570b60d674d6bbdf90f26440e68771f22b704db</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
