Skip to content

Commit f199783

Browse files
VMware import - logs sanitation (#10433)
1 parent 005afde commit f199783

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtConvertInstanceCommandWrapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
5757
RemoteInstanceTO sourceInstance = cmd.getSourceInstance();
5858
Hypervisor.HypervisorType sourceHypervisorType = sourceInstance.getHypervisorType();
5959
String sourceInstanceName = sourceInstance.getInstanceName();
60-
String sourceInstancePath = sourceInstance.getInstancePath();
6160
Hypervisor.HypervisorType destinationHypervisorType = cmd.getDestinationHypervisorType();
6261
DataStoreTO conversionTemporaryLocation = cmd.getConversionTemporaryLocation();
6362
long timeout = (long) cmd.getWait() * 1000;

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

Lines changed: 9 additions & 18 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,25 +156,15 @@ 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 (obscureParam) {
159-
builder.append("******").append(" ");
160-
obscureParam = false;
161-
} else {
162-
builder.append(command[i]).append(" ");
163-
}
164-
165-
if ("-y".equals(cmd) || "-z".equals(cmd)) {
166-
obscureParam = true;
167-
_passwordCommand = true;
159+
if (StringUtils.isNotEmpty(cmd) && cmd.startsWith("vi://")) {
160+
String[] tokens = cmd.split("@");
161+
if (tokens.length >= 2) {
162+
builder.append("vi://").append("******@").append(tokens[1]).append(" ");
163+
} else {
164+
builder.append("vi://").append("******").append(" ");
165+
}
166+
continue;
168167
}
169-
}
170-
return builder.toString();
171-
}
172-
173-
protected String buildCommandLine(List<String> command) {
174-
StringBuilder builder = new StringBuilder();
175-
boolean obscureParam = false;
176-
for (String cmd : command) {
177168
if (obscureParam) {
178169
builder.append("******").append(" ");
179170
obscureParam = false;

0 commit comments

Comments
 (0)