33 Commits

Author SHA1 Message Date
Lucas Alvares Gomes
894699d2b4 Allow specifying a set of fields of the Port and Chasis resources
This patch add a "--fields" parameter to the "port-list", "port-show",
"chassis-list", "chassis-show" and "chassis-node-list" commands which the
user can specify a subset of fields that will be returned by the server.

This patch also enhances the error message for check_for_invalid_fileds()
method to show what are the valid fields.

Change-Id: Iaf90d615c9fa68f24e54c23d708ff9c5bee7c46c
2015-07-15 14:25:51 +01:00
Lucas Alvares Gomes
0d8fa45b4b Allow specifying a set of fields of the Node resource
This patch add a "--fields" parameter to the "node-list", "node-show"
and "node-port-list" commands which the user can specify a subset of
fields that will be returned by the server.

This is supported by the Ironic API version >= 1.8, so this patch also
bumps the default API version to 1.8.

Related-Bug: #1466495
Change-Id: I40654ee9fbd92dd91b41f8596adcd26264634147
2015-07-09 11:27:04 +01:00
Ruby Loo
8fd2ac3ba1 Consistent and more valid strings for Booleans
The set of valid input strings for Boolean values was inconsistent among
the subcommands of the Ironic CLI. egs:
 -for node-set-console-mode: 'true', 'false'
 -for node-set-maintenance: 'on', 'off', 'true', 'false', 'True', 'False'

This change allows the same set of valid values for all the subcommands:
'0', '1', 'f', 'false', 'n', 'no', 'off', 'on', 't', 'true', 'y', 'yes'.

For invalid strings, we output the subcommand usage along with the
argument, invalid string, and valid string choices.

At the API level, if NodeManager.set_maintenance() is passed an invalid
state (maintenance mode) value, an InvalidAttribute exception is raised.

Change-Id: I541695388489cdc640265df8ee6a9999e1442870
Closes-Bug: #1415943
2015-05-07 01:29:57 +00:00
Jenkins
a68770bbb3 Merge "Ensure *-show input uuid is not empty" 2015-04-24 15:22:28 +00:00
Haomeng, Wang
cec37d5a67 Ensure *-show input uuid is not empty
Ironic *-show does not ensure that uuid are not empty.

This patch adds checks to the client to ensure that command line
arguments are not empty strings or only whitespace. It will raise
a command exception if *-show command line argument is an empty
string or only whitespace.

Change-Id: Ia34957922006da5ecbbfc7483040d67ac51f0ada
Closes-Bug: 1442436
2015-04-22 02:48:49 +00:00
John L. Villalovos
2df670cf30 Remove unneeded 'utf-8' coding lines
This is basically a revert of commit:
  af741ec2236619880fa902d68aef4a6ae6cef534

It was decided that only files that need to have the line:
  # -*- coding: utf-8 -*-
Should have the line[1] as a general principle

This patch removes the 'utf-8' coding line from files that consist
entirely of ASCII characters.

[1]
http://eavesdrop.openstack.org/meetings/ironic/2015/ironic.2015-04-20-17.00.html

Partial-bug: #1325193
Change-Id: I88c1c37f7b580aa805eae9d4a1e66d33302a325f
2015-04-21 16:44:47 +00:00
Jenkins
5a0dfc2bcf Merge "Add support for generating a config drive" 2015-03-27 05:56:15 +00:00
Lucas Alvares Gomes
48a95b642d Add support for generating a config drive
This patch is adding support for generating the config drive as part of
the node-set-provision-state command. If a directory is passed via the
--config-drive parameter, the client will then generate a configdrive
with the contents of that directory and give it to Ironic.

Change-Id: I9163846acb30b34d34953f3b82b797ec944569d9
2015-03-26 09:52:59 +00:00
Ghe Rivero
d1c94489fc Clean openstack-common module list
Use importutils from oslo_utils and clean reference from
openstack-common.conf to stop syncing it.

Change-Id: Ia34bde4efe20c1ffee9a7446377ec87693a79b6a
2015-03-24 18:49:18 +01:00
Ghe Rivero
9991b26db1 Use oslo.i18n lib
Stop using gettextutils from oslo.incubator and replace with
the graduated library oslo.i18n

Change-Id: I479be348f6e0894ecff5cd93d37ee66648f3ea01
2015-03-19 18:27:24 +01:00
Lucas Alvares Gomes
8910d45955 Support setting non-string fields
Some attributes in Ironic support multiple types of data, before the
CLI was treating everything as a string this patch is changing that by
making the CLI to JSON deserialize the values before sending it to Ironic.

Change-Id: I7d53b31ad401bc7c36841e0ece28e818cdc8976d
Closes-Bug: #1403491
2014-12-19 17:37:32 +00:00
David Shrewsbury
e1629469f1 Fix sphinx warnings
Getting rid of a couple of warnings that are generated during the
documentation build.

Closes-Bug: #1392780

Change-Id: I2ebc8f1ec49ff80331077a653f0e73c988153898
2014-11-14 11:07:33 -05:00
Jenkins
2c84d91456 Merge "Small fixes for utils/{common_filters,common_params_for_list}" 2014-10-02 17:13:02 +00:00
Ghe Rivero
47236e2cf1 Bump hacking version
Current hacking version is incompatible with the one in the
global requirements. Match the hacking module version and made the
necessary changes to pass the tests.

Change-Id: Ie6b13a4ea112084d4c50dc27f97329dfad5777a1
2014-10-02 11:12:53 +00:00
Dmitry Tantsur
fe00a1cef6 Small fixes for utils/{common_filters,common_params_for_list}
This is a follow-up of https://review.openstack.org/#/c/114555
addressing comments that were not addressed there.

* Add docstrings for both functions
* Make common_params_for_list check for correct limit
* Improve uint-tests coverage

Change-Id: I33bbb4eac4a91a935b42521b9c63e6ce2118cb31
2014-09-29 16:41:52 +02:00
Lucas Alvares Gomes
14d264b171 List resources with detail
This commit adds support for getting a list of ports, chassis, ports
associated with a node and nodes associated with a chassis with all
attributes, to both the client and the shell CLI.

Closes-Bug: #1366866
Change-Id: If1941de66d70cdbcc3f31cefdbcd4f634e6ce24e
2014-09-09 15:10:44 +01:00
Dmitry Tantsur
b416865ba3 Add sort_key and sort_dir parameters to *-list
These arguments are using for sorting the result on the server.
Small refactoring was conducted to seperate processing of
common arguments for all lists into the utility function.

Change-Id: I33be1fcecc665c8f2207e53b24ff47954d80dc60
Closes-Bug: #1339731
2014-09-09 11:08:56 +02:00
Andrey Kurilin
fb63911eb1 Remove aliases arg and env from utils
This patch removes aliases in `ironicclient.common.utils` and starts
to use directly `arg` and `env` functions from common code.

Change-Id: Ied396b767e623fbcbf0c7a32326be7b64132b3e1
2014-07-09 11:30:06 +03:00
Martin Geisler
af741ec223 Add UTF-8 coding lines to all Python files
While not strictly necessary for files containing only ASCII
characters, adding a line with "coding: utf-8" can guard against
future SyntaxError's in case someone inserts a Unicode literal.

This commit adds such lines to all .py files. The syntax used by this
commit works with Python (of course). It also works with Emacs, which
will recognize the special "-*-" marker and use the "coding" variable
to correctly decode the file, even in an environment where UTF-8 is
not the default file encoding.

Existing coding lines were normalized to match the new lines added.

Partial-bug: #1325193
Change-Id: I58bf93fea711fd25890356a397e594bd820c99e3
2014-05-31 13:22:44 +02:00
Andrey Kurilin
a50fb88976 Reuse module cliutils from common code
This patch:
- removes unused method `common.utils:pretty_choice_list`;
- removes unused method `common.utils:find_resource`;
- removes unused method `common.utils:exit`;
- adds alias to `cliutils:args` in `common.utils`;
- adds alias to `cliutils:env` in `common.utils`;
- reuses method `print_list` from `cliutils`;
- reuses method `print_dict` from `cliutils`.

Related to blueprint common-client-library-2

Change-Id: I42318c6947509d4338309d03e722d822182bbc5d
2014-04-28 16:17:37 +03:00
Andrey Kurilin
0f6419015c Sync latest code and reuse exceptions from oslo
Module `ironicclient.exc` contains exceptions which equal to exceptions
from oslo common code.
This patch:
- sync latest code of `apiclient.exceptions`(hash of last commit in oslo
related to apiclient.exceptions: 3570f44d5ccf52c59cc586bed1446b874fc3c07c)
- reuses exceptions from common code
- removes needless exceptions from `ironicclient.exc`

Related to bp common-client-library-2

Change-Id: I784007f36dd6a63fc4c77e0d0f0f000e05eb792f
2014-04-24 12:01:31 +03:00
llg8212
8bbfc436fa Remove unused method 'string_to_bool' from utils
The method 'string_to_bool' in utils is not used.
Furthermore, if we need this method in the future,
we should use 'bool_from_string' from oslo cliutils
to replace it.

partially implements blueprint common-client-library-2

Change-Id: I82af6e358d7082222fe7a09c8f27351189a82fbc
2014-01-23 10:33:58 +08:00
Lucas Alvares Gomes
1aec4586e2 Add missing i18n support
There are some exception messages in common/utils.py and shell.py that
does not support i18n, this patch update the code to support it.

Change-Id: I836b892075333d48e4d1591986fec1362c84fc61
Partial-bug: #1240402
2013-11-28 10:23:54 +00:00
Lucas Alvares Gomes
11f7da97b6 Deal with unicode strings
The ironic client was trying to convert unicode strings received from the
API to ascii causing it to fail, this patch will correct it.

Change-Id: I8765abb188f758f982807a38f5d291fbc2be0da9
Closes-Bug: #1247156
2013-11-12 10:02:58 +00:00
Lucas Alvares Gomes
d82105652c Custom output file on the print_*() functions
In order to make the code more flexible and cleaner when testing (and
debugging) the print_*() functions can now redirect the output to a
different output file.

Change-Id: I34779220d80e037bdfe9e528ffad5187ff109ceb
2013-11-12 10:00:15 +00:00
Ghe Rivero
1b1dd31067 Reorder imports
As per hacking and PEP8, grouping third party libraries in
their own group.

http://www.python.org/dev/peps/pep-0008/#imports

Change-Id: I7a574d311b5171def0c6930162a46ce4c215097d
2013-11-11 18:12:58 +01:00
Kui Shi
f88361e187 Sort the dict iterms
In Python 3.3, hash randomization is enabled by default. It causes the
iteration order of dicts and sets to be unpredictable and differ
across Python runs.

Partial implement: blueprint py33-support

Change-Id: I739bd9ee1cc10dc01d28efb9a4d2b840bc374d63
2013-10-17 17:21:18 +08:00
Kui Shi
ebb6b304e8 Replace basestring with six.string_types
Partial implement: blueprint py33-support

Change-Id: Ibf1c63d407698f37b333da8f90bbdedbd9512c75
2013-10-17 17:21:14 +08:00
Kui Shi
8fa5e71b47 Use six.iteritems() for dict
In Python 3, dict.iteritems() is not supported anymore.

Partial implement: blueprint py33-support

Change-Id: Iec357ce5c5a6d2ffe4085bf26569a926e92e735a
2013-10-17 17:21:10 +08:00
Kui Shi
2056e57243 Transform print statement to print function
Partial implement: blueprint py33-support

Change-Id: Iefeea112a1928b7069a9c35198ef4e9dce8a382a
2013-10-17 17:20:57 +08:00
Lucas Alvares Gomes
cc66495430 Implement *-update commands to resrouces
Added node-update, chassis-update and port-update commands for v1.

Change-Id: I051841fce2872f1e19f95117e8827d7a2b1b521c
2013-09-30 16:59:14 +01:00
Lucas Alvares Gomes
3b901b0134 Split v1/shell.py into different files
Splitting v1/shell.py into one file per resource makes the code more
organized and in the long run helps to improve code readability.

Change-Id: Ia57019548158ffe33a1eca444405107caa327936
2013-09-26 11:24:26 +01:00
Lucas Alvares Gomes
ba073c0707 Basic project structure
Mostly taken from other OpenStack client projects and adapted for Ironic.

Change-Id: I1ef9613b9e24bbb6caac9657dc1da3add899478e
2013-09-19 00:21:14 +01:00