From 9648440f51fdcea47613af75d6d8635d3f3014d9 Mon Sep 17 00:00:00 2001 From: Curt Moore Date: Mon, 16 Mar 2026 11:28:38 -0500 Subject: [PATCH] Fix Windows NTP server concatenation Ensure the list of NTP servers is space delimited --- cloudbaseinit/osutils/windows.py | 4 ++-- cloudbaseinit/tests/osutils/test_windows.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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: