summaryrefslogtreecommitdiff
path: root/ironicclient/common/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Allow several nodes for most node actions"HEAD5.2.0masterZuul2023-05-081-0/+2
|\
| * Allow several nodes for most node actionsDmitry Tantsur2023-02-281-0/+2
| | | | | | | | | | | | | | | | This saves the users from writing scripts with "-f value -c uuid" or similar. It is also faster since OSC initialisation takes significant time (up to several seconds). Change-Id: I8ec6da97dc30d97764655b52b712c95f6c22c76a
* | Accept configdrive as a JSON fileDmitry Tantsur2023-03-021-0/+21
|/ | | | Change-Id: I32171ce0d61af00b7d242d455221a903692976f0
* Fix distribution compatability for configdrive buildJulia Kreger2021-09-151-12/+22
| | | | | | | | | | | | | | | | | | | | Previously, the configuration drive generation code made use of ``genisoimage``, however ``genisoimage`` is not shipped universally on all linux distributions, and largely has been replaced in distributions with other forks, as the tooling has evolved, forked, and changed over the past quarter century. We now attempt to utilize multiple different commands, including the original ``mkisofs`` command and the newer ``xorrisofs`` command when attempting to generate the ISO image, falling back until one works. Credit goes to I720f25921f8e52f20a631f238a528dedf65a91c6 for the base pattern in OpenstackSDK. Story: 2009230 Task: 43328 Change-Id: Ic732c2e6c77474e0d5b701c47758959c3511743b
* Merge "Support YAML files wherever JSON files are accepted"4.6.0Zuul2021-02-171-3/+4
|\
| * Support YAML files wherever JSON files are acceptedDmitry Tantsur2021-02-161-3/+4
| | | | | | | | Change-Id: I98ca7ee19399dfa0499c5db71257dddb64a3cf61
* | Clearer error message when unable to parse JSONDmitry Tantsur2021-02-161-2/+2
|/ | | | | | Using a non-existing file currently results in a cryptic message. Change-Id: I0489380d3a3ac1c9286e754c488df68f2b85c22f
* Merge "Get rid of the oslo.serialization dependency"Zuul2020-05-121-2/+2
|\
| * Get rid of the oslo.serialization dependencyDmitry Tantsur2020-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | It was used to smoothen out the difference in handling bytes in Python 2 and 3. Now that we only support Python 3, it can be replaced. A side effect of this change is that we no longer accept bytes in JSON. JSON does not support bytes, but this problem has been hidden due to oslo.serialization until now. The configdrive handling has been updated to account for that. Change-Id: I230b55db55bce08d46f5023ad7a3f6501c96d100
* | Remove future dependencyRiccardo Pittau2020-05-041-2/+0
|/ | | | | | Stop importing print function from future. Change-Id: I5c40446e14ccd9a2fe3b673c8bc8581c64012899
* Stop using six libraryRiccardo Pittau2019-12-181-2/+1
| | | | | | | | | | Since we've dropped support for Python 2.7, it's time to look at the bright future that Python 3.x will bring and stop forcing compatibility with older versions. This patch removes the six library from requirements, not looking back. Change-Id: I4b60638bb0268e5d1cf54fdf7d61964082536f4f
* Deploy templates: client supportMark Goddard2019-03-011-0/+16
| | | | | | | | | Adds OSC support for the deploy templates API. Change-Id: I0f2f37e840449ee41f747e2a43ed6f53c927094e Depends-On: https://review.openstack.org/631845 Story: 1722275 Task: 28678
* Allocation API: client API and CLIDmitry Tantsur2019-02-161-0/+21
| | | | | | | | | Adds the Python API to create/list/view/delete allocations, as well as the OpenStackClient commands. Change-Id: Ib97ee888c4a7b6dfa38934f02372284aa4c781a0 Story: #2004341 Task: #28028
* Use 'with' method rather than having to call closeJohn L. Villalovos2018-01-301-3/+2
| | | | | | | | gzip.GzipFile() supports 'with' statement usage. Use that rather than having to call close() explicitly. Plus with a 'with' statement if there is an exception it will still call close() Change-Id: I8535dffd66ffd7244b8bdcc4d79d6cf437a4d779
* Add volume connector support to Python APIHironori Shiina2017-07-071-1/+6
| | | | | | | | | | | | | | | | | | | | This adds support for volume_connector, which is required to boot instances from volumes. This will expose new Python API to operate volume connectors: - client.volume_connector.create - client.volume_connector.list - client.volume_connector.get - client.volume_connector.update - client.volume_connector.delete - client.node.list_volume_connectors Co-Authored-By: Satoru Moriya <satoru.moriya.br@hitachi.com> Co-Authored-By: Stephane Miller <stephane@alum.mit.edu> Co-Authored-By: Hironori Shiina <shiina.hironori@jp.fujitsu.com> Depends-On: I328a698f2109841e1e122e17fea4b345c4179161 Change-Id: I485595b081b2c1c9f9bdf55382d06dd275784fad Partial-Bug: 1526231
* Extends driver-list, driver-show supporting new hardware typesDao Cong Tien2017-04-281-0/+22
| | | | | | | | | | | | - Extend the driver-list command with --type argument, which, if supplied, limits the driver list to only classic drivers (classic value) or hardware types (dynamic value), and --detail to show detailed info of drivers. - Extend the output of the driver-show command with more info of driver. Change-Id: I5f72c47805ae9f761250f500098bfef4d502e419 Partial-Bug: #1524745
* Simplify heading capitalization.Vadim Hmyrov2016-12-261-3/+1
| | | | | | | Replaced expression for capitalizing the heading in HelpFormatter with a more readable one. Change-Id: I6070c7834614d5d0575cad5f298297f4422781e5
* Use oslo_serialization.base64 to follow OpenStack Python3Luong Anh Tuan2016-12-151-2/+2
| | | | | | | | | | | This patch replaces python standard base64 library call to oslo_serialization.base64 to follow OpenStack Python3 porting standard [1], since the requirements.txt has already defined oslo.serialization>=1.10.0. [1] https://wiki.openstack.org/wiki/Python3 Change-Id: I77aaeafb3e1f6167ac062f2670f45dd2ebf642dd
* Merge "List required arguments in '--help' message in Ironic Client."Jenkins2016-11-301-1/+6
|\
| * List required arguments in '--help' message in Ironic Client.Vadim Hmyrov2016-11-231-1/+6
| | | | | | | | | | | | | | | | | | The aim of this patch is to improve commands 'ironic help node-create' and 'ironic help port-create' so that the required arguments are listed in a dedicated section, but not in section 'optional arguments'. Change-Id: I73e0179170b3bb446bd9b14b095eac8ce8b5924b Closes-Bug: #1518959
* | Use function import_versioned_module from oslo.utilsChangBo Guo(gcb)2016-11-021-8/+0
|/ | | | | | | | oslo.utils 3.17 provides similar function, just use it. Closes-Bug: #1627313 Change-Id: I1710faafd69cb098d603135ca8a158129edb6fec
* Add key_value_pairs_to_dict() methodRuby Loo2016-08-181-2/+24
| | | | | | | | Add the key_value_pairs_to_dict() method, which takes a list of key=value string pairs and generates a dictionary from that. Code is refactored to use this method. Change-Id: Ie4ada3354ff0afa66398804a715d09dd05695393
* Move methods to utils.pyRuby Loo2016-06-211-0/+43
| | | | | | | | | This moves (and makes public) _get_from_stdin() and _handle_json_or_file_arg() from node_shell.py to common/utils.py so that it can be used by the osc (openstackclient) plugin code too. Change-Id: I4b10a04b459b8206a20d258a255f9c882548be1e
* Fix typos in docstrings and commentsDao Cong Tien2016-04-061-3/+3
| | | | Change-Id: I56487bbe5c74fbd3e1d62918dbcf87dddf79a6e3
* Allow specifying a set of fields of the Port and Chasis resourcesLucas Alvares Gomes2015-07-151-8/+9
| | | | | | | | | | | 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
* Allow specifying a set of fields of the Node resourceLucas Alvares Gomes2015-07-091-1/+27
| | | | | | | | | | | | 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
* Consistent and more valid strings for BooleansRuby Loo2015-05-071-0/+28
| | | | | | | | | | | | | | | | | | | 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
* Merge "Ensure *-show input uuid is not empty"Jenkins2015-04-241-0/+6
|\
| * Ensure *-show input uuid is not emptyHaomeng, Wang2015-04-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Remove unneeded 'utf-8' coding linesJohn L. Villalovos2015-04-211-2/+0
|/ | | | | | | | | | | | | | | | | | 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
* Merge "Add support for generating a config drive"Jenkins2015-03-271-0/+62
|\
| * Add support for generating a config driveLucas Alvares Gomes2015-03-261-0/+62
| | | | | | | | | | | | | | | | | | 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
* | Clean openstack-common module listGhe Rivero2015-03-241-1/+2
|/ | | | | | | Use importutils from oslo_utils and clean reference from openstack-common.conf to stop syncing it. Change-Id: Ia34bde4efe20c1ffee9a7446377ec87693a79b6a
* Use oslo.i18n libGhe Rivero2015-03-191-0/+1
| | | | | | | Stop using gettextutils from oslo.incubator and replace with the graduated library oslo.i18n Change-Id: I479be348f6e0894ecff5cd93d37ee66648f3ea01
* Support setting non-string fieldsLucas Alvares Gomes2014-12-191-13/+27
| | | | | | | | | 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
* Fix sphinx warningsDavid Shrewsbury2014-11-141-1/+1
| | | | | | | | | Getting rid of a couple of warnings that are generated during the documentation build. Closes-Bug: #1392780 Change-Id: I2ebc8f1ec49ff80331077a653f0e73c988153898
* Merge "Small fixes for utils/{common_filters,common_params_for_list}"Jenkins2014-10-021-5/+23
|\
| * Small fixes for utils/{common_filters,common_params_for_list}Dmitry Tantsur2014-09-291-5/+23
| | | | | | | | | | | | | | | | | | | | | | 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
* | Bump hacking versionGhe Rivero2014-10-021-3/+2
|/ | | | | | | | 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
* List resources with detailLucas Alvares Gomes2014-09-091-0/+2
| | | | | | | | | 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
* Add sort_key and sort_dir parameters to *-listDmitry Tantsur2014-09-091-0/+44
| | | | | | | | | 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
* Remove aliases `arg` and `env` from utilsAndrey Kurilin2014-07-091-5/+0
| | | | | | | This patch removes aliases in `ironicclient.common.utils` and starts to use directly `arg` and `env` functions from common code. Change-Id: Ied396b767e623fbcbf0c7a32326be7b64132b3e1
* Add UTF-8 coding lines to all Python filesMartin Geisler2014-05-311-0/+2
| | | | | | | | | | | | | | | | | 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
* Reuse module `cliutils` from common codeAndrey Kurilin2014-04-281-107/+5
| | | | | | | | | | | | | | | 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
* Sync latest code and reuse exceptions from osloAndrey Kurilin2014-04-241-1/+1
| | | | | | | | | | | | | | 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
* Remove unused method 'string_to_bool' from utilsllg82122014-01-231-4/+0
| | | | | | | | | | | 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
* Add missing i18n supportLucas Alvares Gomes2013-11-281-7/+8
| | | | | | | | 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
* Deal with unicode stringsLucas Alvares Gomes2013-11-121-2/+2
| | | | | | | | 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
* Custom output file on the print_*() functionsLucas Alvares Gomes2013-11-121-4/+5
| | | | | | | | 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
* Reorder importsGhe Rivero2013-11-111-1/+1
| | | | | | | | | 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