From a79220adb2b1e699d14d1ee0734f47c69ecd9bc2 Mon Sep 17 00:00:00 2001 From: nickivanov Date: Fri, 3 Apr 2015 13:44:04 -0400 Subject: [PATCH] Fix for agent setup failing on localhost When installing the agent on the same machine (for testing or learning purposes) using "localhost.whatever" as FQDN, the agent configuration is messed up by `configureAgent`. As the obvious purpose there is to replace the default "hostname=localhost" with whatever the user is provided, it makes sense to make the match more exact. --- ambari-server/src/main/python/setupAgent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ambari-server/src/main/python/setupAgent.py b/ambari-server/src/main/python/setupAgent.py index b3825ad9fbe..71c21b34df6 100755 --- a/ambari-server/src/main/python/setupAgent.py +++ b/ambari-server/src/main/python/setupAgent.py @@ -240,8 +240,8 @@ def configureAgent(server_hostname, cwd, ret=None): @OsFamilyFuncImpl(OsFamilyImpl.DEFAULT) def configureAgent(server_hostname, user_run_as): """ Configure the agent so that it has all the configs knobs properly installed """ - osCommand = ["sed", "-i.bak", "s/hostname=localhost/hostname=" + server_hostname + - "/g", "/etc/ambari-agent/conf/ambari-agent.ini"] + osCommand = ["sed", "-i.bak", "s/^hostname=localhost$/hostname=" + server_hostname + + "/", "/etc/ambari-agent/conf/ambari-agent.ini"] ret = execOsCommand(osCommand) if ret['exitstatus'] != 0: return ret