Skip to content

Commit 1beb496

Browse files
committed
remove duplicate code
1 parent 06187bb commit 1beb496

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/main/groovy/com/rundeck/plugins/ansible/plugin/AnsibleResourceModelSource.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -761,21 +761,18 @@ public String getNodesFromInventory(AnsibleRunner.AnsibleRunnerBuilder runnerBui
761761
AnsibleRunner runner = runnerBuilder.build();
762762

763763
if (this.ansibleInventoryListBuilder == null) {
764-
if(ansibleBinariesDirectoryPath!=null && !ansibleBinariesDirectoryPath.isEmpty()){
765-
this.ansibleInventoryListBuilder = AnsibleInventoryList.builder()
766-
.inventory(inventory)
767-
.ansibleBinariesDirectory(java.nio.file.Path.of(ansibleBinariesDirectoryPath))
768-
.configFile(configFile)
769-
.debug(debug);
770-
}
771-
else{
772-
this.ansibleInventoryListBuilder = AnsibleInventoryList.builder()
773-
.inventory(inventory)
774-
.configFile(configFile)
775-
.debug(debug);
776-
}
764+
Path ansibleBinPath = null;
765+
if (ansibleBinariesDirectoryPath != null && !ansibleBinariesDirectoryPath.isEmpty()) {
766+
ansibleBinPath = (java.nio.file.Path.of(ansibleBinariesDirectoryPath));
777767
}
778768

769+
this.ansibleInventoryListBuilder = AnsibleInventoryList.builder()
770+
.inventory(inventory)
771+
.ansibleBinariesDirectory(ansibleBinPath)
772+
.configFile(configFile)
773+
.debug(debug);
774+
}
775+
779776
if(runner.getVaultPass() != null){
780777
VaultPrompt vaultPrompt = VaultPrompt.builder()
781778
.vaultId("None")

0 commit comments

Comments
 (0)