summaryrefslogtreecommitdiff
path: root/ironicclient/common/base.py
Commit message (Collapse)AuthorAgeFilesLines
* Add global_request_id into the base client methodsVladyslav Drok2020-05-151-24/+69
| | | | | | | | | This change also allows passing os_ironic_api_version into create and delete methods, which was not possible previously. Story: 2007611 Task: 39602 Change-Id: I28e094df8ca0b1921fb8b6d503e8d09dfff064d7
* Stop using six libraryRiccardo Pittau2019-12-181-10/+9
| | | | | | | | | | 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
* Strip prefix when paginatingJim Rollenhagen2019-08-011-0/+17
| | | | | | | | | | | | The way the next URL is parsed and rebuilt in the pagination code doesn't take a prefixed path into account like devstack uses, e.g. /baremetal/v1/nodes. It ends up prepending the base URL and we get /baremetal/baremetal/v1/nodes. Drop the extra prefix when building this URL. Change-Id: I7e46068521c40f19c1e48eedc69b4ecd862e88fc Story: 2006216 Task: 35809
* Add support for reset_interfaces in node's PATCHDmitry Tantsur2018-07-171-1/+4
| | | | | | | Change-Id: I52ee891d6549827d9a055f23d475fe42f422c4d2 Depends-On: https://review.openstack.org/582951 Story: #2002868 Task: #22822
* Add microversion override for get and listJulia Kreger2018-06-121-11/+34
| | | | | | | | | | | | | | A continuation of previous patches adding support for node get and list calls to be able to overriden with an os_ironic_api_version keyword argument. Also adds a release note covering the prior patches in this series. Change-Id: I870540a23555e6ae37659452f727872d9d7882a3 Related-Bug: #1739440 Story: #2001870 Task: #14325
* Support per-call version: set_provision_stateEric Fried2018-06-061-1/+7
| | | | | | | | | | | | | | | | | | | | This is the first of (hopefully) many patches to enable API version overrides to be passed into ironicclient methods. This one plumbs .update() to accept an os_ironic_api_version kwarg and, if specified, stuff it in the appropriate header for the call. It also sets up node.set_provision_state to use that framework. This was brought about by the ugliness necessary to make [1] work in Nova. [1] https://review.openstack.org/#/c/554762/ Related-Bug: #1739440 Task: #14326 Story: #2001870 Change-Id: Ic772ada7e562bc845045736cb18c17d7117818f7
* Traits supportJim Rollenhagen2018-01-251-4/+13
| | | | | | | | | | This adds support for the traits APIs in both the node portion of the SDK, and the openstackclient plugin. We also bump the last known API version to 1.37 to get access to the new API. Change-Id: I72017d51dea194ec062a66cb19d718ba827e7427 Partial-Bug: #1722194 Depends-On: I313fa01fbf20bf0ff19f102ea63b02e72ac2b856
* Raise on NodeManager get when invalid identifier providedMaxime Belanger2017-01-091-0/+6
| | | | | | | | | | | | | When calling the NodeManager get method with resource_id equal to [], {}, (), None, "" or False the client returns a bad data structure. In order to be consistent with the API and the CLI the resource_id is now validated before calling the API and raises ValidationError in case of invalid value. Change-Id: Idb2b424ab17e79da948595fb74df3ef9d81732c0 Closes-Bug: #1652142
* If no resource, don't call Resource.to_dict()Ruby Loo2016-10-041-0/+14
| | | | | | | | | | | | | | | | This adds a new method base.Manager._get_as_dict() which checks whether there is a resource first, before calling Resource.to_dict(). Code was modified to call this new method, instead of calling Resource.to_dict() directly. This fixes the AttributeError that occurs if, for example, one tries to get the list of driver passthru methods of the 'fake' driver (via 'ironic driver-get-vendor-passthru-methods fake'). There are no methods, and without this change, an AttributeError exception is raised. With this fix, an empty list is returned. Change-Id: Ib6b691cd39ede9c5902b4df29023fd974b367a7d Closes-Bug: #1626806
* Add invalid attribute names to exceptionRuby Loo2016-06-281-1/+8
| | | | | | | | | | | | | When creating a resource via CreateManager.create(), an InvalidAttribute could be raised for invalid attributes (attributes that are not needed to create the resource). The raised exception had no message. This changes the exception to include a list of all the invalid attributes as well as indicate what the problem is. Change-Id: Iaea056ea6946a6f813f8081c26f62dcfe63d1bbd
* Refactoring and removing duplicate code of "base.Manager" heirsSinval Vieira2015-12-091-9/+87
| | | | | | | | | | | | | | | | | | | | without changing the API This commit does refactoring regarding the base.Manager and the specific managers that inherit from it (Chassis, Node, Port and Driver). The specific managers had a lot of duplicate code in methods like: get, create, delete and update, they were literally equal, what does not make sense once we already had the base.Manager inheritance to avoid this type of problem. This change moves the duplicate code to the parent (base.Manager) and make the specific managers simpler by making the base.Manager more useful regarding code reuse for these methods. Change-Id: Ic77a86196d5bcd956f0a3ae517200824a4d70aa8 Closes-Bug: #1517631
* Revert "Refactoring and removing duplicate code of "base.Manager" heirs"John L. Villalovos2015-11-301-113/+9
| | | | | | | | | | This reverts commit 46b279bb36b2647bf04097fe271586fca76f5ed0. The patch being reverted has broken the API compatibility. Until a fix for this issue has been created, the patch should be reverted. Change-Id: I1295c3e0d5ca228253874719befd7ed842d505fa Closes-Bug: #1521429
* Refactoring and removing duplicate code of "base.Manager" heirsSinval Vieira2015-11-301-9/+113
| | | | | | | | | | | | | | | | | | This commit does refactoring regarding the base.Manager and the specific managers that inherit from it (Chassis, Node, Port and Driver). The specific managers had a lot of duplicate code in methods like: get, create and vendor_passthru, they were literally equal, what does not make sense once we already had the base.Manager inheritance to avoid this type of problem. This change moves the duplicate code to the parent (base.Manager) and make the specific managers simpler by making the base.Manager more useful regarding code reuse for these methods. Change-Id: I9acef9ecc815df61d7ddabe3fae9eccdafe2eeed Closes-Bug: #1517631
* Sync with oslo-incubatorLin Tan2015-11-171-1/+1
| | | | | | | | | | | | | | According to the latest agreement in Oslo team, apiclient and clituils will be removed from Oslo incubator. We should keep the local copy by ourselfs: 1. rename openstack/common/apiclient to common/apiclient 2. Because Ironic only use base.py and exception.py, so delete others. 3. rename openstack/common/cliutils.py to common/clituils.py 4. Delete openstack/common/_i18n becuase we have common/i18n.py 5. Delete openstack folder because it is empty 6. Add related unit tests and add oslotest to test-requirements. Change-Id: I9eecd0457e86e82e65db1d0bc9a4c5c0ed4bbf74
* 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
* Bump hacking versionGhe Rivero2014-10-021-6/+7
| | | | | | | | 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
* Add pagination support to {node, port, chassis}-listLucas Alvares Gomes2014-07-151-6/+66
| | | | | | | | | | | | | | | | | | | | | the presence of a 'next' field is the indicator to continue pagination until there're no more values to be returned. On the CLI two new options were added to commands used to list resources: * --marker: Optional, the UUID of an item, eg the last item from a previous result set. Return the next result set. * --limit: The maximum number of results to return per request, if: 1) limit > 0, the maximum number of items to return. 2) limit == 0, return the entire list of items. 3) limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Ironic API (see Ironic's api.max_limit option). Closes-Bug: #1314992 Change-Id: I77cc7a7df65c3d2a84144b12a001487ff6832045
* 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 Resource from osloAndrey Kurilin2014-01-171-55/+2
| | | | | | | | | In the process of unification of the clients code we should reuse common functionality from Oslo. Related to blueprint common-client-library-2 Change-Id: Ide0bb6bcef845d5cf746d71eaed38d425403e17a
* Remove Python 2.4 all() implementationLucas Alvares Gomes2013-11-121-8/+0
| | | | | | | Python 2.4 is not supported neither is being tested so I think it makes sense to remove it. Change-Id: Ie3d736f9756529c6f33d0c249bf18afabad9a041
* Reorder importsGhe Rivero2013-11-111-0/+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
* Add node-set-power-state to cliLucas Alvares Gomes2013-11-011-3/+3
| | | | | | | Add the node-set-power-state command to allow changing the power state of a node using the cli. Change-Id: I176bfe54db84e1c5677f7955b9cf247f0d09be4e
* Use six.iteritems() for dictKui Shi2013-10-171-1/+2
| | | | | | | | In Python 3, dict.iteritems() is not supported anymore. Partial implement: blueprint py33-support Change-Id: Iec357ce5c5a6d2ffe4085bf26569a926e92e735a
* Implement *-update commands to resroucesLucas Alvares Gomes2013-09-301-2/+2
| | | | | | Added node-update, chassis-update and port-update commands for v1. Change-Id: I051841fce2872f1e19f95117e8827d7a2b1b521c
* Manager._list should always return a listDevananda van der Veen2013-09-191-3/+3
| | | | | | | Convert single-row result sets to dicts for consistent handling of single-element lists. Change-Id: I2fc88743f8cee0112211cd837bbfcb7d95753d3d
* Basic project structureLucas Alvares Gomes2013-09-191-0/+142
Mostly taken from other OpenStack client projects and adapted for Ironic. Change-Id: I1ef9613b9e24bbb6caac9657dc1da3add899478e