You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/05/22 19:15:48 UTC
ambari git commit: AMBARI-11325 - [WinTP2] Metrics Collector Start
reports failure but still succeeds
Repository: ambari
Updated Branches:
refs/heads/trunk de669dcaa -> e79cf4ee3
AMBARI-11325 - [WinTP2] Metrics Collector Start reports failure but still succeeds
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e79cf4ee
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e79cf4ee
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e79cf4ee
Branch: refs/heads/trunk
Commit: e79cf4ee3b22842fbdd2302616aa13c703075fd8
Parents: de669dc
Author: Artem Baranchuk <ab...@hortonworks.con>
Authored: Fri May 22 00:03:11 2015 +0300
Committer: Artem Baranchuk <ab...@hortonworks.con>
Committed: Fri May 22 20:15:25 2015 +0300
----------------------------------------------------------------------
ambari-agent/conf/windows/service_wrapper.py | 10 ++++++----
.../main/python/ambari_commons/os_windows.py | 10 ++++++----
.../core/providers/package/choco.py | 2 +-
.../core/providers/windows/service.py | 8 ++++++--
.../AMBARI_METRICS/0.1.0/package/scripts/ams.py | 5 ++---
.../0.1.0/package/scripts/ams_service.py | 6 +++---
.../0.1.0/package/scripts/service_check.py | 5 ++---
.../0.1.0/package/scripts/service_mapping.py | 21 --------------------
.../0.1.0/package/scripts/status.py | 6 +++---
9 files changed, 29 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-agent/conf/windows/service_wrapper.py
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/windows/service_wrapper.py b/ambari-agent/conf/windows/service_wrapper.py
index 0851745..d031c34 100644
--- a/ambari-agent/conf/windows/service_wrapper.py
+++ b/ambari-agent/conf/windows/service_wrapper.py
@@ -139,8 +139,9 @@ def setup(options):
# possibly run.
#
def svcstart(options):
- if 0 != AmbariAgentService.Start(15):
- options.exit_message = None
+ (ret, msg) = AmbariAgentService.Start(15)
+ if 0 != ret:
+ options.exit_message = msg
pass
@@ -148,8 +149,9 @@ def svcstart(options):
# Stops the Ambari Agent.
#
def svcstop(options):
- if 0 != AmbariAgentService.Stop():
- options.exit_message = None
+ (ret, msg) = AmbariAgentService.Stop()
+ if 0 != ret:
+ options.exit_message = msg
#
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-common/src/main/python/ambari_commons/os_windows.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/os_windows.py b/ambari-common/src/main/python/ambari_commons/os_windows.py
index 3df44af..5759444 100644
--- a/ambari-common/src/main/python/ambari_commons/os_windows.py
+++ b/ambari-common/src/main/python/ambari_commons/os_windows.py
@@ -510,18 +510,20 @@ class WinServiceController:
@staticmethod
def Start(serviceName, waitSecs=30):
err = 0
+ msg = ''
try:
win32serviceutil.StartService(serviceName)
if waitSecs:
win32serviceutil.WaitForServiceStatus(serviceName, win32service.SERVICE_RUNNING, waitSecs)
except win32service.error, exc:
- print "Error starting service: %s" % exc.strerror
+ msg = "Error starting service: %s" % exc.strerror
err = exc.winerror
- return err
+ return err, msg
@staticmethod
def Stop(serviceName, waitSecs=30):
err = 0
+ msg = ''
try:
if waitSecs:
win32serviceutil.StopServiceWithDeps(serviceName, waitSecs=waitSecs)
@@ -530,9 +532,9 @@ class WinServiceController:
if waitSecs:
win32serviceutil.WaitForServiceStatus(serviceName, win32service.SERVICE_STOPPED, waitSecs)
except win32service.error, exc:
- print "Error stopping service: %s (%d)" % (exc.strerror, exc.winerror)
+ msg = "Error stopping service: %s (%d)" % (exc.strerror, exc.winerror)
err = exc.winerror
- return err
+ return err, msg
@staticmethod
def QueryStatus(serviceName):
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/choco.py b/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
index 531372c..cd345fa 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
@@ -42,7 +42,7 @@ REMOVE_CMD = {
CHECK_CMD = {
True: ['cmd', '/c', 'choco', 'list', '--pre', '--local-only', '-v'],
- False: ['cmd', '/c', 'choco', 'list', '--pre', '-local-only'],
+ False: ['cmd', '/c', 'choco', 'list', '--pre', '--local-only'],
}
class ChocoProvider(PackageProvider):
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/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 8e6ddff..5f4cc45 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
@@ -53,10 +53,14 @@ def safe_open_service(hSCM, service_name):
class ServiceProvider(Provider):
def action_start(self):
- WinServiceController.Start(self.resource.service_name, 5)
+ (ret, msg) = WinServiceController.Start(self.resource.service_name, 5)
+ if 0 != ret:
+ raise Fail(msg)
def action_stop(self):
- WinServiceController.Stop(self.resource.service_name, 5)
+ (ret, msg) = WinServiceController.Stop(self.resource.service_name, 5)
+ if 0 != ret:
+ raise Fail(msg)
def action_restart(self):
self.action_stop()
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
index 507336b..fc18042 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management import *
from ambari_commons import OSConst
-from service_mapping import *
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
from ambari_commons.str_utils import compress_backslashes
import glob
@@ -30,7 +29,7 @@ import os
def ams(name=None):
import params
if name == 'collector':
- if not check_windows_service_exists(collector_win_service_name):
+ if not check_windows_service_exists(params.ams_collector_win_service_name):
Execute(format("cmd /C cd {ams_collector_home_dir} & ambari-metrics-collector.cmd setup"))
Directory(params.ams_collector_conf_dir,
@@ -124,7 +123,7 @@ def ams(name=None):
pass
elif name == 'monitor':
- if not check_windows_service_exists(monitor_win_service_name):
+ if not check_windows_service_exists(params.ams_monitor_win_service_name):
Execute(format("cmd /C cd {ams_monitor_home_dir} & ambari-metrics-monitor.cmd setup"))
# creating symbolic links on ams jars to make them available to services
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams_service.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams_service.py
index 9260683..9252e19 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams_service.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams_service.py
@@ -25,11 +25,11 @@ from hbase_service import hbase_service
@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
def ams_service(name, action):
- import service_mapping
+ import params
if name == 'collector':
- Service(service_mapping.collector_win_service_name, action=action)
+ Service(params.ams_collector_win_service_name, action=action)
elif name == 'monitor':
- Service(service_mapping.monitor_win_service_name, action=action)
+ Service(params.ams_monitor_win_service_name, action=action)
@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
def ams_service(name, action):
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
index e5ee7f9..b4cff05 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
@@ -44,7 +44,6 @@ class AMSServiceCheck(Script):
@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
def service_check(self, env):
from resource_management.libraries.functions.windows_service_utils import check_windows_service_exists
- from service_mapping import collector_win_service_name, monitor_win_service_name
import params
env.set_params(params)
@@ -52,12 +51,12 @@ class AMSServiceCheck(Script):
#Just check that the services were correctly installed
#Check the monitor on all hosts
Logger.info("Metrics Monitor service check was started.")
- if not check_windows_service_exists(monitor_win_service_name):
+ if not check_windows_service_exists(params.ams_monitor_win_service_name):
raise Fail("Metrics Monitor service was not properly installed. Check the logs and retry the installation.")
#Check the collector only where installed
if params.ams_collector_home_dir and os.path.isdir(params.ams_collector_home_dir):
Logger.info("Metrics Collector service check was started.")
- if not check_windows_service_exists(collector_win_service_name):
+ if not check_windows_service_exists(params.ams_collector_win_service_name):
raise Fail("Metrics Collector service was not properly installed. Check the logs and retry the installation.")
@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_mapping.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_mapping.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_mapping.py
deleted file mode 100644
index 6a96c28..0000000
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_mapping.py
+++ /dev/null
@@ -1,21 +0,0 @@
-"""
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-"""
-
-collector_win_service_name = "AmbariMetricsCollector"
-monitor_win_service_name = "AmbariMetricsHostMonitoring"
http://git-wip-us.apache.org/repos/asf/ambari/blob/e79cf4ee/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
index 91f13d4..c69ce5c 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
@@ -35,8 +35,8 @@ def check_service_status(name):
@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
def check_service_status(name):
- import service_mapping
+ import params
if name=='collector':
- check_windows_service_status(service_mapping.collector_win_service_name)
+ check_windows_service_status(params.ams_collector_win_service_name)
elif name == 'monitor':
- check_windows_service_status(service_mapping.monitor_win_service_name)
+ check_windows_service_status(params.ams_monitor_win_service_name)