From bdbb6aa018784c398a9cd4d6c2662b9c9824941b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 11 Sep 2013 16:32:27 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/command.py | 10 ++++++++++ pyghmi/ipmi/console.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index a8051b9c..eed1102b 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -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. diff --git a/pyghmi/ipmi/console.py b/pyghmi/ipmi/console.py index 167147ae..4669a5c0 100644 --- a/pyghmi/ipmi/console.py +++ b/pyghmi/ipmi/console.py @@ -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