@@ -5145,6 +5145,7 @@ def path(self, which=None):
51455145 'smart_class_parameters' ,
51465146 'module_streams' ,
51475147 'disassociate' ,
5148+ 'status' ,
51485149 'traces' ,
51495150 'traces/resolve' ,
51505151 'template' ,
@@ -5440,6 +5441,33 @@ def list_provisioning_templates(self, synchronous=True, timeout=None, **kwargs):
54405441 response = client .get (self .path ('templates' ), ** kwargs )
54415442 return _handle_response (response , self ._server_config , synchronous , timeout )['templates' ]
54425443
5444+ def read_status (self , synchronous = True , timeout = None , ** kwargs ):
5445+ """Fetch and read the status for given host.
5446+
5447+ Here is an example of how to use this method::
5448+ host.read_status(data={'status_type': 'traces'})
5449+
5450+ Constructs path:
5451+ api/hosts/:id/status/:type
5452+
5453+ :param synchronous: What should happen if the server returns an HTTP
5454+ 202 (accepted) status code? Wait for the task to complete if
5455+ ``True``. Immediately return the server's response otherwise.
5456+ :param timeout: Maximum number of seconds to wait until timing out.
5457+ Defaults to ``nailgun.entity_mixins.TASK_TIMEOUT``.
5458+ :param kwargs: Arguments to pass to requests.
5459+ :returns: The server's response, with all content decoded.
5460+ :raises: ``requests.exceptions.HTTPError`` If the server responds with
5461+ an HTTP 4XX or 5XX message.
5462+
5463+ """
5464+ kwargs = kwargs .copy ()
5465+ kwargs .update (self ._server_config .get_client_kwargs ())
5466+ status_type = f'{ kwargs ["data" ].pop ("status_type" )} '
5467+ path = f'{ self .path ("status" )} /{ status_type } '
5468+ response = client .get (path , ** kwargs )
5469+ return _handle_response (response , self ._server_config , synchronous , timeout )
5470+
54435471
54445472class Image (
54455473 Entity ,
0 commit comments