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/05/20 00:37:10 UTC
ambari git commit: Revert "AMBARI-10882 Allow NFS mounts to be
skipped during agent health check (dsen)"
Repository: ambari
Updated Branches:
refs/heads/trunk d37bef923 -> be383cf3d
Revert "AMBARI-10882 Allow NFS mounts to be skipped during agent health check (dsen)"
This reverts commit 8a7c54c6334b986bada53965d9512d79d951a7dc.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/be383cf3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/be383cf3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/be383cf3
Branch: refs/heads/trunk
Commit: be383cf3dd37e076b5226357babbd1f51cc4b7d7
Parents: d37bef9
Author: Florian Barca <fb...@hortonworks.com>
Authored: Tue May 19 15:36:59 2015 -0700
Committer: Florian Barca <fb...@hortonworks.com>
Committed: Tue May 19 15:36:59 2015 -0700
----------------------------------------------------------------------
ambari-agent/conf/unix/ambari-agent.ini | 4 ++
ambari-agent/conf/windows/ambari-agent.ini | 4 ++
.../main/python/ambari_agent/AmbariConfig.py | 15 ++---
.../src/main/python/ambari_agent/Controller.py | 5 +-
.../src/main/python/ambari_agent/Hardware.py | 24 +++----
.../src/main/python/ambari_agent/Heartbeat.py | 2 +-
.../src/main/python/ambari_agent/HostInfo.py | 13 ++++
.../main/python/ambari_agent/RecoveryManager.py | 4 +-
.../test/python/ambari_agent/TestHardware.py | 27 --------
.../test/python/ambari_agent/TestHostInfo.py | 17 +++++
ambari-agent/src/test/python/unitTests.py | 5 +-
.../ambari/server/agent/HeartBeatHandler.java | 4 --
.../server/agent/RegistrationResponse.java | 13 ----
.../server/configuration/Configuration.java | 17 -----
.../server/agent/TestHeartbeatHandler.java | 67 +++++---------------
15 files changed, 78 insertions(+), 143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/conf/unix/ambari-agent.ini
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent.ini b/ambari-agent/conf/unix/ambari-agent.ini
index def41c6..173bb51 100644
--- a/ambari-agent/conf/unix/ambari-agent.ini
+++ b/ambari-agent/conf/unix/ambari-agent.ini
@@ -31,6 +31,10 @@ tolerate_download_failures=true
run_as_user=root
parallel_execution=0
+[command]
+maxretries=2
+sleepBetweenRetries=1
+
[security]
keysdir=/var/lib/ambari-agent/keys
server_crt=ca.crt
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/conf/windows/ambari-agent.ini
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/windows/ambari-agent.ini b/ambari-agent/conf/windows/ambari-agent.ini
index 972e11e..61a3ad9 100644
--- a/ambari-agent/conf/windows/ambari-agent.ini
+++ b/ambari-agent/conf/windows/ambari-agent.ini
@@ -30,6 +30,10 @@ cache_dir=cache
tolerate_download_failures=true
parallel_execution=0
+[command]
+maxretries=2
+sleepBetweenRetries=1
+
[security]
keysdir=keys
server_crt=ca.crt
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
index d4e0c20..13e9f03 100644
--- a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
+++ b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
@@ -50,6 +50,10 @@ parallel_execution=0
[python]
custom_actions_dir = {ps}var{ps}lib{ps}ambari-agent{ps}resources{ps}custom_actions
+[command]
+maxretries=2
+sleepBetweenRetries=1
+
[security]
keysdir={ps}tmp{ps}ambari-agent
server_crt=ca.crt
@@ -142,7 +146,6 @@ pidPathVars = [
class AmbariConfig:
TWO_WAY_SSL_PROPERTY = "security.server.two_way_ssl"
- AMBARI_PROPERTIES_CATEGORY = 'agentConfig'
SERVER_CONNECTION_INFO = "{0}/connection_info"
CONNECTION_PROTOCOL = "https"
@@ -169,9 +172,6 @@ class AmbariConfig:
def add_section(self, section):
self.config.add_section(section)
- def has_section(self, section):
- return self.config.has_section(section)
-
def setConfig(self, customConfig):
self.config = customConfig
@@ -249,13 +249,6 @@ class AmbariConfig:
def get_parallel_exec_option(self):
return int(self.get('agent', 'parallel_execution', 0))
- def update_configuration_from_registration(self, reg_resp):
- if reg_resp and AmbariConfig.AMBARI_PROPERTIES_CATEGORY in reg_resp:
- if not self.has_section(AmbariConfig.AMBARI_PROPERTIES_CATEGORY):
- self.add_section(AmbariConfig.AMBARI_PROPERTIES_CATEGORY)
- for k,v in reg_resp[AmbariConfig.AMBARI_PROPERTIES_CATEGORY].items():
- self.set(AmbariConfig.AMBARI_PROPERTIES_CATEGORY, k, v)
- pass
def updateConfigServerHostname(configFile, new_host):
# update agent config file
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/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 1702b44..ccd1233 100644
--- a/ambari-agent/src/main/python/ambari_agent/Controller.py
+++ b/ambari-agent/src/main/python/ambari_agent/Controller.py
@@ -19,8 +19,10 @@ limitations under the License.
'''
import logging
+import signal
import json
import sys
+import platform
import os
import socket
import time
@@ -161,8 +163,7 @@ class Controller(threading.Thread):
self.cluster_configuration.update_configurations_from_heartbeat(ret)
self.recovery_manager.update_configuration_from_registration(ret)
- self.config.update_configuration_from_registration(ret)
- logger.debug("Updated config:" + str(self.config))
+
# always update alert definitions on registration
self.alert_scheduler_handler.update_definitions(ret)
except ssl.SSLError:
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/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 1512969..5fbe2f8 100644
--- a/ambari-agent/src/main/python/ambari_agent/Hardware.py
+++ b/ambari-agent/src/main/python/ambari_agent/Hardware.py
@@ -21,23 +21,24 @@ limitations under the License.
import os.path
import logging
import subprocess
+import platform
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
+from ambari_commons.os_check import OSConst, OSCheck
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
-from AmbariConfig import AmbariConfig
logger = logging.getLogger()
class Hardware:
SSH_KEY_PATTERN = 'ssh.*key'
- WINDOWS_GET_DRIVES_CMD = "foreach ($drive in [System.IO.DriveInfo]::getdrives()){$available = $drive.TotalFreeSpace;$used = $drive.TotalSize-$drive.TotalFreeSpace;$percent = ($used*100)/$drive.TotalSize;$size = $drive.TotalSize;$type = $drive.DriveFormat;$mountpoint = $drive.RootDirectory.FullName;echo \"$available $used $percent% $size $type $mountpoint\"}"
- CHECK_REMOTE_MOUNTS_KEY = 'agent.check.remote.mounts'
+ WINDOWS_GET_DRIVES_CMD ="foreach ($drive in [System.IO.DriveInfo]::getdrives()){$available = $drive.TotalFreeSpace;$used = $drive.TotalSize-$drive.TotalFreeSpace;$percent = ($used*100)/$drive.TotalSize;$size = $drive.TotalSize;$type = $drive.DriveFormat;$mountpoint = $drive.RootDirectory.FullName;echo \"$available $used $percent% $size $type $mountpoint\"}"
def __init__(self):
self.hardware = {}
- self.hardware['mounts'] = Hardware.osdisks()
- self.hardware.update(Facter().facterInfo())
+ osdisks = Hardware.osdisks()
+ self.hardware['mounts'] = osdisks
+ otherInfo = Facter().facterInfo()
+ self.hardware.update(otherInfo)
pass
@staticmethod
@@ -63,19 +64,12 @@ class Hardware:
@staticmethod
@OsFamilyFuncImpl(OsFamilyImpl.DEFAULT)
- def osdisks(config = None):
+ def osdisks():
""" 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. """
mounts = []
- command = ["df", "-kPT"]
- if config and \
- config.has_option(AmbariConfig.AMBARI_PROPERTIES_CATEGORY, Hardware.CHECK_REMOTE_MOUNTS_KEY) and \
- config.get(AmbariConfig.AMBARI_PROPERTIES_CATEGORY, Hardware.CHECK_REMOTE_MOUNTS_KEY).lower() == "false":
- #limit listing to local file systems
- command.append("-l")
-
- df = subprocess.Popen(command, stdout=subprocess.PIPE)
+ df = subprocess.Popen(["df", "-kPT"], stdout=subprocess.PIPE)
dfdata = df.communicate()[0]
lines = dfdata.splitlines()
for l in lines:
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/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 95305d2..27aef04 100644
--- a/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
+++ b/ambari-agent/src/main/python/ambari_agent/Heartbeat.py
@@ -87,7 +87,7 @@ class Heartbeat:
# this must be the last step before returning heartbeat
hostInfo.register(nodeInfo, componentsMapped, commandsInProgress)
heartbeat['agentEnv'] = nodeInfo
- mounts = Hardware.osdisks(self.config)
+ mounts = Hardware.osdisks()
heartbeat['mounts'] = mounts
if logger.isEnabledFor(logging.DEBUG):
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/src/main/python/ambari_agent/HostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostInfo.py b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
index 385c758..98c8045 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostInfo.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
@@ -19,6 +19,7 @@ limitations under the License.
'''
import glob
+import hostname
import logging
import os
import re
@@ -31,6 +32,7 @@ from ambari_commons import OSCheck, OSConst
from ambari_commons.firewall import Firewall
from ambari_commons.os_family_impl import OsFamilyImpl
+from ambari_agent.Hardware import Hardware
from ambari_agent.HostCheckReportFileHandler import HostCheckReportFileHandler
@@ -161,12 +163,23 @@ class HostInfoLinux(HostInfo):
def __init__(self, config=None):
super(HostInfoLinux, self).__init__(config)
+ def osdiskAvailableSpace(self, path):
+ diskInfo = {}
+ try:
+ df = subprocess.Popen(["df", "-kPT", path], stdout=subprocess.PIPE)
+ dfdata = df.communicate()[0]
+ return Hardware.extractMountInfo(dfdata.splitlines()[-1])
+ except:
+ pass
+ return diskInfo
+
def checkUsers(self, users, results):
f = open('/etc/passwd', 'r')
for userLine in f:
fields = userLine.split(":")
if fields[0] in users:
result = {}
+ homeDir = fields[5]
result['name'] = fields[0]
result['homeDir'] = fields[5]
result['status'] = "Available"
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py b/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
index 83206ee..12ba75d 100644
--- a/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
+++ b/ambari-agent/src/main/python/ambari_agent/RecoveryManager.py
@@ -416,7 +416,7 @@ class RecoveryManager:
def update_configuration_from_registration(self, reg_resp):
"""
TODO: Server sends the recovery configuration - call update_config after parsing
- "recoveryConfig": {
+ "recovery_config": {
"type" : "DEFAULT|AUTO_START|FULL",
"maxCount" : 10,
"windowInMinutes" : 60,
@@ -685,4 +685,4 @@ def main(argv=None):
if __name__ == '__main__':
- main()
+ main()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/src/test/python/ambari_agent/TestHardware.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHardware.py b/ambari-agent/src/test/python/ambari_agent/TestHardware.py
index 4c9b490..8a3d257 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHardware.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHardware.py
@@ -26,7 +26,6 @@ import socket
from only_for_platform import not_for_platform, PLATFORM_WINDOWS
from ambari_agent import hostname
from ambari_agent.Hardware import Hardware
-from ambari_agent.AmbariConfig import AmbariConfig
from ambari_agent.Facter import Facter, FacterLinux
from ambari_commons import OSCheck
@@ -65,32 +64,6 @@ class TestHardware(TestCase):
self.assertTrue(len(result['mounts']) == len(osdisks))
- @patch.object(OSCheck, "get_os_type")
- @patch.object(OSCheck, "get_os_version")
- @patch("subprocess.Popen")
- @patch("subprocess.Popen.communicate")
-
- # @patch.object(AmbariConfig, "get")
- # @patch.object(AmbariConfig, "has_option")
- def test_osdisks_remote(self, communicate_mock, popen_mock,
- get_os_version_mock, get_os_type_mock):
- # has_option_mock.return_value = True
- # get_mock.return_value = "true"
- get_os_type_mock.return_value = "suse"
- get_os_version_mock.return_value = "11"
- Hardware.osdisks()
- popen_mock.assert_called_with(["df","-kPT"], stdout=-1)
- config = AmbariConfig()
- Hardware.osdisks(config)
- popen_mock.assert_called_with(["df","-kPT"], stdout=-1)
- config.add_section(AmbariConfig.AMBARI_PROPERTIES_CATEGORY)
- config.set(AmbariConfig.AMBARI_PROPERTIES_CATEGORY, Hardware.CHECK_REMOTE_MOUNTS_KEY, "true")
- Hardware.osdisks(config)
- popen_mock.assert_called_with(["df","-kPT"], stdout=-1)
- config.set(AmbariConfig.AMBARI_PROPERTIES_CATEGORY, Hardware.CHECK_REMOTE_MOUNTS_KEY, "false")
- Hardware.osdisks(config)
- popen_mock.assert_called_with(["df","-kPT", "-l"], stdout=-1)
-
def test_extractMountInfo(self):
outputLine = "device type size used available percent mountpoint"
result = Hardware.extractMountInfo(outputLine)
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
index 58745f9..9af45ac 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
@@ -405,6 +405,23 @@ class TestHostInfo(TestCase):
self.assertTrue(list[0]['hadoop'])
self.assertEquals(list[0]['user'], 'user')
+ @patch("subprocess.Popen")
+ @patch.object(Hardware, 'extractMountInfo')
+ def test_osdiskAvailableSpace(self, extract_mount_info_mock, subproc_popen_mock):
+ hostInfo = HostInfoLinux()
+ p = MagicMock()
+ p.communicate.return_value = ['some']
+ subproc_popen_mock.return_value = p
+ extract_mount_info_mock.return_value = {'info' : 'info'}
+ result = hostInfo.osdiskAvailableSpace('')
+
+ self.assertTrue(result['info'], 'info')
+
+ p.communicate.return_value = ''
+ result = hostInfo.osdiskAvailableSpace('')
+
+ self.assertEquals(result, {})
+
@patch.object(OSCheck, "get_os_type")
@patch("subprocess.Popen")
def test_checkLiveServices(self, subproc_popen, get_os_type_method):
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-agent/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/unitTests.py b/ambari-agent/src/test/python/unitTests.py
index b6f8411..cb7a64f 100644
--- a/ambari-agent/src/test/python/unitTests.py
+++ b/ambari-agent/src/test/python/unitTests.py
@@ -19,8 +19,11 @@ limitations under the License.
'''
import unittest
-from os.path import isdir
+import doctest
+from os.path import dirname, split, isdir
+import logging.handlers
import logging
+import platform
from only_for_platform import get_platform, PLATFORM_WINDOWS
#TODO Add an option to randomize the tests' execution
#from random import shuffle
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index 2474c3d..ab17db6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -967,10 +967,6 @@ public class HeartBeatHandler {
List<AlertDefinitionCommand> alertDefinitionCommands = getRegistrationAlertDefinitionCommands(hostname);
response.setAlertDefinitionCommands(alertDefinitionCommands);
- response.setAgentConfig(config.getAgentConfigsMap());
- if(response.getAgentConfig() != null) {
- LOG.debug("Agent configuration map set to " + response.getAgentConfig());
- }
response.setRecoveryConfig(RecoveryConfig.getRecoveryConfig(config));
if(response.getRecoveryConfig() != null) {
LOG.debug("Recovery configuration set to " + response.getRecoveryConfig().toString());
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
index c12ed82..8768a46 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/RegistrationResponse.java
@@ -20,7 +20,6 @@ package org.apache.ambari.server.agent;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import org.codehaus.jackson.annotate.JsonProperty;
@@ -62,9 +61,6 @@ public class RegistrationResponse {
@JsonProperty("recoveryConfig")
private RecoveryConfig recoveryConfig;
- @JsonProperty("agentConfig")
- private Map<String, String> agentConfig;
-
@JsonProperty("statusCommands")
private List<StatusCommand> statusCommands = null;
@@ -129,14 +125,6 @@ public class RegistrationResponse {
this.recoveryConfig = recoveryConfig;
}
- public Map<String, String> getAgentConfig() {
- return agentConfig;
- }
-
- public void setAgentConfig(Map<String, String> agentConfig) {
- this.agentConfig = agentConfig;
- }
-
@Override
public String toString() {
StringBuilder buffer = new StringBuilder("RegistrationResponse{");
@@ -145,7 +133,6 @@ public class RegistrationResponse {
buffer.append(", statusCommands=").append(statusCommands);
buffer.append(", alertDefinitionCommands=").append(alertDefinitionCommands);
buffer.append(", recoveryConfig=").append(recoveryConfig);
- buffer.append(", agentConfig=").append(agentConfig);
buffer.append('}');
return buffer.toString();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index c2cf2c0..d8f89b2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -116,8 +116,6 @@ public class Configuration {
public static final String CLIENT_API_SSL_CRT_PASS_FILE_NAME_KEY = "client.api.ssl.cert_pass_file";
public static final String CLIENT_API_SSL_CRT_PASS_KEY = "client.api.ssl.crt_pass";
public static final String CLIENT_API_SSL_KEY_NAME_KEY = "client.api.ssl.key_name";
- public static final String CHECK_REMOTE_MOUNTS_KEY = "agent.check.remote.mounts";
- public static final String CHECK_REMOTE_MOUNTS_DEFAULT = "true";
public static final String SERVER_DB_NAME_KEY = "server.jdbc.database_name";
public static final String SERVER_DB_NAME_DEFAULT = "ambari";
public static final String REQUEST_READ_TIMEOUT = "views.request.read.timeout.millis";
@@ -382,7 +380,6 @@ public class Configuration {
private Properties properties;
private Map<String, String> configsMap;
- private Map<String, String> agentConfigsMap;
private CredentialProvider credentialProvider = null;
private volatile boolean credentialProviderInitialized = false;
private Map<String, String> customDbProperties = null;
@@ -488,12 +485,7 @@ public class Configuration {
public Configuration(Properties properties) {
this.properties = properties;
- agentConfigsMap = new HashMap<String, String>();
- agentConfigsMap.put(CHECK_REMOTE_MOUNTS_KEY, properties.getProperty(
- CHECK_REMOTE_MOUNTS_KEY, CHECK_REMOTE_MOUNTS_DEFAULT));
-
configsMap = new HashMap<String, String>();
- configsMap.putAll(agentConfigsMap);
configsMap.put(AMBARI_PYTHON_WRAP_KEY, properties.getProperty(
AMBARI_PYTHON_WRAP_KEY, AMBARI_PYTHON_WRAP_DEFAULT));
configsMap.put(SRVR_TWO_WAY_SSL_KEY, properties.getProperty(
@@ -783,15 +775,6 @@ public class Configuration {
}
/**
- * Get the map with server config parameters related to agent configuration.
- * Keys - public constants of this class
- * @return the map with server config parameters related to agent configuration
- */
- public Map<String, String> getAgentConfigsMap() {
- return agentConfigsMap;
- }
-
- /**
* Checks if CSRF protection enabled
* @return true if CSRF protection filter should be enabled
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/be383cf3/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index 2b1c355..39192c4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -285,10 +285,8 @@ public class TestHeartbeatHandler {
cr.setRoleCommand("START");
cr.setClusterName(DummyCluster);
- cr.setConfigurationTags(new HashMap<String, Map<String, String>>() {{
- put("global", new HashMap<String, String>() {{
- put("tag", "version1");
- }});
+ cr.setConfigurationTags(new HashMap<String, Map<String,String>>() {{
+ put("global", new HashMap<String,String>() {{ put("tag", "version1"); }});
}});
reports.add(cr);
@@ -350,10 +348,8 @@ public class TestHeartbeatHandler {
cr.setStdOut("");
cr.setExitCode(215);
cr.setClusterName(DummyCluster);
- cr.setConfigurationTags(new HashMap<String, Map<String, String>>() {{
- put("global", new HashMap<String, String>() {{
- put("tag", "version1");
- }});
+ cr.setConfigurationTags(new HashMap<String, Map<String,String>>() {{
+ put("global", new HashMap<String,String>() {{ put("tag", "version1"); }});
}});
reports.add(cr);
hb.setReports(reports);
@@ -363,10 +359,10 @@ public class TestHeartbeatHandler {
ActionManager am = getMockActionManager();
expect(am.getTasks(anyObject(List.class))).andReturn(
- new ArrayList<HostRoleCommand>() {{
- add(command);
- add(command);
- }});
+ new ArrayList<HostRoleCommand>() {{
+ add(command);
+ add(command);
+ }});
replay(am);
HeartBeatHandler handler = getHeartBeatHandler(am, aq);
@@ -524,14 +520,14 @@ public class TestHeartbeatHandler {
assertTrue(serviceComponentHost1.isRestartRequired());
final HostRoleCommand command = hostRoleCommandFactory.create(DummyHostname1,
- Role.DATANODE, null, null);
+ Role.DATANODE, null, null);
ActionManager am = getMockActionManager();
expect(am.getTasks(anyObject(List.class))).andReturn(
- new ArrayList<HostRoleCommand>() {{
- add(command);
- add(command);
- }});
+ new ArrayList<HostRoleCommand>() {{
+ add(command);
+ add(command);
+ }});
replay(am);
HeartBeatHandler handler = getHeartBeatHandler(am, aq);
@@ -603,10 +599,10 @@ public class TestHeartbeatHandler {
ActionManager am = getMockActionManager();
expect(am.getTasks(anyObject(List.class))).andReturn(
- new ArrayList<HostRoleCommand>() {{
- add(command);
- add(command);
- }});
+ new ArrayList<HostRoleCommand>() {{
+ add(command);
+ add(command);
+ }});
replay(am);
HeartBeatHandler handler = getHeartBeatHandler(am, aq);
@@ -877,35 +873,6 @@ public class TestHeartbeatHandler {
}
@Test
- public void testRegistrationAgentConfig() throws AmbariException,
- InvalidStateTransitionException {
- ActionManager am = getMockActionManager();
- replay(am);
- Clusters fsm = clusters;
- HeartBeatHandler handler = new HeartBeatHandler(fsm, new ActionQueue(), am,
- injector);
- clusters.addHost(DummyHostname1);
- Host hostObject = clusters.getHost(DummyHostname1);
- hostObject.setIPv4("ipv4");
- hostObject.setIPv6("ipv6");
-
- Register reg = new Register();
- HostInfo hi = new HostInfo();
- hi.setHostName(DummyHostname1);
- hi.setOS(DummyOsType);
- reg.setHostname(DummyHostname1);
- reg.setCurrentPingPort(DummyCurrentPingPort);
- reg.setHardwareProfile(hi);
- reg.setAgentVersion(metaInfo.getServerVersion());
- reg.setPrefix(Configuration.PREFIX_DIR);
- RegistrationResponse rr = handler.handleRegistration(reg);
- Map<String, String> config = rr.getAgentConfig();
- assertFalse(config.isEmpty());
- assertTrue(config.containsKey(Configuration.CHECK_REMOTE_MOUNTS_KEY));
- assertTrue("true".equals(config.get(Configuration.CHECK_REMOTE_MOUNTS_KEY)));
- }
-
- @Test
public void testRegistrationWithBadVersion() throws AmbariException,
InvalidStateTransitionException {