Skip to content

Commit

Permalink
avoid NPE on default bin path
Browse files Browse the repository at this point in the history
  • Loading branch information
jmanuelosunamoreno committed Oct 24, 2024
1 parent ab48575 commit c87715a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class AnsibleInventoryList {
private File vaultPromptFile;
private File tempLimitFile;

public static final String ANSIBLE_INVENTORY = "/ansible-inventory";
public static final String ANSIBLE_INVENTORY = "ansible-inventory";

/**
* Executes Ansible command to bring all nodes from inventory
Expand All @@ -43,7 +43,10 @@ public class AnsibleInventoryList {
public String getNodeList() throws IOException, AnsibleException {

List<String> procArgs = new ArrayList<>();
procArgs.add(ansibleBinariesDirectoryPath+ANSIBLE_INVENTORY);
if(ansibleBinariesDirectoryPath!=null && !ansibleBinariesDirectoryPath.isEmpty()) {
procArgs.add(ansibleBinariesDirectoryPath+"/"+ANSIBLE_INVENTORY);
}
procArgs.add(ANSIBLE_INVENTORY);
//inventory can be defined in ansible.cfg
if(inventory!=null && !inventory.isEmpty()){
procArgs.add("--inventory-file" + "=" + inventory);
Expand Down

0 comments on commit c87715a

Please sign in to comment.