You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2015/02/03 21:17:06 UTC
ambari git commit: AMBARI-9441 : Flume service from HDPWIN 2.2 fails
to start because it is disabled (jluniya)
Repository: ambari
Updated Branches:
refs/heads/trunk 5d833e324 -> 90e05a9c5
AMBARI-9441 : Flume service from HDPWIN 2.2 fails to start because it is disabled (jluniya)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/90e05a9c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/90e05a9c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/90e05a9c
Branch: refs/heads/trunk
Commit: 90e05a9c55282b25ecfcb0ede443818b992d8f51
Parents: 5d833e3
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Tue Feb 3 12:17:02 2015 -0800
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Tue Feb 3 12:17:02 2015 -0800
----------------------------------------------------------------------
.../core/providers/windows/service.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/90e05a9c/ambari-common/src/main/python/resource_management/core/providers/windows/service.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/windows/service.py b/ambari-common/src/main/python/resource_management/core/providers/windows/service.py
index cdf3137..ba08899 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/windows/service.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/windows/service.py
@@ -32,6 +32,7 @@ class ServiceProvider(Provider):
self._service_handle = self._service_handle if hasattr(self, "_service_handle") else \
win32service.OpenService(_schSCManager, self.resource.service_name, win32service.SERVICE_ALL_ACCESS)
if not self.status():
+ self.enable()
win32service.StartService(self._service_handle, None)
self.wait_status(win32service.SERVICE_RUNNING)
@@ -56,6 +57,20 @@ class ServiceProvider(Provider):
return True
return False
+ def enable(self):
+ if win32service.QueryServiceConfig(self._service_handle)[1] == win32service.SERVICE_DISABLED:
+ win32service.ChangeServiceConfig(self._service_handle,
+ win32service.SERVICE_NO_CHANGE,
+ win32service.SERVICE_DEMAND_START,
+ win32service.SERVICE_NO_CHANGE,
+ None,
+ None,
+ 0,
+ None,
+ None,
+ None,
+ None)
+
def get_current_status(self):
return win32service.QueryServiceStatusEx(self._service_handle)["CurrentState"]