fix configdrive content location
This commit is contained in:
parent
8fcb1ead09
commit
f0a2a78623
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user