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
This exposes the node's clean_step field by bumping the default version
from 1.6 to 1.7 and adding clean_step to various lists.
Change-Id: I2d9f2e58ed198bc8cb5bab67a6f8baf85bbbf972
Closes-Bug: #1466693
If we negotiate an API microversion in the ironiccclient, cache
this value so that we don't need to re-negotiate it again for the
next API call, if the user doesn't specify a version.
We cache the version for a particular ironic instance in a
temporary file, one per server, in a multi-user, multi-server
safe-way - deleting old files once they expire, so only the
latest is kept.
Depends-On: Icb29fdc92ecd54e388b7c16899070572458308da
Change-Id: I0232bc611789fb96491d855020042e23ba0c4fab
Blueprint: version-caching
When using the session object we want to pass through unknown kwargs to
the adapter so that keystoneclient can add new parameters as required.
This requires fixing the old options so that we can restrict what is
passed and showing a warning when there are values that are being
ignored.
Change-Id: Ia795dfc8e16c60a08df1636816daefe2ebbd0b03
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
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
The python client should catch 406 Not Acceptable errors when talking to
older versions of the server. If the user did not request a specific
version, the client should negotiate (fall back to) a mutually supported
API version with the server.
If there is no mutually supported version, or if the user specified a
version in which the requested feature is unavailable, the client should
raise an error.
This patch is a partial implementation of the client side of
auto-negotiation. It catches the 406 error and attempts to determine
what version the server is based on the returned headers. It does NOT
actually change what values are sent or returned by the client, aside
from the version headers.
Without this fix, the client fails to connect to any server version
between commit 41595327 (when v1.1 was introduced) and commit 6ecee368
(when v1.6 was introduced), because it is requesting API version 1.6
and not handling the 406 Not Acceptable response.
Note that API server versions prior to commit 32fb6e99 did not return
any version information in the header of a 406 Not Acceptable response.
To work around this, when the client receives a 406 response that does
not contain any version header, the client performs an extra GET request
to the root /v1/ URL to retrieve the supported versions. This allows the
client to work with API services that might be running unreleased
mid-kilo code as well as both stable/juno and the latest kilo code.
Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com>
Co-Authored-By: John L. Villalovos <john.l.villalovos@intel.com>
Change-Id: Iab6a0814f0db6dd6e7bfc00da28baf8403a6b1db
Blueprint: api-microversions
Partial-bug: #1441170
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
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
When the ironic-api returns an error code 400-600 when,
SessionClient faultstring did not return to the user,
it should return a detailed error message to the user,
not simply bad request.
we use the ironic node-show aa938513a-216a-49dc-b801-08119ebc2b21
SessionClient will get the below message:
"Not Found (HTTP 404)" -->
"Node a938513a-216a-49dc-b801-08119ebc2b21 could not be
found. (HTTP 404)"
Change-Id: If57fd938cdb29d0349b923ca5dc1a804f1accd9d
Closes-Bug: #1402893
log_curl_request duplicates API version when logging request (e.g.
http://192.168.122.222:6385/v1/v1/nodes/detail). Trailing API version
should be removed from the ironic endpoint when constructing logged
string.
Closes-bug: #1395740
Change-Id: Ia3fc29ed0ccaf2fbe9fea041098dcf079d711e8f
This change allows user domains and tenant/project domains to
be specified through CLI. This is necessary because keystone
v2 API is deprecatedas of Icehouse.
Change-Id: I50187a12b73777118ee77590202746b272ecc030
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
This commit removes trailing slashes and "/v1" from the endpoint
given when initializing the HTTP client, in order to fix the bug
mentioned below. It also removes the rstrip call in
_make_connection_url, since this is done up front now.
Also adds tests for get_connection_params.
Change-Id: If2c2cd766466dca4621e8daa260575fd4f106f06
Closes-Bug: #1342048
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
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
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 use of py3kcompat module, which has been removed from oslo-incubator.
Replace it with six, which is already in the dependencies.
Update common apiclient from Oslo for that. I've updated
to oslo-incubator of commit 04a1abe59ac39890f57d2eed57d3d1b12bb5d757
List of recent changes:
04a1abe Revert "Removed set_loaded() method from Resource class"
86707cd Remove None for dict.get()
6650435 Fix usage of dict.keys in apiclient.exceptions
35dc1d7 py3kcompat: remove
Change-Id: Iab72688ea3ae7ff4c9c707b7939e1a12ff1a72b2
Response 'debuginfo' is used to carry server traceback in case of
error. If 'debuginfo' is not empty, append it to exception message,
so traceback will be printed together with message.
Change-Id: Id7900b64ec7fc9f906253ef0e2d754c2baa76067
Closes-Bug: #1255590
Import httplib from six.moves
Use six.StringIO to replace StringIO
Partial implement: blueprint py33-support
Change-Id: Ic20ce1139d1b296c7cbb666a200b2d9260764636
When an error occur instead of just return the HTTP response code the
client will now try to extract the error message that contains the reason
of the problem and show it to the user in a user-friendly way (no codes
at all), the intention of this patch is to improve the usability of the
ironic client. Things like HTTP response codes can still be viewed when
used with the debug mode enabled ( -d ).
Change-Id: Ieca021cc0e0eabe91c13335c3062ef9622da3004