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 (apache#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));
281
+
_logger.trace(String.format("Executing interpreting task of process [%s] for command [%s].",
282
+
processPid, commandLine));
275
283
task = newTask(interpreter, ir);
276
284
s_executors.execute(task);
277
285
}
278
286
279
287
while (true) {
280
-
_logger.trace(String.format("Attempting process [%s] execution for command [%s] with timeout [%s].", processPid, commandLine, _timeout));
288
+
_logger.trace(String.format("Attempting process [%s] execution for command [%s] with timeout [%s].",
289
+
processPid, commandLine, _timeout));
281
290
try {
282
291
if (_process.waitFor(_timeout, TimeUnit.MILLISECONDS)) {
283
-
_logger.trace(String.format("Process [%s] execution for command [%s] completed within timeout period [%s].", processPid, commandLine,
292
+
_logger.trace(String.format(
293
+
"Process [%s] execution for command [%s] completed within timeout period [%s].",
294
+
processPid, commandLine,
284
295
_timeout));
285
296
if (_process.exitValue() == 0) {
286
-
_logger.debug(String.format("Successfully executed process [%s] for command [%s].", processPid, commandLine));
297
+
_logger.debug(String.format("Successfully executed process [%s] for command [%s].",
298
+
processPid, commandLine));
287
299
if (interpreter != null) {
288
300
if (interpreter.drain()) {
289
-
_logger.trace(String.format("Returning task result of process [%s] for command [%s].", processPid, commandLine));
301
+
_logger.trace(
302
+
String.format("Returning task result of process [%s] for command [%s].",
303
+
processPid, commandLine));
290
304
returntask.getResult();
291
305
}
292
-
_logger.trace(String.format("Returning interpretation of process [%s] for command [%s].", processPid, commandLine));
306
+
_logger.trace(
307
+
String.format("Returning interpretation of process [%s] for command [%s].",
308
+
processPid, commandLine));
293
309
returninterpreter.interpret(ir);
294
310
} else {
295
311
// null return exitValue apparently
296
-
_logger.trace(String.format("Process [%s] for command [%s] exited with value [%s].", processPid, commandLine,
312
+
_logger.trace(String.format("Process [%s] for command [%s] exited with value [%s].",
313
+
processPid, commandLine,
297
314
_process.exitValue()));
298
315
returnString.valueOf(_process.exitValue());
299
316
}
300
317
} else {
301
-
_logger.warn(String.format("Execution of process [%s] for command [%s] failed.", processPid, commandLine));
318
+
_logger.warn(String.format("Execution of process [%s] for command [%s] failed.",
319
+
processPid, commandLine));
302
320
break;
303
321
}
304
322
}
305
323
} catch (InterruptedExceptione) {
306
324
if (!_isTimeOut) {
307
-
_logger.debug(String.format("Exception [%s] occurred; however, it was not a timeout. Therefore, proceeding with the execution of process [%s] for command "
@@ -340,19 +358,24 @@ public String execute(OutputInterpreter interpreter) {
340
358
error = String.valueOf(_process.exitValue());
341
359
}
342
360
343
-
_logger.warn(String.format("Process [%s] for command [%s] encountered the error: [%s].", processPid, commandLine, error));
361
+
_logger.warn(String.format("Process [%s] for command [%s] encountered the error: [%s].", processPid,
362
+
commandLine, error));
344
363
345
364
returnerror;
346
365
} catch (SecurityExceptionex) {
347
-
_logger.warn(String.format("Exception [%s] occurred. This may be due to an attempt of executing command [%s] as non root.", ex.getMessage(), commandLine),
366
+
_logger.warn(String.format(
367
+
"Exception [%s] occurred. This may be due to an attempt of executing command [%s] as non root.",
368
+
ex.getMessage(), commandLine),
348
369
ex);
349
370
returnstackTraceAsString(ex);
350
371
} catch (Exceptionex) {
351
-
_logger.warn(String.format("Exception [%s] occurred when attempting to run command [%s].", ex.getMessage(), commandLine), ex);
372
+
_logger.warn(String.format("Exception [%s] occurred when attempting to run command [%s].",
373
+
ex.getMessage(), commandLine), ex);
352
374
returnstackTraceAsString(ex);
353
375
} finally {
354
376
if (_process != null) {
355
-
_logger.trace(String.format("Destroying process [%s] for command [%s].", _process.pid(), commandLine));
377
+
_logger.trace(
378
+
String.format("Destroying process [%s] for command [%s].", _process.pid(), commandLine));
356
379
IOUtils.closeQuietly(_process.getErrorStream());
357
380
IOUtils.closeQuietly(_process.getOutputStream());
358
381
IOUtils.closeQuietly(_process.getInputStream());
@@ -363,9 +386,10 @@ public String execute(OutputInterpreter interpreter) {
0 commit comments