From 00f995f5cd21aab45dad3125636b7dda58bc296b Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Wed, 26 Aug 2015 15:03:46 +0300 Subject: [PATCH] Service triggers are available since 6.1, not 6.0 Enable service triggers only for Windows 6.1, which doesn't include Windows Vista and Windows 2008. This patch prevents a hang on these older OSes, because sc.exe will wait for user input before exiting. Change-Id: Ia245f086db9bf4b22f492f2cca52f3bd8ea5edae --- cloudbaseinit/plugins/windows/ntpclient.py | 2 +- cloudbaseinit/tests/plugins/windows/test_ntpclient.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudbaseinit/plugins/windows/ntpclient.py b/cloudbaseinit/plugins/windows/ntpclient.py index 14f0c01e..4c71d675 100644 --- a/cloudbaseinit/plugins/windows/ntpclient.py +++ b/cloudbaseinit/plugins/windows/ntpclient.py @@ -48,7 +48,7 @@ class NTPClientPlugin(ntpclient.NTPClientPlugin): _W32TIME_SERVICE, osutils.SERVICE_START_MODE_AUTOMATIC) - if osutils.check_os_version(6, 0): + if osutils.check_os_version(6, 1): self._set_ntp_trigger_mode(osutils) svc_status = osutils.get_service_status(_W32TIME_SERVICE) diff --git a/cloudbaseinit/tests/plugins/windows/test_ntpclient.py b/cloudbaseinit/tests/plugins/windows/test_ntpclient.py index 7880bef0..825319b0 100644 --- a/cloudbaseinit/tests/plugins/windows/test_ntpclient.py +++ b/cloudbaseinit/tests/plugins/windows/test_ntpclient.py @@ -80,7 +80,7 @@ class NTPClientPluginTests(unittest.TestCase): mock_osutils.get_service_status.assert_called_with( ntpclient._W32TIME_SERVICE) - mock_osutils.check_os_version.assert_called_once_with(6, 0) + mock_osutils.check_os_version.assert_called_once_with(6, 1) if patch_check_os_version: mock_set_ntp_trigger_mode.assert_called_once_with(mock_osutils) else: