Commit Graph

11 Commits

Author SHA1 Message Date
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 80b4286981 Replace MB with MiB
Change-Id: Ie5bd325d8e0f7e9af76c1ddae1d679b0e797c84b
2018-10-22 07:11:25 +00:00
Nguyen Hung Phuong bc4f9195ad Clean imports in code
In some part in the code we import objects. In the Openstack style guidelines
they recommend to import only modules. [1]: "Do not import objects, only modules".

[1] https://docs.openstack.org/hacking/0.10.3/

Change-Id: Id4b47eeae1d3e86a3cb259c32fcb376ffbd3f8c7
2018-02-21 16:09:51 +07:00
Akshil Verma 78e621faf7 Fixed the __ne__ implementation in base.Resource
Any object of Resource class or its child class do not compare with
None as expected. For example if a server has been found and is
clearly not None, the test "server!=None" will be False.

This was occuring because the __eq__ implementation was returning the
'NotImplemented' keyword and the __ne__ implementation was returning
the not of __eq__, which in this case will return False as the
expected python behavior for a the not of NotImplemented is False.

Changed the __ne__ implementation to return the correct boolean value
and added the test case that fails with the older implementation and
passes in the current fix.

Change-Id: I6bf5a6e9c9eed4bbcf6678467df19dfea560b4de
Closes-Bug: #1648207
2016-12-19 12:10:03 -06:00
Andrey Kurilin 65c1fbae70 Store api_version object in one place
Currently we store api_version in two places: client and
HTTPClient/SessionClient instances.

It would be nice to store it in one place, so it would be easier
to change api_version without recreating novaclient object.

Change-Id: I36369a126c20de5922141e8725834ca93d6b0a1a
2016-08-18 18:36:40 +03:00
yuyafei 55201c55a8 base.Resource not define __ne__() built-in function
Class base.Resource defines __eq__() built-in function, but does
not define __ne__() built-in function, so self.assertEqual works
but self.assertNotEqual does not work at all in this test case in
python2. This patch fixes it by defining __ne__() built-in function
of class base.Resource. Also fixes spelling errors:resoruces.

Change-Id: I39e6f6b94e9490afc14143208e6f20b0ef960991
Closes-Bug: #1586268
2016-07-09 10:01:48 +00:00
Takashi NATSUME 2220c56375 Add wrapper classes for return-request-id-to-caller
Added wrapper classes which are inherited from base data types str,
list, tuple and dict. Each of these wrapper classes and
the Resource class contain a 'request_ids' attribute
which is populated with a 'x-compute-request-id' or
a 'x-openstack-request-id' received in a header from a response body.

This change is required to return 'request_id' from
client to log request_id mappings of cross projects.

This patch is one of a series of patches for implementing
return-request-id-to-caller.

Co-authored-by: Ankit Agrawal <ankit11.agrawal@nttdata.com>
Change-Id: I422c4f4ee59991ca89a0a16f548b537c8b61bb97
Implements: blueprint return-request-id-to-caller
2016-01-26 23:46:10 +00:00
melanie witt 098116d6a5 Revert "nova flavor-show command is inconsistent"
This reverts commit 4e79285b45.

The aforementioned commit broke flavor-show for mixed case flavorids.
The reason is a bit complex. On the nova api side, there is caching of
db items for flavors, keyed off the flavorid retrieved from the db,
case sensitive, unlike the db query itself. Attempts to flavor-show
a flavor with flavorid composed of letters will fail with a 400 if
the capitalization doesn't match.

For the flavor names, they work in lowercase because the find_resource
function falls back on a search by "human_id" after failing every other
attempt to find the flavor, because "human_id" is a oslo-slugified
string (all lowercase, non-word characters removed, spaces converted
to hyphens).

Closes-Bug: #1446850

Change-Id: I73247b50f5a6918167c071ccc13cd676aa2c7fec
2015-04-21 22:19:06 +00:00
Abhishek Talwar 4e79285b45 nova flavor-show command is inconsistent
The nova flavor-show command accepts a flavor
name as its parameter. The command show inconsistency
as it works with the exact flavor name and flavor name
in all lowercase but fails for any other case pattern.

So, updated the code so that if we run the command
with flavor-name case patern it runs fine.

Closes-Bug: #1423885
Change-Id: I713bf2b5aca977df40dc745e29d4fe98a950c991
2015-03-11 09:52:44 +05:30
Andrey Kurilin 0a60aae852 Rename v1_1 to v2
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
2015-02-04 17:40:46 +02:00
Joe Gordon 3561772f8b Move unit tests into unit test directory
In order to pave the way for functional testing, move existing unit
tests into a directory labeled unit. A subsequent patch will add a
directory for functional tests.

Change-Id: I0adb8b9f14451acb382c725d31f5387b4b6d82bb
2015-01-27 13:06:06 -08:00