Capture cmdline args for inspect API (#14668)

Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
This commit is contained in:
Poorna 2022-03-31 16:05:43 -07:00 committed by GitHub
parent c547a4d835
commit 0e6aedc7ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2477,9 +2477,16 @@ func (a adminAPIHandlers) InspectDataHandler(w http.ResponseWriter, r *http.Requ
logger.LogIf(ctx, err)
}
// save args passed to inspect command
inspectArgs := fmt.Sprintf("inspect path: %s%s%s\n", volume, slashSeparator, file)
if err = rawDataFn(bytes.NewReader([]byte(inspectArgs)), "", "", "inspect-input.txt", StatInfo{
Size: int64(len(inspectArgs)),
inspectArgs := []string{fmt.Sprintf(" Inspect path: %s%s%s\n", volume, slashSeparator, file)}
cmdLine := []string{"Server command line args: "}
for _, pool := range globalEndpoints {
cmdLine = append(cmdLine, pool.CmdLine)
}
cmdLine = append(cmdLine, "\n")
inspectArgs = append(inspectArgs, cmdLine...)
inspectArgsBytes := []byte(strings.Join(inspectArgs, " "))
if err = rawDataFn(bytes.NewReader(inspectArgsBytes), "", "", "inspect-input.txt", StatInfo{
Size: int64(len(inspectArgsBytes)),
}); err != nil {
logger.LogIf(ctx, err)
}