diff --git a/cloudbaseinit/osutils/windows.py b/cloudbaseinit/osutils/windows.py index fc7597bc..f406ec69 100644 --- a/cloudbaseinit/osutils/windows.py +++ b/cloudbaseinit/osutils/windows.py @@ -789,9 +789,9 @@ def set_ntp_client_config(self, ntp_hosts): # Convert the NTP hosts list to a string, in order to pass # it to w32tm. - ntp_hosts = ",".join(ntp_hosts) + ntp_hosts = " ".join(ntp_hosts) - args = [w32tm_path, '/config', '/manualpeerlist:%s' % ntp_hosts, + args = [w32tm_path, '/config', '/manualpeerlist:"%s"' % ntp_hosts, '/syncfromflags:manual', '/update'] (out, err, ret_val) = self.execute_process(args, shell=False) diff --git a/cloudbaseinit/tests/osutils/test_windows.py b/cloudbaseinit/tests/osutils/test_windows.py index c6a10657..9b64890f 100644 --- a/cloudbaseinit/tests/osutils/test_windows.py +++ b/cloudbaseinit/tests/osutils/test_windows.py @@ -2073,7 +2073,7 @@ def _test_set_ntp_client_config(self, mock_execute_process, mock_get_system32_dir.return_value = fake_base_dir args = [w32tm_path, '/config', - '/manualpeerlist:%s' % ",".join(ntp_hosts), + '/manualpeerlist:"%s"' % " ".join(ntp_hosts), '/syncfromflags:manual', '/update'] if ret_val: