Skip to content

Commit efc7b08

Browse files
fix for tests
1 parent 7ca7d21 commit efc7b08

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

utils/src/main/java/com/cloud/utils/script/Script.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
import com.cloud.utils.Pair;
5050
import com.cloud.utils.PropertiesUtil;
51+
import com.cloud.utils.StringUtils;
5152
import com.cloud.utils.concurrency.NamedThreadFactory;
5253
import com.cloud.utils.script.OutputInterpreter.TimedOutLogger;
5354

@@ -155,7 +156,7 @@ protected String buildCommandLine(String[] command) {
155156
boolean obscureParam = false;
156157
for (int i = 0; i < command.length; i++) {
157158
String cmd = command[i];
158-
if (cmd.startsWith("vi://")) {
159+
if (StringUtils.isNotEmpty(cmd) && cmd.startsWith("vi://")) {
159160
String[] tokens = cmd.split("@");
160161
if (tokens.length >= 2) {
161162
builder.append("vi://").append("******@").append(tokens[1]).append(" ");
@@ -164,25 +165,6 @@ protected String buildCommandLine(String[] command) {
164165
}
165166
continue;
166167
}
167-
if (obscureParam) {
168-
builder.append("******").append(" ");
169-
obscureParam = false;
170-
} else {
171-
builder.append(command[i]).append(" ");
172-
}
173-
174-
if ("-y".equals(cmd) || "-z".equals(cmd)) {
175-
obscureParam = true;
176-
_passwordCommand = true;
177-
}
178-
}
179-
return builder.toString();
180-
}
181-
182-
protected String buildCommandLine(List<String> command) {
183-
StringBuilder builder = new StringBuilder();
184-
boolean obscureParam = false;
185-
for (String cmd : command) {
186168
if (obscureParam) {
187169
builder.append("******").append(" ");
188170
obscureParam = false;

0 commit comments

Comments
 (0)