Skip to content

Commit

Permalink
Added fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-variacode committed Nov 6, 2024
1 parent 4aa1d79 commit 084095c
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ public void ansibleInventoryList(NodeSetImpl nodes, AnsibleRunner.AnsibleRunnerB

if (isTagMapValid(all, ALL)) {
Map<String, Object> children = InventoryList.getValue(all, CHILDREN);
processChildren(nodes, children, new HashSet<>());
processChildren(children, new HashSet<>());
}

ansibleNodes.forEach((k, node) -> nodes.putNode(node));
Expand All @@ -729,12 +729,11 @@ public void ansibleInventoryList(NodeSetImpl nodes, AnsibleRunner.AnsibleRunnerB
/**
* Processes the given set of nodes and populates the children map with the results.
*
* @param nodes the set of nodes to process
* @param children a map to be populated with the processed children nodes
* @param tags a set of tags to filter the nodes
* @throws ResourceModelSourceException if an error occurs while processing the nodes
*/
public void processChildren(NodeSetImpl nodes, Map<String, Object> children, HashSet<String> tags) throws ResourceModelSourceException {
public void processChildren(Map<String, Object> children, HashSet<String> tags) throws ResourceModelSourceException {
if (!isTagMapValid(children, CHILDREN)) {
return;
}
Expand All @@ -747,9 +746,9 @@ public void processChildren(NodeSetImpl nodes, Map<String, Object> children, Has

if (hostNames.containsKey(CHILDREN)) {
Map<String, Object> subChildren = InventoryList.getValue(hostNames, CHILDREN);
processChildren(nodes, subChildren, tags);
processChildren(subChildren, tags);
} else {
processHosts(nodes, hostNames, tags);
processHosts(hostNames, tags);
tags.clear();
}
}
Expand All @@ -758,12 +757,11 @@ public void processChildren(NodeSetImpl nodes, Map<String, Object> children, Has
/**
* Processes the hosts within the given host names map and adds them to the nodes set.
*
* @param nodes the set of nodes to populate
* @param hostNames the map containing host names and their attributes
* @param tags the set of tags to apply to the nodes
* @throws ResourceModelSourceException if an error occurs while processing the nodes
*/
public void processHosts(NodeSetImpl nodes, Map<String, Object> hostNames, HashSet<String> tags) throws ResourceModelSourceException {
public void processHosts(Map<String, Object> hostNames, HashSet<String> tags) throws ResourceModelSourceException {
Map<String, Object> hosts = InventoryList.getValue(hostNames, HOSTS);

if (!isTagMapValid(hosts, HOSTS)) {
Expand All @@ -784,7 +782,6 @@ public void processHosts(NodeSetImpl nodes, Map<String, Object> hostNames, HashS
*/
public NodeEntryImpl createNodeEntry(Map.Entry<String, Object> hostNode) throws ResourceModelSourceException {
NodeEntryImpl node = new NodeEntryImpl();
//node.setTags(Set.copyOf(tags));
String hostName = hostNode.getKey();
node.setHostname(hostName);
node.setNodename(hostName);
Expand Down

0 comments on commit 084095c

Please sign in to comment.