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/03/04 02:14:57 UTC
ambari git commit: AMBARI-9912 Config validation error while trying
to install a 3 node cluster on Ubuntu
Repository: ambari
Updated Branches:
refs/heads/trunk 3dc44a429 -> 63bf08e09
AMBARI-9912 Config validation error while trying to install a 3 node cluster on Ubuntu
Fixed shell script shebang line. Fixed OS-dependent disk capacity retrieval routines. Normalized imports.
No new/updated unit tests needed. The existing unit tests provide the necessary coverage.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/63bf08e0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/63bf08e0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/63bf08e0
Branch: refs/heads/trunk
Commit: 63bf08e09bd3827a6baa86a86d6ac2caf9d41d19
Parents: 3dc44a4
Author: Florian Barca <fb...@hortonworks.com>
Authored: Tue Mar 3 17:14:39 2015 -0800
Committer: Florian Barca <fb...@hortonworks.com>
Committed: Tue Mar 3 17:14:39 2015 -0800
----------------------------------------------------------------------
ambari-agent/conf/unix/ambari-sudo.sh | 2 +-
.../src/main/python/ambari_agent/Controller.py | 18 +++++++--------
.../src/main/python/ambari_agent/Hardware.py | 14 ++++--------
.../src/main/python/ambari_agent/Heartbeat.py | 24 ++++++++++++++------
.../stacks/HDP/2.0.6/services/stack_advisor.py | 3 +++
5 files changed, 35 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/63bf08e0/ambari-agent/conf/unix/ambari-sudo.sh
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-sudo.sh b/ambari-agent/conf/unix/ambari-sudo.sh
index 0909594..80761c5 100755
--- a/ambari-agent/conf/unix/ambari-sudo.sh
+++ b/ambari-agent/conf/unix/ambari-sudo.sh
@@ -1,4 +1,4 @@
-#/bin/bash
+#!/bin/bash
# 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.
http://git-wip-us.apache.org/repos/asf/ambari/blob/63bf08e0/ambari-agent/src/main/python/ambari_agent/Controller.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py
index bd961c1..6a4ecde 100644
--- a/ambari-agent/src/main/python/ambari_agent/Controller.py
+++ b/ambari-agent/src/main/python/ambari_agent/Controller.py
@@ -36,15 +36,15 @@ import security
import ssl
import AmbariConfig
-from Heartbeat import Heartbeat
-from Register import Register
-from ActionQueue import ActionQueue
-from FileCache import FileCache
-from NetUtil import NetUtil
-from LiveStatus import LiveStatus
-from AlertSchedulerHandler import AlertSchedulerHandler
-from ClusterConfiguration import ClusterConfiguration
-from HeartbeatHandlers import HeartbeatStopHandlers, bind_signal_handlers
+from ambari_agent.Heartbeat import Heartbeat
+from ambari_agent.Register import Register
+from ambari_agent.ActionQueue import ActionQueue
+from ambari_agent.FileCache import FileCache
+from ambari_agent.NetUtil import NetUtil
+from ambari_agent.LiveStatus import LiveStatus
+from ambari_agent.AlertSchedulerHandler import AlertSchedulerHandler
+from ambari_agent.ClusterConfiguration import ClusterConfiguration
+from ambari_agent.HeartbeatHandlers import HeartbeatStopHandlers, bind_signal_handlers
logger = logging.getLogger()
http://git-wip-us.apache.org/repos/asf/ambari/blob/63bf08e0/ambari-agent/src/main/python/ambari_agent/Hardware.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Hardware.py b/ambari-agent/src/main/python/ambari_agent/Hardware.py
index 54276af..5fbe2f8 100644
--- a/ambari-agent/src/main/python/ambari_agent/Hardware.py
+++ b/ambari-agent/src/main/python/ambari_agent/Hardware.py
@@ -26,6 +26,7 @@ from ambari_commons.constants import AMBARI_SUDO_BINARY
from ambari_commons.shell import shellRunner
from Facter import Facter
from ambari_commons.os_check import OSConst, OSCheck
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
logger = logging.getLogger()
class Hardware:
@@ -34,7 +35,7 @@ class Hardware:
def __init__(self):
self.hardware = {}
- osdisks = self.osdisks()
+ osdisks = Hardware.osdisks()
self.hardware['mounts'] = osdisks
otherInfo = Facter().facterInfo()
self.hardware.update(otherInfo)
@@ -62,14 +63,8 @@ class Hardware:
return None
@staticmethod
+ @OsFamilyFuncImpl(OsFamilyImpl.DEFAULT)
def osdisks():
- if OSCheck.get_os_family() == OSConst.WINSRV_FAMILY:
- return Hardware._osdisks_win()
- else:
- return Hardware._osdisks_linux()
-
- @staticmethod
- def _osdisks_linux():
""" Run df to find out the disks on the host. Only works on linux
platforms. Note that this parser ignores any filesystems with spaces
and any mounts with spaces. """
@@ -93,7 +88,8 @@ class Hardware:
return False
@staticmethod
- def _osdisks_win():
+ @OsFamilyFuncImpl(OSConst.WINSRV_FAMILY)
+ def osdisks():
mounts = []
runner = shellRunner()
command_result = runner.runPowershell(script_block=Hardware.WINDOWS_GET_DRIVES_CMD)
http://git-wip-us.apache.org/repos/asf/ambari/blob/63bf08e0/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Heartbeat.py b/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
index 695c0fc..4b4937e 100644
--- a/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
+++ b/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
@@ -20,14 +20,13 @@ limitations under the License.
import json
import logging
+import os
import time
from pprint import pformat
-from ActionQueue import ActionQueue
-import AmbariConfig
-import hostname
-from HostInfo import HostInfo
-from Hardware import Hardware
+from ambari_agent.hostname import hostname
+from ambari_agent.HostInfo import HostInfo
+from ambari_agent.Hardware import Hardware
logger = logging.getLogger()
@@ -52,7 +51,7 @@ class Heartbeat:
heartbeat = { 'responseId' : int(id),
'timestamp' : timestamp,
- 'hostname' : hostname.hostname(self.config),
+ 'hostname' : hostname(self.config),
'nodeStatus' : nodeStatus
}
@@ -98,7 +97,18 @@ class Heartbeat:
return heartbeat
def main(argv=None):
- actionQueue = ActionQueue(AmbariConfig.config)
+ from ambari_agent.ActionQueue import ActionQueue
+ from ambari_agent.AmbariConfig import AmbariConfig
+ from ambari_agent.Controller import Controller
+
+ cfg = AmbariConfig()
+ if os.path.exists(AmbariConfig.getConfigFile()):
+ cfg.read(AmbariConfig.getConfigFile())
+ else:
+ raise Exception("No config found, use default")
+
+ ctl = Controller(cfg)
+ actionQueue = ActionQueue(cfg, ctl)
heartbeat = Heartbeat(actionQueue)
print json.dumps(heartbeat.build('3',3))
http://git-wip-us.apache.org/repos/asf/ambari/blob/63bf08e0/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 776b1d5..08d3ef5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -381,6 +381,9 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
mountPoints[mountPoint["mountpoint"]] = to_number(mountPoint["available"])
mountPoint = getMountPointForDir(dir, mountPoints.keys())
+ if not mountPoints:
+ return self.getErrorItem("No disk info found on host {0}", hostInfo["host_name"])
+
if mountPoints[mountPoint] < reqiuredDiskSpace:
msg = "Ambari Metrics disk space requirements not met. \n" \
"Recommended disk space for partition {0} is {1}G"