Skip to content

Commit 9648440

Browse files
committed
Fix Windows NTP server concatenation
Ensure the list of NTP servers is space delimited
1 parent 1c50eaa commit 9648440

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

cloudbaseinit/osutils/windows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,9 @@ def set_ntp_client_config(self, ntp_hosts):
789789

790790
# Convert the NTP hosts list to a string, in order to pass
791791
# it to w32tm.
792-
ntp_hosts = ",".join(ntp_hosts)
792+
ntp_hosts = " ".join(ntp_hosts)
793793

794-
args = [w32tm_path, '/config', '/manualpeerlist:%s' % ntp_hosts,
794+
args = [w32tm_path, '/config', '/manualpeerlist:"%s"' % ntp_hosts,
795795
'/syncfromflags:manual', '/update']
796796

797797
(out, err, ret_val) = self.execute_process(args, shell=False)

cloudbaseinit/tests/osutils/test_windows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ def _test_set_ntp_client_config(self, mock_execute_process,
20732073
mock_get_system32_dir.return_value = fake_base_dir
20742074

20752075
args = [w32tm_path, '/config',
2076-
'/manualpeerlist:%s' % ",".join(ntp_hosts),
2076+
'/manualpeerlist:"%s"' % " ".join(ntp_hosts),
20772077
'/syncfromflags:manual', '/update']
20782078

20792079
if ret_val:

0 commit comments

Comments
 (0)