Load Hardware Managers at runtime

Hardware managers should load at runtime. This will ensure the agent is
ready to respond to API calls before it begins heartbeating. Also, it
means in case of a syntax or other error in a HardwareManager, the agent
will crash before it heartbeats, which is better than it working until a
hardware manager method is needed.

Change-Id: I9403ce7bedc8d5af20b6d84371367253b26b74c2
Closes-bug: 1490008
This commit is contained in:
Jay Faulkner
2015-08-28 13:31:54 -07:00
parent 3de3ca3b22
commit 09221f98cb
2 changed files with 16 additions and 0 deletions
ironic_python_agent

@ -275,6 +275,10 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
# Get the UUID so we can heartbeat to Ironic. Raises LookupNodeError
# if there is an issue (uncaught, restart agent)
self.started_at = _time()
# Cached hw managers at runtime, not load time. See bug 1490008.
hardware.load_managers()
if not self.standalone:
content = self.api_client.lookup_node(
hardware_info=hardware.dispatch_to_managers(