721 Commits

Author SHA1 Message Date
Dirk Mueller
fa3a8edf20 Fix W503 line break before binary operator
According to PEP8 the line break should be always after
a binary operator.

Change-Id: I9d0f6909d0e649fe740b748b831894ccb4e80b15
2016-01-09 09:27:38 +01:00
LiuNanke
6d023a6bc2 Replace assertTrue(isinstance()) by optimal assert
assertTrue(isinstance(A, B)) or assertEqual(type(A), B) in tests
should be replaced by assertIsInstance(A, B) provided by testtools.

Change-Id: Ie4fe7b40e3f4350db94b350395269340ee6acf11
Related-bug: #1268480
2016-01-07 02:55:45 +08:00
Jenkins
7d05f540ea Merge "Use assertTrue/False instead of assertEqual(T/F)" 2016-01-06 14:55:20 +00:00
Jenkins
802b016a9f Merge "[microversions] share one object for shell arguments" 2016-01-05 15:50:18 +00:00
Jenkins
60997a5997 Merge "Validate the fixed ip address passed with --nic" 2016-01-04 20:11:41 +00:00
Jenkins
6bc5b3ef2a Merge "Fixed test_shell which can't test microversions>=2.4" 2016-01-04 15:27:35 +00:00
yangyapeng
06be50b97a Use assertTrue/False instead of assertEqual(T/F)
The usage of assertEqual(True/False, ***) should be changed
to a meaningful format of assertTrue/False(***).

Change-Id: I66110e5fc1afdf9dd6824b1f7bcb7b2c091a272d
Closes-Bug: #1512207
2016-01-04 09:52:04 -05:00
Jenkins
86a9cc8371 Merge "Fix help strings" 2016-01-04 13:32:43 +00:00
Jenkins
2d96c2c9bb Merge "Cleanup needless code from oslo-incubator" 2016-01-04 13:30:18 +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
Zhihai Song
dd6b3cd394 Validate the fixed ip address passed with --nic
Currently fixed ip address passed with --nic is not validated.
This patch add the validation to the fixed address.

Change-Id: I032cc9ce9333b723d37e94b81d699cc0d78d36bf
Closes-Bug: #1528455
2015-12-23 15:11:40 +08: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
Sergey Nikitin
9cd9adb38c Fixed test_shell which can't test microversions>=2.4
Method run_command() gets max and min API verisons
from FakeHTTPClient.get_versions(). That's why max version
which could be tested by run)command is 2.3 (because it's
hardcoded in get_versions()).

get_versions() should return max and min versions from
novaclient.__init__.py

Closes-Bug: #1528527

Change-Id: I489c4714cacb345d3b45d5987113093c038cf151
2015-12-22 14:08:44 +03:00
Jenkins
7c3ce18e4d Merge "Validation for arguments of list command passed by "--fields"" 2015-12-18 22:44:53 +00: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
36e125a61e Merge "Allow command line for virtual-interface-list" 2015-12-17 19:33:21 +00:00
Jenkins
0c9abf02c9 Merge "[functional-test] add v2.8 functional test" 2015-12-17 18:02:54 +00:00
Mitsuhiro Tanino
bbdedc681d Validation for arguments of list command passed by "--fields"
When user specifies some attributes using "--fields" subcommand for
"nova list" and "nova network-list", these attributes are shown in
the list even if the server or network don't have these attributes
in their object.

Before passing attributes via "--fields", we should validate values
and if non-existent attributes are included, error will be raised.

Change-Id: I3eb4810993259515ee33a72e8bd99f9951721b60
Closes-Bug: #1522989
2015-12-17 12:46:22 -05:00
jichenjc
6b0fe2a424 Allow command line for virtual-interface-list
There is virtual-interface-list API support in nova but no
command line interface in novaclient, this patch adds it.

Closes-Bug: 1522424

Change-Id: Ib3078125beb7beaa08a3408486db54e0d10763e6
2015-12-17 12:41:43 +00:00
Jenkins
ebdcf077eb Merge "Change the logic for the client to retrive resources" 2015-12-16 15:34:17 +00:00
Jenkins
88ef0542dc Merge "Migrate to keystoneauth from keystoneclient" 2015-12-16 15:06:19 +00:00
Jenkins
2e5b08cd63 Merge "[functional-tests] fix version of novaclient instance" 2015-12-16 15:02:39 +00:00
Jenkins
e75a1cfc75 Merge "Enable pass instance name as parameter in nova cli" 2015-12-16 14:08:26 +00:00
Jenkins
29c701b8ad Merge "Fix help message in case of microversions" 2015-12-16 14:04:58 +00:00
Jenkins
aa2687b3f7 Merge "[microversions] Increase max version to 2.12" 2015-12-14 21:11:10 +00:00
Jenkins
55351d0135 Merge "[microversions] Add support for 2.10" 2015-12-14 20:43:16 +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
jichenjc
9857dd2523 [functional-test] add v2.8 functional test
add functional test for v2.8 API (webmks console type
enablement).
Also, fixed an issue related to v2.8 microversion
enablement for the console API.

Change-Id: I7660a189cc3051dd7dbc802ad2d40a4995b44960
2015-12-11 21:46:02 +08:00
Jenkins
250c360262 Merge "[microversions] update test_versions with implemented versions" 2015-12-10 23:51:18 +00:00
Andrey Kurilin
363bc3eafc [functional-tests] fix version of novaclient instance
setUp method of base class for functional tests creates an instance of
novaclient.client.Client with const version. This logic is wrong since we
have tests for microversions.

Change-Id: Ibd3ee5c730ae1fb3c19f512728f2a0a3693763e8
2015-12-10 23:35:04 +02:00
Javeme
e919c9b792 remove the default arguments "[]"
remove the default arguments "[]" when the function is defined.

ref: http://docs.python-guide.org/en/latest/writing/gotchas/

Change-Id: I71ee8fbf5dec12d93bbed0e336124ad833014845
2015-12-09 20:59:48 +08:00
Zhihai
11e0782f62 Change the logic for the client to retrive resources
The ID (primary key) of a resource can not be retrived by the client.
There is no sense to provide the functionality to get an resource by
its ID. Especially when an instance is named by an interger, client
will try to get the instance with the ID of that interger value.
This patch will change the order in which the novaclient retrive
resources. First by UUID, then by name, finally by the ID. This will
also reduce api call overhead, since UUID is used mostly.

Change-Id: I0bfa5cb03a04625c3def5608dd4529e52d50f944
Closes-Bug: #1516924
2015-12-09 12:47:05 +00:00
Jenkins
691e8d4f8b Merge "Add accessIPv4 and accessIPv6 when create server" 2015-12-09 04:39:50 +00: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
Andrey Kurilin
0ec6bedf42 [microversions] Increase max version to 2.12
2.12 - Exposes VIF net-id attribute in os-virtual-interfaces. User will be
able to get Virtual Interfaces net-id in Virtual Interfaces list and can
determine in which network a Virtual Interface is plugged into.

novaclient.base.Resource class is a parent class of VirtualInterface resource.
Since `Resource` is a universal interface for any resources and doesn't
require hard-code attributes which describe partial resource, there are no
required changes to support this microversion in "novaclient as a lib".

"novaclient as CLI" doesn't provide an interface for VirtualInterface yet
(see bug 1522424 for more details). When it will be implemented, we will need
to check that new attribute is displayed correctly.

Based on the fact that 1522424 is not resolved and novaclient.base.Resource
class has enough tests, this patch doesn't require any tests.

Also this patch fixes representation of VirtualInterface resource.

Change-Id: I18cf23847d3b2b01f5a6ffae2ebc4bede54babce
2015-12-07 22:17:22 +02:00
Andrey Kurilin
65658ed6fc [microversions] Add support for 2.10
2.10 - Added user_id parameter to os-keypairs plugin, as well as a new
property in the request body, for the create operation. Administrators will
be able to list, get details and delete keypairs owned by users other than
themselves and to create new keypairs on behalf of their users.

Change-Id: I13ca3f8a4dd9cf11bec79966bb8a2ab48847be22
2015-12-07 22:14:21 +02:00
Andrey Kurilin
96a7e1ddc4 [microversions] update test_versions with implemented versions
Change-Id: Ifc401e00fc6436ac85ade3fa119ef9a47607a5ec
2015-12-07 22:13:23 +02:00
Ghanshyam
573bdaa290 Fix H404/405 violations in novaclient/tests/*
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 files under  novaclient/tests/
folder.

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

Partial-Bug: #1521899
Change-Id: I6e712ece14c745013bfba0bee9d77e7875dd2263
2015-12-07 14:17:56 +09:00
Jenkins
06af0bf79b Merge "Fix repr of a host from a hosts.list()" 2015-12-04 19:55:33 +00:00
Jenkins
713b6f12e8 Merge "[microversions] Increase max version to 2.9" 2015-12-04 13:10:07 +00:00
Jenkins
0718f1a252 Merge "[microversions] Add support for 2.8" 2015-12-04 12:59:12 +00:00
Jenkins
d1fed78d09 Merge "Remove novaclient.v1_1 module" 2015-12-03 17:02:08 +00:00
Andrey Kurilin
0a535e3287 [microversions] Increase max version to 2.9
2.9 - Add a new locked attribute to the detailed view of servers. locked
will be true if anyone is currently holding a lock on the server, false
otherwise.

This microversion doesn't require any change in novaclient's code.
Just added functional tests and changed version

Change-Id: I7f33757e6f03f172e5a13ade0aa5e8d3a10dbf01
2015-12-03 10:10:21 +00:00
Andrey Kurilin
9fe53065ef [microversions] Add support for 2.8
2.8 - Add new protocol for VM console (mks)

Also, this patch removes code duplication and fixes docstrings for consoles
methods.

Co-Authored-By: jichenjc <jichenjc@cn.ibm.com>

Change-Id: Ic24183a5118872581b30f82734fa9d6ce0e53544
2015-12-03 12:09:56 +02:00
chen-li
1431f1b823 Enable pass instance name as parameter in nova cli
After the proposed bug fix, the admin can also start/stop/reset-state
instances of other tenants by passing instance name as the parameter.
Initially it could be done only through ids. One additional argument
--all-tenants is added so that the instance name is searched across all
tenants.

Previous command was:
nova start/stop/reset-state <instance_name>

New command is:
nova start/stop/reset-state <instance_name> --all-tenants

Co-Authored-By: Jyotsna <jyotsna.priya1@tcs.com>
(cherry picked from commit Ie5f8c5c15dee6060b979a34ed0aa01262e05e122)

Change-Id: I66f277b16b378a7908d8b951fe39d039df4ef6a4
Closes-Bug: #1297963
2015-12-03 17:07:30 +08:00
Jenkins
520ffae282 Merge "Optimize "open" method with context manager" 2015-12-02 20:42:54 +00:00
Jenkins
ee2db5f173 Merge "Not transform to str on potential unicode fields" 2015-12-02 15:45:18 +00:00
xiexs
6036114aa4 Optimize "open" method with context manager
Use opening context manager to open a file.

Change-Id: I50e4f2df54737e1ea5b4c7fbe8639f1cd981a627
2015-11-29 00:59:25 +08:00
melanie witt
c3dda7636c Fix repr of a host from a hosts.list()
The os-hosts API uses different attribute names depending on
whether the host was returned as part of a list or not.
A host returned from 'show host' has the attribute "host"
whereas a host returned from 'list hosts' has the attribute
"host_name".

This adds a host_name property to the Host class that will set the
"host" attribute if necessary. Although this doesn't exactly mirror
the responses coming back from nova api, it will make it easier for
users to use the objects interchangeably for hosts.list() operations
and hosts.update() operations, for example.

Co-Authored-By: Chung Chih, Hung <lyan.h@inwinstack.com>

Closes-Bug: #1434167

Change-Id: I5c339bdd1ab867d972759ade9a10b86bfda1e70a
2015-11-25 07:58:38 +00:00
jichenjc
297231c108 Add accessIPv4 and accessIPv6 when create server
nova support accessIPv4 and accessIPv6 as input param
but nova client don't support it as input param when
doing create operation.
Because it's already support in v2.1 so no microversion
introduced.

Change-Id: Idd50fe921f8c931ee28902f90ffdde6bfba34359
Closes-Bug: 1522359
2015-11-24 21:59:21 +08:00