summaryrefslogtreecommitdiff
path: root/ironicclient/client.py
Commit message (Collapse)AuthorAgeFilesLines
* Allow to pass additional arguments into adapterVladyslav Drok2020-05-151-2/+11
| | | | | | | | | | | This change allows to pass additional_headers and global_request_id to keystoneauth's Adapter constructor. Also SessionClient now makes use of them while doing HTTP requests (apart from version negotitaion requests). Story: 2007611 Task: 39602 Change-Id: I75cb9311bf44cbf7f6f8737d1d37b2be503be3f9
* Get rid of the oslo.config requirementDmitry Tantsur2020-04-071-21/+21
| | | | | | | | | It is only used to populate the list of supported Session options. Use openstacksdk to create a session with all arguments instead. Since it's already a dependency of osc-lib, this changes adds no new dependencies, while substantially simplifying the code. Change-Id: I6100f94c18cbf3e90d4a6d3ec2a3fc74ebea53a5
* Provide a clear error message when using client.Client without a session4.0.0Dmitry Tantsur2020-02-101-4/+19
| | | | | | | | | Currently we fail with _construct_http_client() takes at least 1 argument. This change provides a proper TypeError and updates documentation to make it clear where a session is required. Also provided are explicit unit tests on passing a session via various means. Change-Id: I96073dc80d225a9b88fdc12bb058c0145aca623b
* Remove deprecated keystone argumentsRiccardo Pittau2019-08-211-33/+0
| | | | | | | | | Removing deprecated keystone arguments in favor of standardized argument naming. Change-Id: Ic7a0cd96c9bd0a652fec78170038fd770f6abd52 Story: 2006422 Task: 36318
* Accept 'valid_interfaces' in client setupEric Fried2019-03-071-3/+5
| | | | | | | | | | | | | | The consumer of ironicclient may be deriving their get_client kwargs from config inherited from ksa, where the 'interface' option has been deprecated in favor of 'valid_interfaces'. To accomodate this, we accept 'valid_interfaces' as a kwarg, giving it precedence over 'interface'. However, we still accept 'interface', as the consumer may be deriving kwargs from a non-conf source (such as an already-created ksa Adapter where 'valid_interfaces' has already been translated to 'interfaces'. Co-Authored-By: guang-yee <guang.yee@suse.com> Change-Id: I3b6fa53005f143d34f03bb1ed71c0aa04b7fce7b
* pass endpoint interface to http clientGuang Yee2019-03-061-2/+11
| | | | | | | | | | | | | The 'interface' argument was being ignored so that the HTTP client was always using the public endpoint for Ironic. This fixes it so that the 'interface' argument is taken into consideration. There's also no need to explicitly set the interface to 'publicURL' because that's already the default in keystoneauth. Change-Id: I610836e5038774621690aca88b2aee25670f0262 story: 2005118 task: 29802
* Switch to none auth for standalone modeVladyslav Drok2018-05-071-117/+91
| | | | | | | | | | | | | | | | | | | | | | Currently, during the ironic shell client construction, if only os_auth_token and endpoint arguments are passed, custom HTTPClient class based on requests' sessions is used. This is unnecessary, as there is admin_token auth type in keystoneauth that does basically the same, eliminating the need for our custom implementation. Apart from that, there is a none auth, which requires only passing the desired endpoint to use, so we can use it too without having to specify fake token strings anymore. Let's use these auth methods instead and deprecate HTTPClient. Also this patch deprecates a bunch of arguments to client.get_client function, changing them to the standard keystoneauth naming. DocImpact Story: 1696791 Task: 11836 Depends-On: https://review.openstack.org/559116 Change-Id: Ifc7b45d047c8882a41021e1604b74d17eac2e6e8
* Allow API user to define list of versionsJulia Kreger2018-01-181-1/+2
| | | | | | | | | | | | | | | | In cases where one may need to support multiple API micro-versions, it makes sense to allow a user to submit the list of versions their code can support, as long as they have the visibility into that version. Adds the ability to pass in a list to the os_ironic_api_version value during client initialization, and facilitate the negotiation of the highest available version. Change-Id: I0dfa3f7fe0a1e2aaf31d37c46b65cc6c064b5e86 Related-Bug: #1739440 Related-Bug: #1671145
* Facilitate latest Rest API useJulia Kreger2018-01-181-0/+5
| | | | | | | | | | | | | | | | | | | In order to provide insight into the remote API verison, we need the ability to negotiate upon the latest API version available, and then report what that version is. In order to understand if this has occured, we also need to provide insight into if version negotiation has occured. Adds logic to the session/http clients to faciltate version negotiation on the latest available version, and provide user insight into that verison. Change-Id: I813237eee4b122211f95558f677b25e0675569d5 Related-Bug: #1739440 Related-Bug: #1671145
* Fix exception message creation in get_client()Yuriy Zveryanskyy2016-12-141-1/+2
| | | | | | | Oslo i18n library does not support addition, use formatting instead. Change-Id: I5a826409e560e09fe8e3fe4f2b8d03c2cd29742f Closes-Bug: 1649898
* Use function import_versioned_module from oslo.utilsChangBo Guo(gcb)2016-11-021-2/+3
| | | | | | | | oslo.utils 3.17 provides similar function, just use it. Closes-Bug: #1627313 Change-Id: I1710faafd69cb098d603135ca8a158129edb6fec
* Set endpoint_override while doing session.requestVladyslav Drok2016-03-211-0/+3
| | | | | | | | | The recent refactor broke multi-region deployments by not using endpoint_override when doing _http_request in SessionClient. This change fixes it. Closes-bug: #1557105 Change-Id: I99cbcd34eeec1388a00d1a0d910dd5759191f954
* Use keystoneauth instead of keystoneclientVladyslav Drok2016-03-031-94/+120
| | | | | | | | | | This change also enables client to be authenticated via 'token' keystone auth method, allowing to pass os_auth_token instead of os_username and os_password. Closes-bug: #1541411 Closes-bug: #1548907 Change-Id: I9739c95069ebf8d60f8362be154844e74334beb2
* Allow to initialize keystone v3 client1.1.0Vladyslav Drok2016-01-291-7/+13
| | | | | | | | | Currently, ironic client is only able to use keystone v2 client, this change fixes it. Change-Id: I9e5cdc3ce98842eb335e1ff72975fc5f3e2abd4f Co-Authored-By: John L. Villalovos <john.l.villalovos@intel.com> Closes-bug: #1539604
* 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
* Implement and enable retries on ConflictDmitry Tantsur2015-04-171-6/+3
| | | | | | | | | | | Getting Conflict errors is pretty annoying, especially when writing automation scripts. Nova and ironic-discoverd already have their own logic for retrying on such errors. This patch adds 'max_retries' and 'retry_interval' arguments to get_client for tuning or disabling retries. Change-Id: Id9720c87ce3846faec61eb40ccf00970ca798ad2
* Use oslo.i18n libGhe Rivero2015-03-191-3/+1
| | | | | | | Stop using gettextutils from oslo.incubator and replace with the graduated library oslo.i18n Change-Id: I479be348f6e0894ecff5cd93d37ee66648f3ea01
* Fix the final PEP8 errorsJohn L. Villalovos2015-03-101-1/+1
| | | | | | | | | | | | | Fix PEP8 E126,E127,E128 errors, which were the only ones remaining. Fix PEP8 errors: E126: continuation line over-indented for hanging indent E127: continuation line over-indented for visual indent E128: continuation line under-indented for visual indent Remove the ignore= entries for flake8 in tox.ini Change-Id: I919551121d85d2aab528f4fa5ecdb3cfd940557a
* Enable ironicclient with --ironic-api-version 1.xLin Tan2015-03-061-0/+1
| | | | | | | | | | | | | python-ironic-client doesn't recognize API micro-version parameter. Reuse --ironic-api-version to recognize this. 1. The client accepts '1.x' or 'latest' as valid API version and send corresponding headers to Ironic. 2. If the user does not specify a version, client will not sent any extra headers to Ironic. It will use the minimum version. Closes-Bug: #1417430 Change-Id: I1db6e2f4e57d6d47d86f068018f143d0044b7211
* Bump hacking versionGhe Rivero2014-10-021-4/+3
| | | | | | | | 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
* ironic client to use os_region_name if providedRakesh H S2014-09-141-0/+8
| | | | | | | | | | | Currently ironicclient does not pass OS_REGION_NAME to Keystone client. That will cause problems in multiregion deployments. Modified ironicclient to consider using OS_REGION_NAME if provided. Closes-Bug: #1314159 Change-Id: I885e57973ccec64471fe2ba5fecfab2224829787
* Fix misspelled class name AmbigiousAuthSystemSergey Lupersolsky2014-08-191-1/+1
| | | | | | | | | | | | | Class name AmbigiousAuthSystem in exc.py is misspelled. To fix the issue, this patch renames AmbigiousAuthSystem to AmbiguousAuthSystem in exc.py and creates an alias for compatibility. Also edits the use of the class in client.py accordingly and adds an additional assertRaises() to test_client.py.test_get_client_no_url_and_no_token to test both the correct exception and the alias. Change-Id: I18309b045d5eb9e81c72b1ed9de350925927db66 Closes-Bug: 1356512
* Expose auth_ref in ironicclient client objectMichael Davies2014-07-101-0/+5
| | | | | | | | | To implement token expiry in Nova's Ironic driver, we need to expose additional information obtained from the keystone client. Change-Id: I14aa8aca8b83f6c9a233bb19406d03002a76f139 Partial-bug: #1308171
* 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
* Fix docstring for client.get_client()Ruby Loo2014-04-081-2/+2
| | | | | | | Fix a misspelled word and correct the description for parameter 'api_version'; the only valid value is '1' (because we only have v1). Change-Id: I51e23f783de5000df96dca26cd87244c3733d359
* Avoid traceback with insufficient auth credentialsAdam Gandelman2014-03-261-0/+9
| | | | | | | | Raise an exception if configured credentials are not sufficient for obtaining an endpoint and token. Change-Id: Ie11a25eb67da2d2c2c8ef40ab984eb2ecb77fdf9 Closes-Bug: 1290601
* Reorder importsGhe Rivero2013-11-111-1/+2
| | | | | | | | | 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
* Fixes Auth Token being sent as lambda functionKevin McDonald2013-10-291-2/+2
| | | | | Change-Id: Id6d7db4b2d3c7350147b26d42fc77f66a530a29b Closes-Bug: #1244810
* Change service_type to baremetalChris Krelle2013-09-271-1/+1
| | | | | | update default service_type to baremetal. Change-Id: I58856885268225b79218d7312472d05b0a47b5b7
* Basic project structureLucas Alvares Gomes2013-09-191-0/+98
Mostly taken from other OpenStack client projects and adapted for Ironic. Change-Id: I1ef9613b9e24bbb6caac9657dc1da3add899478e