Skip to content

Commit

Permalink
remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
jmanuelosunamoreno committed Nov 7, 2024
1 parent 06187bb commit 1beb496
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -761,21 +761,18 @@ public String getNodesFromInventory(AnsibleRunner.AnsibleRunnerBuilder runnerBui
AnsibleRunner runner = runnerBuilder.build();

if (this.ansibleInventoryListBuilder == null) {
if(ansibleBinariesDirectoryPath!=null && !ansibleBinariesDirectoryPath.isEmpty()){
this.ansibleInventoryListBuilder = AnsibleInventoryList.builder()
.inventory(inventory)
.ansibleBinariesDirectory(java.nio.file.Path.of(ansibleBinariesDirectoryPath))
.configFile(configFile)
.debug(debug);
}
else{
this.ansibleInventoryListBuilder = AnsibleInventoryList.builder()
.inventory(inventory)
.configFile(configFile)
.debug(debug);
}
Path ansibleBinPath = null;
if (ansibleBinariesDirectoryPath != null && !ansibleBinariesDirectoryPath.isEmpty()) {
ansibleBinPath = (java.nio.file.Path.of(ansibleBinariesDirectoryPath));
}

this.ansibleInventoryListBuilder = AnsibleInventoryList.builder()
.inventory(inventory)
.ansibleBinariesDirectory(ansibleBinPath)
.configFile(configFile)
.debug(debug);
}

if(runner.getVaultPass() != null){
VaultPrompt vaultPrompt = VaultPrompt.builder()
.vaultId("None")
Expand Down

0 comments on commit 1beb496

Please sign in to comment.