You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by fb...@apache.org on 2015/06/04 00:17:08 UTC
ambari git commit: AMBARI-11663 [WinTP2] Flumeagent service is
disabled when hdp msi is installed
Repository: ambari
Updated Branches:
refs/heads/trunk d59c24bec -> 8fcf9f115
AMBARI-11663 [WinTP2] Flumeagent service is disabled when hdp msi is installed
+Ensured that the Flume Agent service is active
+Fixed service configuration capabilities, to make a clear distinction between configuration and user account change
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8fcf9f11
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8fcf9f11
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8fcf9f11
Branch: refs/heads/trunk
Commit: 8fcf9f1150dff97c67ffaaf166076b80f477a2ed
Parents: d59c24b
Author: Florian Barca <fb...@hortonworks.com>
Authored: Wed Jun 3 15:14:44 2015 -0700
Committer: Florian Barca <fb...@hortonworks.com>
Committed: Wed Jun 3 15:14:44 2015 -0700
----------------------------------------------------------------------
.../core/providers/windows/service.py | 31 ++++++++++++++++----
.../FLUME/1.4.0.2.0/package/scripts/flume.py | 4 +++
2 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fcf9f11/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 5f4cc45..8824ddd 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
@@ -27,6 +27,7 @@ import winerror
from ambari_commons.os_windows import WinServiceController
from resource_management.core.base import Fail
+from resource_management.core.logger import Logger
from resource_management.core.providers import Provider
@@ -109,9 +110,18 @@ class ServiceProvider(Provider):
class ServiceConfigProvider(Provider):
+ str_start_types = \
+ {
+ "auto" : win32service.SERVICE_AUTO_START,
+ "automatic" : win32service.SERVICE_AUTO_START,
+ "disabled" : win32service.SERVICE_DISABLED,
+ "manual" : win32service.SERVICE_DEMAND_START,
+ }
+
def action_install(self):
hSCM = safe_open_scmanager()
+ self._fix_start_type()
self._fix_user_name()
try:
@@ -146,20 +156,20 @@ class ServiceConfigProvider(Provider):
try:
hSvc = safe_open_service(hSCM, self.resource.service_name)
- self._fix_user_name()
+ self._fix_start_type()
try:
win32service.ChangeServiceConfig(hSvc,
win32service.SERVICE_NO_CHANGE,
- self.resource.startType,
+ self.resource.start_type,
win32service.SERVICE_NO_CHANGE,
None,
None,
0,
None,
- self.resource.username,
- self.resource.password,
- self.resource.displayName)
+ None,
+ None,
+ self.resource.display_name)
if self.resource.description:
try:
win32service.ChangeServiceConfig2(hSvc, win32service.SERVICE_CONFIG_DESCRIPTION, self.resource.description)
@@ -223,6 +233,17 @@ class ServiceConfigProvider(Provider):
finally:
win32service.CloseServiceHandle(hSCM)
+ def _fix_start_type(self):
+ if self.resource.start_type in ServiceConfigProvider.str_start_types.keys():
+ self.resource.start_type = ServiceConfigProvider.str_start_types[self.resource.start_type]
+ elif (not self.resource.start_type or self.resource.start_type not in [
+ win32service.SERVICE_AUTO_START,
+ win32service.SERVICE_DISABLED,
+ win32service.SERVICE_DEMAND_START]):
+ Logger.warning("Invalid service start type specified: service='{0}', start type='{1}'. Ignoring.".format(
+ self.resource.service_name, str(self.resource.start_type)))
+ self.resource.start_type = win32service.SERVICE_NO_CHANGE
+
def _fix_user_name(self):
if self.resource.username.upper() == "NT AUTHORITY\\SYSTEM":
self.resource.username = None
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fcf9f11/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume.py b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume.py
index 7d45295..9d97662 100644
--- a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume.py
+++ b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume.py
@@ -35,6 +35,10 @@ def flume(action = None):
if action == 'config':
ServiceConfig(flume_win_service_name,
+ action="configure",
+ start_type="manual")
+
+ ServiceConfig(flume_win_service_name,
action="change_user",
username=params.flume_user,
password = Script.get_password(params.flume_user))