use openstack as default configdrive prefix
This commit is contained in:
@@ -31,7 +31,7 @@ class ConfigDriveWriter(object):
|
|||||||
def add_file(self, filepath, contents):
|
def add_file(self, filepath, contents):
|
||||||
self.files[filepath] = contents
|
self.files[filepath] = contents
|
||||||
|
|
||||||
def write(self, location, prefix='teeth', version='latest'):
|
def write(self, location, prefix='openstack', version='latest'):
|
||||||
metadata = {}
|
metadata = {}
|
||||||
for k, v in self.metadata.iteritems():
|
for k, v in self.metadata.iteritems():
|
||||||
metadata[k] = v
|
metadata[k] = v
|
||||||
@@ -60,7 +60,7 @@ class ConfigDriveWriter(object):
|
|||||||
f.write(json_metadata)
|
f.write(json_metadata)
|
||||||
|
|
||||||
|
|
||||||
def write_configdrive(location, metadata, files, prefix='teeth',
|
def write_configdrive(location, metadata, files, prefix='openstack',
|
||||||
version='latest'):
|
version='latest'):
|
||||||
"""Generates and writes a valid configdrive to `location`.
|
"""Generates and writes a valid configdrive to `location`.
|
||||||
`files` are passed in as a dict {path: base64_contents}.
|
`files` are passed in as a dict {path: base64_contents}.
|
||||||
@@ -74,4 +74,4 @@ def write_configdrive(location, metadata, files, prefix='teeth',
|
|||||||
contents = base64.b64decode(b64_contents)
|
contents = base64.b64decode(b64_contents)
|
||||||
writer.add_file(path, contents)
|
writer.add_file(path, contents)
|
||||||
|
|
||||||
writer.write(location)
|
writer.write(location, prefix=prefix, version=version)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class ConfigDriveWriterTestCase(unittest.TestCase):
|
|||||||
{'content_path': '/content/0001', 'path': '/etc/conf1'},
|
{'content_path': '/content/0001', 'path': '/etc/conf1'},
|
||||||
]
|
]
|
||||||
|
|
||||||
self.writer.write('/lol', prefix='teeth', version='latest')
|
self.writer.write('/lol', prefix='openstack', version='latest')
|
||||||
|
|
||||||
# have to pull out the JSON passed to write and parse it
|
# have to pull out the JSON passed to write and parse it
|
||||||
# because arbitrary dictionary ordering, etc
|
# because arbitrary dictionary ordering, etc
|
||||||
@@ -91,7 +91,7 @@ class ConfigDriveWriterTestCase(unittest.TestCase):
|
|||||||
mock.call('/lol/content/0001', 'wb'),
|
mock.call('/lol/content/0001', 'wb'),
|
||||||
mock.call().write('contents1'),
|
mock.call().write('contents1'),
|
||||||
mock.call().__exit__(None, None, None),
|
mock.call().__exit__(None, None, None),
|
||||||
mock.call('/lol/teeth/latest/meta_data.json', 'wb'),
|
mock.call('/lol/openstack/latest/meta_data.json', 'wb'),
|
||||||
# already checked
|
# already checked
|
||||||
mock.call().write(mock.ANY),
|
mock.call().write(mock.ANY),
|
||||||
mock.call().__exit__(None, None, None),
|
mock.call().__exit__(None, None, None),
|
||||||
@@ -117,7 +117,7 @@ class ConfigDriveWriterTestCase(unittest.TestCase):
|
|||||||
configdrive.write_configdrive('/lol',
|
configdrive.write_configdrive('/lol',
|
||||||
metadata,
|
metadata,
|
||||||
files,
|
files,
|
||||||
prefix='teeth',
|
prefix='openstack',
|
||||||
version='latest')
|
version='latest')
|
||||||
|
|
||||||
# have to pull out the JSON passed to write and parse it
|
# have to pull out the JSON passed to write and parse it
|
||||||
@@ -134,7 +134,7 @@ class ConfigDriveWriterTestCase(unittest.TestCase):
|
|||||||
mock.call('/lol/content/0001', 'wb'),
|
mock.call('/lol/content/0001', 'wb'),
|
||||||
mock.call().write('contents1'),
|
mock.call().write('contents1'),
|
||||||
mock.call().__exit__(None, None, None),
|
mock.call().__exit__(None, None, None),
|
||||||
mock.call('/lol/teeth/latest/meta_data.json', 'wb'),
|
mock.call('/lol/openstack/latest/meta_data.json', 'wb'),
|
||||||
# already checked
|
# already checked
|
||||||
mock.call().write(mock.ANY),
|
mock.call().write(mock.ANY),
|
||||||
mock.call().__exit__(None, None, None),
|
mock.call().__exit__(None, None, None),
|
||||||
|
|||||||
Reference in New Issue
Block a user