Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions coriolis/osmorphing/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ def _write_local_script(self, base_dir, script_path, priority=50):

def _write_cloudbase_init_conf(self, cloudbaseinit_base_dir,
local_base_dir, com_port="COM1",
metadata_services=None, plugins=None):
metadata_services=None, plugins=None,
real_time_clock_utc: bool = False):
Comment thread
fabi200123 marked this conversation as resolved.
if metadata_services is None:
metadata_services = CLOUDBASE_INIT_DEFAULT_METADATA_SVCS

Expand Down Expand Up @@ -537,13 +538,15 @@ def _write_cloudbase_init_conf(self, cloudbaseinit_base_dir,
"debug = true\r\n"
"san_policy = OnlineAll\r\n"
"metadata_services = %(metadata_services)s\r\n"
"logging_serial_port_settings = %(com_port)s,9600,N,8\r\n" %
"logging_serial_port_settings = %(com_port)s,9600,N,8\r\n"
"real_time_clock_utc = %(real_time_clock_utc)s\r\n" %
{"bin_path": "%s\\Bin" % local_base_dir,
"log_path": "%s\\Log" % local_base_dir,
"scripts_path": "%s\\LocalScripts" % local_base_dir,
"com_port": com_port,
"metadata_services": ",".join(metadata_services),
"plugins": ",".join(plugins)})
"plugins": ",".join(plugins),
"real_time_clock_utc": real_time_clock_utc})

utils.write_winrm_file(
self._conn,
Expand All @@ -560,7 +563,8 @@ def _write_cloudbase_init_conf(self, cloudbaseinit_base_dir,

def _install_cloudbase_init(self, download_url,
metadata_services=None, enabled_plugins=None,
com_port="COM1"):
com_port="COM1",
real_time_clock_utc: bool = False):
self._event_manager.progress_update("Adding cloudbase-init")
cloudbaseinit_base_dir = self._get_cbslinit_base_dir()

Expand Down Expand Up @@ -589,7 +593,8 @@ def _install_cloudbase_init(self, download_url,
self._write_cloudbase_init_conf(
cloudbaseinit_base_dir, local_base_dir,
metadata_services=metadata_services,
plugins=enabled_plugins, com_port=com_port)
plugins=enabled_plugins, com_port=com_port,
real_time_clock_utc=real_time_clock_utc)

image_path = (
'"%(path)s\\Bin\\OpenStackService.exe" cloudbase-init '
Expand Down
12 changes: 8 additions & 4 deletions coriolis/tests/osmorphing/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,16 @@ def test__write_cloudbase_init_conf(
"debug = true\r\n"
"san_policy = OnlineAll\r\n"
"metadata_services = %(metadata_services)s\r\n"
"logging_serial_port_settings = %(com_port)s,9600,N,8\r\n" %
"logging_serial_port_settings = %(com_port)s,9600,N,8\r\n"
"real_time_clock_utc = %(real_time_clock_utc)s\r\n" %
{"bin_path": "%s\\Bin" % local_base_dir,
"log_path": "%s\\Log" % local_base_dir,
"scripts_path": "%s\\LocalScripts" % local_base_dir,
"com_port": 'COM1',
"metadata_services": ",".join(
windows.CLOUDBASE_INIT_DEFAULT_METADATA_SVCS),
"plugins": ",".join(windows.CLOUDBASE_INIT_DEFAULT_PLUGINS)})
"plugins": ",".join(windows.CLOUDBASE_INIT_DEFAULT_PLUGINS),
"real_time_clock_utc": False})

mock_write_winrm_file.assert_called_once_with(
self.conn, conf_file_path, conf_content)
Expand Down Expand Up @@ -604,7 +606,8 @@ def test__install_cloudbase_init(

mock_write_cloudbase_init_conf.assert_called_once_with(
cloudbaseinit_base_dir, local_base_dir,
metadata_services=None, plugins=None, com_port='COM1')
metadata_services=None, plugins=None, com_port='COM1',
real_time_clock_utc=False)
mock_check_cloudbase_init_exists.assert_called_once_with(
str(mock_uuid4.return_value))

Expand Down Expand Up @@ -678,7 +681,8 @@ def test_install_cloudbase_init_existing_service(

mock_write_cloudbase_init_conf.assert_called_once_with(
cloudbaseinit_base_dir, local_base_dir,
metadata_services=None, plugins=None, com_port='COM1')
metadata_services=None, plugins=None, com_port='COM1',
real_time_clock_utc=False)
mock_setup_existing_cbslinit_service.assert_called_once_with(
str(mock_uuid4.return_value), expected_image_path)
mock_create_service.assert_not_called()
Expand Down
Loading