2
0
mirror of https://opendev.org/x/pyghmi synced 2026-03-30 23:03:31 +00:00

Expose wait_for_rsp class method via public classes.

In complicated uses of pyghmi, it becomes useful to call into the
otherwise private event loop iteration.  This exposes the
wait_for_rsp method so that it may be consumed without violating
the expectations of private.

Change-Id: Iee64615f0577b00895f8c3db25676c877107b0be
This commit is contained in:
Jarrod Johnson
2013-09-11 16:32:27 -04:00
parent f24395bbee
commit bdbb6aa018
2 changed files with 20 additions and 0 deletions

View File

@@ -98,6 +98,16 @@ class Command(object):
while (session.Session.wait_for_rsp()):
pass
@classmethod
def wait_for_rsp(cls, timeout):
"""Delay for no longer than timeout for next response.
This acts like a sleep that exits on activity.
:param timeout: Maximum number of seconds before returning
"""
return session.Session.wait_for_rsp(timeout=timeout)
def get_bootdev(self):
"""Get current boot device override information.

View File

@@ -156,6 +156,16 @@ class Console(object):
if not self.awaitingack:
self._sendpendingoutput()
@classmethod
def wait_for_rsp(cls, timeout):
"""Delay for no longer than timeout for next response.
This acts like a sleep that exits on activity.
:param timeout: Maximum number of seconds before returning
"""
return session.Session.wait_for_rsp(timeout=timeout)
def _sendpendingoutput(self):
self.myseq += 1
self.myseq &= 0xf