Merge "UUID, started_at, finished_at in the status"

This commit is contained in:
Jenkins 2016-11-14 17:34:59 +00:00 committed by Gerrit Code Review
commit a7818c86b0
5 changed files with 33 additions and 4 deletions

View File

@ -44,6 +44,14 @@ Query introspection status
* ``UUID`` - Ironic node UUID. * ``UUID`` - Ironic node UUID.
Returns following information about a node introspection status:
* ``error``: an error string or ``None``
* ``finished``: ``True/False``
* ``finished_at``: an ISO8601 timestamp or ``None`` if not finished
* ``started_at``: an ISO8601 timestamp
* ``uuid``: node UUID
Retrieving introspection data Retrieving introspection data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -115,6 +115,7 @@ class ReprocessCommand(command.Command):
class StatusCommand(command.ShowOne): class StatusCommand(command.ShowOne):
"""Get introspection status.""" """Get introspection status."""
hidden_status_items = {'links'}
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(StatusCommand, self).get_parser(prog_name) parser = super(StatusCommand, self).get_parser(prog_name)
@ -124,7 +125,8 @@ class StatusCommand(command.ShowOne):
def take_action(self, parsed_args): def take_action(self, parsed_args):
client = self.app.client_manager.baremetal_introspection client = self.app.client_manager.baremetal_introspection
status = client.get_status(parsed_args.uuid) status = client.get_status(parsed_args.uuid)
return zip(*sorted(status.items())) return zip(*sorted(item for item in status.items()
if item[0] not in self.hidden_status_items))
class AbortCommand(command.Command): class AbortCommand(command.Command):

View File

@ -27,6 +27,7 @@ from oslo_concurrency import processutils
import ironic_inspector_client as client import ironic_inspector_client as client
from ironic_inspector_client.common import http from ironic_inspector_client.common import http
from ironic_inspector_client import shell
class TestV1PythonAPI(functional.Base): class TestV1PythonAPI(functional.Base):
@ -304,6 +305,14 @@ class BaseCLITest(functional.Base):
class TestCLI(BaseCLITest): class TestCLI(BaseCLITest):
def _fake_status(self, **kwargs):
# to remove the hidden fields
hidden_status_items = shell.StatusCommand.hidden_status_items
fake_status = super(TestCLI, self)._fake_status(**kwargs)
fake_status = dict(item for item in fake_status.items()
if item[0] not in hidden_status_items)
return fake_status
def test_cli_negative(self): def test_cli_negative(self):
err = self.run_cli('start', expect_error=True) err = self.run_cli('start', expect_error=True)
self.assertIn('too few arguments', err) self.assertIn('too few arguments', err)

View File

@ -25,7 +25,7 @@ from ironic_inspector_client.common.i18n import _
DEFAULT_API_VERSION = (1, 0) DEFAULT_API_VERSION = (1, 0)
"""Server API version used by default.""" """Server API version used by default."""
MAX_API_VERSION = (1, 6) MAX_API_VERSION = (1, 7)
"""Maximum API version this client was designed to work with. """Maximum API version this client was designed to work with.
This does not mean that other versions won't work at all - the server might This does not mean that other versions won't work at all - the server might
@ -138,8 +138,13 @@ class ClientV1(http.BaseClient):
:raises: :py:class:`.VersionNotSupported` if requested api_version :raises: :py:class:`.VersionNotSupported` if requested api_version
is not supported is not supported
:raises: *requests* library exception on connection problems. :raises: *requests* library exception on connection problems.
:return: dictionary with keys "finished" (True/False) and "error" :return: dictionary with the keys:
(error string or None). `error` an error string or None,
`finished` True/False,
`finished_at` an ISO8601 timestamp or None,
`links` with a self-link URL,
`started_at` an ISO8601 timestamp,
`uuid` the node UUID
""" """
if not isinstance(uuid, six.string_types): if not isinstance(uuid, six.string_types):
raise TypeError( raise TypeError(

View File

@ -0,0 +1,5 @@
---
features:
- |
the introspection status returns the ``error``, ``finished``,
``finished_at``, ``links``, ``started_at`` and ``uuid`` fields