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
This commit is contained in:
		@@ -48,7 +48,7 @@ class NTPClientPlugin(ntpclient.NTPClientPlugin):
 | 
				
			|||||||
                _W32TIME_SERVICE,
 | 
					                _W32TIME_SERVICE,
 | 
				
			||||||
                osutils.SERVICE_START_MODE_AUTOMATIC)
 | 
					                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)
 | 
					            self._set_ntp_trigger_mode(osutils)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        svc_status = osutils.get_service_status(_W32TIME_SERVICE)
 | 
					        svc_status = osutils.get_service_status(_W32TIME_SERVICE)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,7 +80,7 @@ class NTPClientPluginTests(unittest.TestCase):
 | 
				
			|||||||
        mock_osutils.get_service_status.assert_called_with(
 | 
					        mock_osutils.get_service_status.assert_called_with(
 | 
				
			||||||
            ntpclient._W32TIME_SERVICE)
 | 
					            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:
 | 
					        if patch_check_os_version:
 | 
				
			||||||
            mock_set_ntp_trigger_mode.assert_called_once_with(mock_osutils)
 | 
					            mock_set_ntp_trigger_mode.assert_called_once_with(mock_osutils)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user