-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38761/
-----------------------------------------------------------
Review request for Ambari and Alejandro Fernandez.
Bugs: AMBARI-13233
https://issues.apache.org/jira/browse/AMBARI-13233
Repository: ambari
Description
-------
When the Ambari Agent's ping port is taken by old/left over ambari agent
process. the Ambari agent install fails during the cluster installation time.
The error message simply says Address already in use. As shown below.
"ERROR 2015-08-14 17:11:26,557 main.py:272 - Failed to start ping port listener
of: [Errno 98] Address already in use"
The error message could have been more specific on which port was used by which
process.
In fact, the err msg is there in the
ambari-agent/src/main/python/ambari_agent/PingPortListener.py already. It's
just that it was never used due to the way the awk parses the pid.
This JIRA is to attempt to fix the awk parse cmd so that the Ambari agent
python script would throw the exception with a detailed error message.
Diffs
-----
ambari-agent/src/main/python/ambari_agent/PingPortListener.py 46be26b
Diff: https://reviews.apache.org/r/38761/diff/
Testing
-------
Issue:
The logic in the PingPortListener.py is to first use fuser to check the port
then awk to parse the result.
The fuser cmd is "fuser {0}/tcp 2>/dev/null" . {0} to be replaced by the ping
port.
The output is:
[root@test1 tmp]# fuser 8670/tcp 2>/dev/null
39248[root@test1 tmp]#
Old code's awk parser returns empty string against output listed above as shown
below
[root@test1 tmp]# fuser 8670/tcp 2>/dev/null | awk '{print $2}'
[root@test1 tmp]#
The fix is to update the awk parser. Note the print is now to print $1 instead
of $2.
[root@test1 tmp]# fuser 8670/tcp 2>/dev/null | awk '{print $1}'
39248
With awk now returns a number, the current error handling logic can print out
the correct error message.
Test:
Installed Ambari agent on a node where the ping port 8670 was taken by an
left-over Ambari agent process. Verify the error message displayed on the Host
registration page on the Ambari web UI.
Thanks,
Di Li