Version node lookup payload

This payload may change over time and should be versioned.
Corresponds to https://review.openstack.org/#/c/85228/

Change-Id: I58b1d69a2c41ff105038178632e289cb4b12c971
This commit is contained in:
Jim Rollenhagen 2014-04-08 13:16:46 -07:00
parent 7554b78d76
commit b826a72a7b
2 changed files with 5 additions and 2 deletions

View File

@ -25,6 +25,7 @@ from ironic_python_agent.openstack.common import loopingcall
class APIClient(object): class APIClient(object):
api_version = 'v1' api_version = 'v1'
payload_version = '1'
def __init__(self, api_url): def __init__(self, api_url):
self.api_url = api_url.rstrip('/') self.api_url = api_url.rstrip('/')
@ -116,7 +117,8 @@ class APIClient(object):
# This hardware won't be saved on the node currently, because of # This hardware won't be saved on the node currently, because of
# how driver_vendor_passthru is implemented (no node saving). # how driver_vendor_passthru is implemented (no node saving).
data = { data = {
'hardware': hardware_info 'version': self.payload_version,
'inventory': hardware_info
} }
# Make the POST, make sure we get back normal data/status codes and # Make the POST, make sure we get back normal data/status codes and

View File

@ -173,7 +173,8 @@ class TestBaseIronicPythonAgent(test_base.BaseTestCase):
data = self.api_client.session.request.call_args[1]['data'] data = self.api_client.session.request.call_args[1]['data']
content = json.loads(data) content = json.loads(data)
self.assertEqual(content['hardware'], [ self.assertEqual(content['version'], self.api_client.payload_version)
self.assertEqual(content['inventory'], [
{ {
'type': 'mac_address', 'type': 'mac_address',
'id': 'aa:bb:cc:dd:ee:ff', 'id': 'aa:bb:cc:dd:ee:ff',