Skip to content

Commit b6ea74f

Browse files
committed
split up extraArgs
1 parent 3ac4035 commit b6ea74f

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.batix.rundeck'
2-
version '1.2.0'
2+
version '1.2.1'
33

44
ext.rundeckPluginVersion = '1.1'
55
ext.pluginClassNames = [

src/main/java/com/batix/rundeck/AnsibleRunner.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.batix.rundeck;
22

33
import com.dtolabs.rundeck.core.common.INodeSet;
4+
import com.dtolabs.rundeck.core.utils.OptsUtil;
45
import com.dtolabs.utils.Streams;
56
import com.google.gson.JsonObject;
67
import com.google.gson.JsonParser;
@@ -56,7 +57,7 @@ public static AnsibleRunner playbook(String playbook) {
5657
private final AnsibleCommand type;
5758
private String module;
5859
private String arg;
59-
private String extraArgs;
60+
private String[] extraArgs;
6061
private String playbook;
6162
private final List<String> limits = new ArrayList<>();
6263
private int result;
@@ -79,6 +80,14 @@ public AnsibleRunner limit(INodeSet nodes) {
7980
* Additional arguments to pass to the process
8081
*/
8182
public AnsibleRunner extraArgs(String args) {
83+
extraArgs = OptsUtil.burst(args);
84+
return this;
85+
}
86+
87+
/**
88+
* Additional arguments to pass to the process
89+
*/
90+
public AnsibleRunner extraArgs(String[] args) {
8291
extraArgs = args;
8392
return this;
8493
}
@@ -130,8 +139,8 @@ public int run() throws Exception {
130139
procArgs.add("@" + tempFile.getAbsolutePath());
131140
}
132141

133-
if (extraArgs != null && extraArgs.length() > 0) {
134-
procArgs.add(extraArgs);
142+
if (extraArgs != null && extraArgs.length > 0) {
143+
procArgs.addAll(Arrays.asList(extraArgs));
135144
}
136145

137146
Process proc = new ProcessBuilder()

0 commit comments

Comments
 (0)