From 3fcdfa0644b7b5291bde40fa061c401da7404130 Mon Sep 17 00:00:00 2001 From: Alexander Abarca Date: Mon, 27 May 2024 16:37:02 -0400 Subject: [PATCH] Removed username validation --- .../com/rundeck/plugins/ansible/ansible/InventoryList.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java b/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java index f0f83d7..4de139c 100644 --- a/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java +++ b/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java @@ -100,11 +100,10 @@ public void handle(NodeEntryImpl node, Map tags) throws Resource }, USERNAME { @Override - public void handle(NodeEntryImpl node, Map tags) throws ResourceModelSourceException { + public void handle(NodeEntryImpl node, Map tags) { final List usernames = List.of("username", "ansible_user", "ansible_ssh_user", "ansible_user_id"); String nameTag = InventoryList.findTag(usernames, tags); - node.setUsername(Optional.ofNullable(nameTag) - .orElseThrow(() -> new ResourceModelSourceException(format(ERROR_MISSING_TAG, usernames)))); + Optional.ofNullable(nameTag).ifPresent(node::setUsername); } }, OS_FAMILY {