Skip to content

Commit

Permalink
Fixed use of limit with vault
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Abarca committed Jul 8, 2024
1 parent 42fb6b0 commit 958e8cb
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public String getNodeList() throws IOException, AnsibleException {
private void processAnsibleVault(List<VaultPrompt> stdinVariables, List<String> procArgs)
throws IOException {

if (vaultPrompt == null) { return; }

if(ansibleVault == null){
tempInternalVaultFile = AnsibleVault.createVaultScriptAuth("ansible-script-vault");
ansibleVault = AnsibleVault.builder()
Expand All @@ -125,20 +127,21 @@ private void processAnsibleVault(List<VaultPrompt> stdinVariables, List<String>
.debug(debug).build();
}

if (vaultPrompt != null) {
stdinVariables.add(vaultPrompt);
tempVaultFile = ansibleVault.getVaultPasswordScriptFile();
procArgs.add("--vault-id");
procArgs.add(tempVaultFile.getAbsolutePath());
}
stdinVariables.add(vaultPrompt);
tempVaultFile = ansibleVault.getVaultPasswordScriptFile();
procArgs.add("--vault-id");
procArgs.add(tempVaultFile.getAbsolutePath());
}

private void processLimit(List<String> procArgs) throws IOException {
if (limits != null && limits.size() == 1) {

if (limits == null) { return; }

if (limits.size() == 1) {
procArgs.add("-l");
procArgs.add(limits.get(0));

} else if (limits != null && limits.size() > 1) {
} else if (limits.size() > 1) {
StringBuilder sb = new StringBuilder();
for (String limit : limits) {
sb.append(limit).append("\n");
Expand Down

0 comments on commit 958e8cb

Please sign in to comment.