1818import threading
1919import time
2020
21+ from ironic_python_agent .api import app
22+ from ironic_python_agent import base
23+ from ironic_python_agent import encoding
24+ from ironic_python_agent import errors
25+ from ironic_python_agent import hardware
26+ from ironic_python_agent import ironic_api_client
27+ from ironic_python_agent .openstack .common import log
28+ from ironic_python_agent import utils
29+
2130import pkg_resources
2231from stevedore import driver
2332from wsgiref import simple_server
2433
25- from teeth_agent .api import app
26- from teeth_agent import base
27- from teeth_agent import encoding
28- from teeth_agent import errors
29- from teeth_agent import hardware
30- from teeth_agent .openstack .common import log
31- from teeth_agent import overlord_agent_api
32- from teeth_agent import utils
33-
3434
3535def _time ():
3636 """Wraps time.time() for simpler testing."""
3737 return time .time ()
3838
3939
40- class TeethAgentStatus (encoding .Serializable ):
40+ class IronicPythonAgentStatus (encoding .Serializable ):
4141 def __init__ (self , mode , started_at , version ):
4242 self .mode = mode
4343 self .started_at = started_at
@@ -52,7 +52,7 @@ def serialize(self):
5252 ])
5353
5454
55- class TeethAgentHeartbeater (threading .Thread ):
55+ class IronicPythonAgentHeartbeater (threading .Thread ):
5656 # If we could wait at most N seconds between heartbeats (or in case of an
5757 # error) we will instead wait r x N seconds, where r is a random value
5858 # between these multipliers.
@@ -67,10 +67,10 @@ class TeethAgentHeartbeater(threading.Thread):
6767 backoff_factor = 2.7
6868
6969 def __init__ (self , agent ):
70- super (TeethAgentHeartbeater , self ).__init__ ()
70+ super (IronicPythonAgentHeartbeater , self ).__init__ ()
7171 self .agent = agent
7272 self .hardware = hardware .get_manager ()
73- self .api = overlord_agent_api .APIClient (agent .api_url )
73+ self .api = ironic_api_client .APIClient (agent .api_url )
7474 self .log = log .getLogger (__name__ )
7575 self .stop_event = threading .Event ()
7676 self .error_delay = self .initial_delay
@@ -111,17 +111,18 @@ def stop(self):
111111 return self .join ()
112112
113113
114- class TeethAgent (object ):
114+ class IronicPythonAgent (object ):
115115 def __init__ (self , api_url , advertise_address , listen_address ):
116116 self .api_url = api_url
117- self .api_client = overlord_agent_api .APIClient (self .api_url )
117+ self .api_client = ironic_api_client .APIClient (self .api_url )
118118 self .listen_address = listen_address
119119 self .advertise_address = advertise_address
120120 self .mode_implementation = None
121- self .version = pkg_resources .get_distribution ('teeth-agent' ).version
121+ self .version = pkg_resources .get_distribution ('ironic-python-agent' )\
122+ .version
122123 self .api = app .VersionSelectorApplication (self )
123124 self .command_results = utils .get_ordereddict ()
124- self .heartbeater = TeethAgentHeartbeater (self )
125+ self .heartbeater = IronicPythonAgentHeartbeater (self )
125126 self .hardware = hardware .get_manager ()
126127 self .command_lock = threading .Lock ()
127128 self .log = log .getLogger (__name__ )
@@ -136,7 +137,7 @@ def get_mode_name(self):
136137
137138 def get_status (self ):
138139 """Retrieve a serializable status."""
139- return TeethAgentStatus (
140+ return IronicPythonAgentStatus (
140141 mode = self .get_mode_name (),
141142 started_at = self .started_at ,
142143 version = self .version
@@ -209,7 +210,7 @@ def execute_command(self, command_name, **kwargs):
209210 return result
210211
211212 def run (self ):
212- """Run the Teeth Agent."""
213+ """Run the Ironic Python Agent."""
213214 self .started_at = _time ()
214215 # Get the UUID so we can heartbeat to Ironic
215216 self .node = self .api_client .lookup_node (
@@ -232,7 +233,7 @@ def run(self):
232233
233234def _load_mode_implementation (mode_name ):
234235 mgr = driver .DriverManager (
235- namespace = 'teeth_agent .modes' ,
236+ namespace = 'ironic_python_agent .modes' ,
236237 name = mode_name .lower (),
237238 invoke_on_load = True ,
238239 invoke_args = [],
@@ -246,6 +247,6 @@ def build_agent(api_url,
246247 listen_host ,
247248 listen_port ):
248249
249- return TeethAgent (api_url ,
250- (advertise_host , advertise_port ),
251- (listen_host , listen_port ))
250+ return IronicPythonAgent (api_url ,
251+ (advertise_host , advertise_port ),
252+ (listen_host , listen_port ))
0 commit comments