From fd70d60457c02bf754ef3b6ecec69a4366a290a4 Mon Sep 17 00:00:00 2001 From: javanna Date: Tue, 1 Mar 2016 16:41:53 +0100 Subject: [PATCH] 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. --- .../rest/action/cat/RestNodeAttrsAction.java | 39 +++++++------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java index b02609323ce..b0d4d3f5db0 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java @@ -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 att : node.attributes()) { - buildRow(fullId, table, node, info, att.key, att.value); - } - if (info.getServiceAttributes() != null) { - for (Map.Entry 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(); - } }