Renaming get_configuration to lookup_node

This commit is contained in:
Josh Gachnang 2014-03-18 10:36:33 -07:00
parent 4174fa4311
commit 22f3ccd3dc
4 changed files with 11 additions and 11 deletions

View File

@ -212,7 +212,7 @@ class TeethAgent(object):
self.started_at = _time()
# Get the UUID so we can heartbeat to Ironic
mac_addresses = self.get_all_mac_addrs()
self.configuration = self.api_client.get_configuration(
self.configuration = self.api_client.lookup_node(
mac_addresses,
ipaddr=self.ipaddr,
hardware_info=self.hardware.list_hardware_info(),

View File

@ -69,7 +69,7 @@ class APIClient(object):
except Exception:
raise errors.HeartbeatError('Invalid Heartbeat-Before header')
def get_configuration(self, mac_addrs, ipaddr, hardware_info, mode,
def lookup_node(self, mac_addrs, ipaddr, hardware_info, mode,
version):
path = '/{api_version}/drivers/teeth/lookup'.format(
api_version=self.api_version)

View File

@ -162,7 +162,7 @@ class TestBaseAgent(unittest.TestCase):
wsgi_server.start.side_effect = KeyboardInterrupt()
self.agent.heartbeater = mock.Mock()
self.agent.api_client.get_configuration = mock.Mock()
self.agent.api_client.lookup_node = mock.Mock()
self.agent.run()
listen_addr = ('localhost', 9999)

View File

@ -92,7 +92,7 @@ class TestBaseTeethAgent(unittest.TestCase):
self.api_client.heartbeat,
uuid='fake-uuid')
def test_get_configuration(self):
def test_lookup_node(self):
response = httmock.response(status_code=200, content={
'node': {
'uuid': 'fake-uuid'
@ -102,7 +102,7 @@ class TestBaseTeethAgent(unittest.TestCase):
self.api_client.session.request = mock.Mock()
self.api_client.session.request.return_value = response
self.api_client.get_configuration(
self.api_client.lookup_node(
mac_addrs=['aa:bb:cc:dd:ee:ff', '42:42:42:42:42:42'],
ipaddr='42.42.42.42',
hardware_info=self.hardware_info,
@ -130,7 +130,7 @@ class TestBaseTeethAgent(unittest.TestCase):
])
self.assertEqual(content['agent_url'], 'http://42.42.42.42:9999')
def test_get_configuration_bad_response_code(self):
def test_lookup_node_bad_response_code(self):
response = httmock.response(status_code=400, content={
'node': {
'uuid': 'fake-uuid'
@ -141,7 +141,7 @@ class TestBaseTeethAgent(unittest.TestCase):
self.api_client.session.request.return_value = response
self.assertRaises(errors.ConfigurationError,
self.api_client.get_configuration,
self.api_client.lookup_node,
mac_addrs=['aa:bb:cc:dd:ee:ff',
'42:42:42:42:42:42'],
ipaddr='42.42.42.42',
@ -150,14 +150,14 @@ class TestBaseTeethAgent(unittest.TestCase):
mode='STANDBY',
)
def test_get_configuration_bad_response_data(self):
def test_lookup_node_bad_response_data(self):
response = httmock.response(status_code=200, content='a')
self.api_client.session.request = mock.Mock()
self.api_client.session.request.return_value = response
self.assertRaises(errors.ConfigurationError,
self.api_client.get_configuration,
self.api_client.lookup_node,
mac_addrs=['aa:bb:cc:dd:ee:ff',
'42:42:42:42:42:42'],
ipaddr='42.42.42.42',
@ -166,7 +166,7 @@ class TestBaseTeethAgent(unittest.TestCase):
mode='STANDBY',
)
def test_get_configuration_bad_response_body(self):
def test_lookup_node_bad_response_body(self):
response = httmock.response(status_code=200, content={
'node_node': 'also_not_node'
})
@ -175,7 +175,7 @@ class TestBaseTeethAgent(unittest.TestCase):
self.api_client.session.request.return_value = response
self.assertRaises(errors.ConfigurationError,
self.api_client.get_configuration,
self.api_client.lookup_node,
mac_addrs=['aa:bb:cc:dd:ee:ff',
'42:42:42:42:42:42'],
ipaddr='42.42.42.42',