From 22f3ccd3dc557418e338b33aaac2f477475298df Mon Sep 17 00:00:00 2001 From: Josh Gachnang Date: Tue, 18 Mar 2014 10:36:33 -0700 Subject: [PATCH] Renaming get_configuration to lookup_node --- teeth_agent/agent.py | 2 +- teeth_agent/overlord_agent_api.py | 2 +- teeth_agent/tests/agent.py | 2 +- teeth_agent/tests/overlord_agent_api.py | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/teeth_agent/agent.py b/teeth_agent/agent.py index aecca1c75..bc0c20f71 100644 --- a/teeth_agent/agent.py +++ b/teeth_agent/agent.py @@ -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(), diff --git a/teeth_agent/overlord_agent_api.py b/teeth_agent/overlord_agent_api.py index 21984faf0..ff37c2f8d 100644 --- a/teeth_agent/overlord_agent_api.py +++ b/teeth_agent/overlord_agent_api.py @@ -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) diff --git a/teeth_agent/tests/agent.py b/teeth_agent/tests/agent.py index cd880eb8a..4d57c05a2 100644 --- a/teeth_agent/tests/agent.py +++ b/teeth_agent/tests/agent.py @@ -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) diff --git a/teeth_agent/tests/overlord_agent_api.py b/teeth_agent/tests/overlord_agent_api.py index 5d61cef2b..57cdf7d81 100644 --- a/teeth_agent/tests/overlord_agent_api.py +++ b/teeth_agent/tests/overlord_agent_api.py @@ -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',