diff options
Diffstat (limited to 'ironic_python_agent/agent.py')
| -rw-r--r-- | ironic_python_agent/agent.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ironic_python_agent/agent.py b/ironic_python_agent/agent.py index 079a323c..5bf2eeca 100644 --- a/ironic_python_agent/agent.py +++ b/ironic_python_agent/agent.py @@ -121,6 +121,9 @@ class IronicPythonAgentHeartbeater(threading.Thread): self.error_delay = min(self.error_delay * self.backoff_factor, self.max_delay) + def force_heartbeat(self): + os.write(self.writer, 'b') + def stop(self): """Stop the heartbeat thread.""" if self.writer is not None: @@ -140,6 +143,7 @@ class IronicPythonAgent(base.ExecuteCommandMixin): namespace='ironic_python_agent.extensions', invoke_on_load=True, propagate_map_exceptions=True, + invoke_kwds={'agent': self}, ) self.api_url = api_url self.driver_name = driver_name @@ -262,6 +266,9 @@ class IronicPythonAgent(base.ExecuteCommandMixin): raise errors.RequestedObjectNotFoundError('Command Result', result_id) + def force_heartbeat(self): + self.heartbeater.force_heartbeat() + def run(self): """Run the Ironic Python Agent.""" # Get the UUID so we can heartbeat to Ironic. Raises LookupNodeError |
