Remove http_address from _cat/nodeattrs

This was recently added with #16770 but it turns out it is not a proper node attribute, so it is enough to print out as part of _cat/nodes only.
This commit is contained in:
javanna 2016-03-01 16:41:53 +01:00 committed by Luca Cavanna
parent 99aa4942d2
commit fd70d60457
1 changed files with 13 additions and 26 deletions

View File

@ -43,9 +43,6 @@ import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable;
import java.util.HashMap;
import java.util.Map;
import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestNodeAttrsAction extends AbstractCatAction {
@ -115,32 +112,22 @@ public class RestNodeAttrsAction extends AbstractCatAction {
for (DiscoveryNode node : nodes) {
NodeInfo info = nodesInfo.getNodesMap().get(node.id());
for(ObjectObjectCursor<String, String> att : node.attributes()) {
buildRow(fullId, table, node, info, att.key, att.value);
}
if (info.getServiceAttributes() != null) {
for (Map.Entry<String, String> entry : info.getServiceAttributes().entrySet()) {
buildRow(fullId, table, node, info, entry.getKey(), entry.getValue());
table.startRow();
table.addCell(node.name());
table.addCell(fullId ? node.id() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
table.addCell(node.getHostAddress());
if (node.address() instanceof InetSocketTransportAddress) {
table.addCell(((InetSocketTransportAddress) node.address()).address().getPort());
} else {
table.addCell("-");
}
table.addCell(att.key);
table.addCell(att.value);
table.endRow();
}
}
return table;
}
private final void buildRow(boolean fullId, Table table, DiscoveryNode node, NodeInfo info, String key, String value) {
table.startRow();
table.addCell(node.name());
table.addCell(fullId ? node.id() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
table.addCell(node.getHostAddress());
if (node.address() instanceof InetSocketTransportAddress) {
table.addCell(((InetSocketTransportAddress) node.address()).address().getPort());
} else {
table.addCell("-");
}
table.addCell(key);
table.addCell(value);
table.endRow();
}
}