Skip to content

Commit

Permalink
Added validator
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-variacode committed Oct 23, 2024
1 parent 8503180 commit 369df36
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -712,16 +712,16 @@ public void ansibleInventoryList(NodeSetImpl nodes, AnsibleRunner.AnsibleRunnerB

Map<String, Object> all = InventoryList.getValue(allInventory, ALL);

if (!isTagEmpty(all, ALL)) {
if (isTagMapEmpty(all, ALL)) {
Map<String, Object> children = InventoryList.getValue(all, CHILDREN);

if (!isTagEmpty(children, CHILDREN)) {
if (isTagMapEmpty(children, CHILDREN)) {
for (Map.Entry<String, Object> pair : children.entrySet()) {
String hostGroup = pair.getKey();
Map<String, Object> hostNames = InventoryList.getType(pair.getValue());
Map<String, Object> hosts = InventoryList.getValue(hostNames, HOSTS);

if (!isTagEmpty(hosts, HOSTS)) {
if (isTagMapEmpty(hosts, HOSTS)) {
for (Map.Entry<String, Object> hostNode : hosts.entrySet()) {
NodeEntryImpl node = new NodeEntryImpl();
node.setTags(Set.of(hostGroup));
Expand Down Expand Up @@ -858,13 +858,12 @@ public List<String> listSecretsPathResourceModel(Map<String, Object> configurati
* @param tagName The name of the tag to validate.
* @return True if the tag is empty, false otherwise.
*/
private boolean isTagEmpty(Map<String, Object> tagMap, String tagName) {
private boolean isTagMapEmpty(Map<String, Object> tagMap, String tagName) {
if (tagMap == null) {
log.warn("Tag '{}' is empty!", tagName);
return true;
return false;
}
log.warn("Tag '{}' is NOT empty!", tagName);
return false;
return true;
}

}

0 comments on commit 369df36

Please sign in to comment.