You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix that log sensitive infomation in cmd of script (#12024)
* fix that log sensitive infomation in cmd of script
* Remove unnecessary line break in Script.java
* Update utils/src/main/java/com/cloud/utils/script/Script.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor logging in Script class to simplify handling of sensitive arguments
* Improve command logging in Script class to include full command line when debugging
* Remove unused _passwordCommand flag from Script class to simplify code
* Update utils/src/main/java/com/cloud/utils/script/Script.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Remove unused import for KeyStoreUtils
* Update utils/src/main/java/com/cloud/utils/script/Script.java
---------
Co-authored-by: chenyoulong20g@ict.ac.cn <chenyoulong20g@ict.ac.cn>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: dahn <daan@onecht.net>
Co-authored-by: dahn <daan.hoogland@gmail.com>
Copy file name to clipboardExpand all lines: plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,8 @@ public Answer execute(final UpdateHostPasswordCommand command, final LibvirtComp
Copy file name to clipboardExpand all lines: plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ public Answer execute(final UpdateHostPasswordCommand command, final CitrixResou
47
47
try {
48
48
logger.debug("Executing password update command on host: {} for user: {}", hostIp, username);
_logger.trace(String.format("Executing interpreting task of process [%s] for command [%s].", processPid, commandLine));
280
+
_logger.trace(String.format("Executing interpreting task of process [%s] for command [%s].",
281
+
processPid, commandLine));
274
282
task = newTask(interpreter, ir);
275
283
s_executors.execute(task);
276
284
}
277
285
278
286
while (true) {
279
-
_logger.trace(String.format("Attempting process [%s] execution for command [%s] with timeout [%s].", processPid, commandLine, _timeout));
287
+
_logger.trace(String.format("Attempting process [%s] execution for command [%s] with timeout [%s].",
288
+
processPid, commandLine, _timeout));
280
289
try {
281
290
if (_process.waitFor(_timeout, TimeUnit.MILLISECONDS)) {
282
-
_logger.trace(String.format("Process [%s] execution for command [%s] completed within timeout period [%s].", processPid, commandLine,
291
+
_logger.trace(String.format(
292
+
"Process [%s] execution for command [%s] completed within timeout period [%s].",
293
+
processPid, commandLine,
283
294
_timeout));
284
295
if (_process.exitValue() == 0) {
285
-
_logger.debug(String.format("Successfully executed process [%s] for command [%s].", processPid, commandLine));
296
+
_logger.debug(String.format("Successfully executed process [%s] for command [%s].",
297
+
processPid, commandLine));
286
298
if (interpreter != null) {
287
299
if (interpreter.drain()) {
288
-
_logger.trace(String.format("Returning task result of process [%s] for command [%s].", processPid, commandLine));
300
+
_logger.trace(
301
+
String.format("Returning task result of process [%s] for command [%s].",
302
+
processPid, commandLine));
289
303
returntask.getResult();
290
304
}
291
-
_logger.trace(String.format("Returning interpretation of process [%s] for command [%s].", processPid, commandLine));
305
+
_logger.trace(
306
+
String.format("Returning interpretation of process [%s] for command [%s].",
307
+
processPid, commandLine));
292
308
returninterpreter.interpret(ir);
293
309
} else {
294
310
// null return exitValue apparently
295
-
_logger.trace(String.format("Process [%s] for command [%s] exited with value [%s].", processPid, commandLine,
311
+
_logger.trace(String.format("Process [%s] for command [%s] exited with value [%s].",
312
+
processPid, commandLine,
296
313
_process.exitValue()));
297
314
returnString.valueOf(_process.exitValue());
298
315
}
299
316
} else {
300
-
_logger.warn(String.format("Execution of process [%s] for command [%s] failed.", processPid, commandLine));
317
+
_logger.warn(String.format("Execution of process [%s] for command [%s] failed.",
318
+
processPid, commandLine));
301
319
break;
302
320
}
303
321
}
304
322
} catch (InterruptedExceptione) {
305
323
if (!_isTimeOut) {
306
-
_logger.debug(String.format("Exception [%s] occurred; however, it was not a timeout. Therefore, proceeding with the execution of process [%s] for command "
@@ -339,19 +357,24 @@ public String execute(OutputInterpreter interpreter) {
339
357
error = String.valueOf(_process.exitValue());
340
358
}
341
359
342
-
_logger.warn(String.format("Process [%s] for command [%s] encountered the error: [%s].", processPid, commandLine, error));
360
+
_logger.warn(String.format("Process [%s] for command [%s] encountered the error: [%s].", processPid,
361
+
commandLine, error));
343
362
344
363
returnerror;
345
364
} catch (SecurityExceptionex) {
346
-
_logger.warn(String.format("Exception [%s] occurred. This may be due to an attempt of executing command [%s] as non root.", ex.getMessage(), commandLine),
365
+
_logger.warn(String.format(
366
+
"Exception [%s] occurred. This may be due to an attempt of executing command [%s] as non root.",
367
+
ex.getMessage(), commandLine),
347
368
ex);
348
369
returnstackTraceAsString(ex);
349
370
} catch (Exceptionex) {
350
-
_logger.warn(String.format("Exception [%s] occurred when attempting to run command [%s].", ex.getMessage(), commandLine), ex);
371
+
_logger.warn(String.format("Exception [%s] occurred when attempting to run command [%s].",
372
+
ex.getMessage(), commandLine), ex);
351
373
returnstackTraceAsString(ex);
352
374
} finally {
353
375
if (_process != null) {
354
-
_logger.trace(String.format("Destroying process [%s] for command [%s].", _process.pid(), commandLine));
376
+
_logger.trace(
377
+
String.format("Destroying process [%s] for command [%s].", _process.pid(), commandLine));
355
378
IOUtils.closeQuietly(_process.getErrorStream());
356
379
IOUtils.closeQuietly(_process.getOutputStream());
357
380
IOUtils.closeQuietly(_process.getInputStream());
@@ -362,9 +385,10 @@ public String execute(OutputInterpreter interpreter) {
0 commit comments