Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.7.0, 2.2.0
-
None
-
Centos 6
Description
setupAgent.py attempts to replace the default server setting "hostname=localhost" with whatever the user provided. In certain circumstances this can make the "hostname" entry invalid. For example: the user supplies something that contains "localhost", e.g. "localhost.localdomain" and deployment fails for some reason. The user fixes the problem and retries deployment, this time the configuration file already contains "hostname=localhost.localdomain" and setupAgent.py, when running for the 2nd time, turns it into "hostname=localhost.localdomain.localdomain".
This is a minor issue, obviously, but the use case is still valid when installing Ambari on a standalone machine for testing or education.
The fix would make the regex match more exact, e.g instead of
osCommand = ["sed", "-i.bak", "s/hostname=localhost/hostname=" + server_hostname + "/g", "/etc/ambari-agent/conf/ambari-agent.ini"]
use
osCommand = ["sed", "-i.bak", "s/^hostname=localhost$/hostname=" + server_hostname + "/", "/etc/ambari-agent/conf/ambari-agent.ini"]