From f0a2a78623d0b5c058c03f79ecab6e59d7077674 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Mon, 27 Jan 2014 15:38:20 -0800 Subject: [PATCH] fix configdrive content location --- teeth_agent/configdrive.py | 4 ++-- teeth_agent/tests/configdrive.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/teeth_agent/configdrive.py b/teeth_agent/configdrive.py index 8199ddd66..a65522e45 100644 --- a/teeth_agent/configdrive.py +++ b/teeth_agent/configdrive.py @@ -33,7 +33,7 @@ class ConfigDriveWriter(object): def write(self, location, prefix='openstack', version='latest'): os.makedirs(os.path.join(location, prefix, version)) - os.makedirs(os.path.join(location, 'content')) + os.makedirs(os.path.join(location, prefix, 'content')) metadata = {} for k, v in self.metadata.iteritems(): @@ -50,7 +50,7 @@ class ConfigDriveWriter(object): } metadata['files'].append(file_info) - content_path = os.path.join(location, content_path[1:]) + content_path = os.path.join(location, prefix, content_path[1:]) with open(content_path, 'wb') as f: f.write(contents) diff --git a/teeth_agent/tests/configdrive.py b/teeth_agent/tests/configdrive.py index ef8f2a165..226559667 100644 --- a/teeth_agent/tests/configdrive.py +++ b/teeth_agent/tests/configdrive.py @@ -55,7 +55,7 @@ class ConfigDriveWriterTestCase(unittest.TestCase): write_mock.assert_called_once_with(json_metadata) makedirs_calls = [ mock.call('/lol/teeth/latest'), - mock.call('/lol/content') + mock.call('/lol/teeth/content') ] self.assertEqual(makedirs_calls, makedirs_mock.call_args_list) @@ -92,10 +92,10 @@ class ConfigDriveWriterTestCase(unittest.TestCase): self.assertEqual(data, metadata) open_calls = [ - mock.call('/lol/content/0000', 'wb'), + mock.call('/lol/openstack/content/0000', 'wb'), mock.call().write('contents0'), mock.call().__exit__(None, None, None), - mock.call('/lol/content/0001', 'wb'), + mock.call('/lol/openstack/content/0001', 'wb'), mock.call().write('contents1'), mock.call().__exit__(None, None, None), mock.call('/lol/openstack/latest/meta_data.json', 'wb'), @@ -107,7 +107,7 @@ class ConfigDriveWriterTestCase(unittest.TestCase): makedirs_calls = [ mock.call('/lol/openstack/latest'), - mock.call('/lol/content') + mock.call('/lol/openstack/content') ] self.assertEqual(makedirs_calls, makedirs_mock.call_args_list) @@ -142,10 +142,10 @@ class ConfigDriveWriterTestCase(unittest.TestCase): self.assertEqual(data, metadata) open_calls = [ - mock.call('/lol/content/0000', 'wb'), + mock.call('/lol/openstack/content/0000', 'wb'), mock.call().write('contents0'), mock.call().__exit__(None, None, None), - mock.call('/lol/content/0001', 'wb'), + mock.call('/lol/openstack/content/0001', 'wb'), mock.call().write('contents1'), mock.call().__exit__(None, None, None), mock.call('/lol/openstack/latest/meta_data.json', 'wb'), @@ -157,6 +157,6 @@ class ConfigDriveWriterTestCase(unittest.TestCase): makedirs_calls = [ mock.call('/lol/openstack/latest'), - mock.call('/lol/content') + mock.call('/lol/openstack/content') ] self.assertEqual(makedirs_calls, makedirs_mock.call_args_list)