fix: the inspect script to use scheme per deployment (#18118)

This commit is contained in:
Harshavardhana 2023-09-27 08:22:50 -07:00 committed by GitHub
parent 6bc7d711b3
commit 3c470a6b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -2929,9 +2929,14 @@ func (a adminAPIHandlers) InspectDataHandler(w http.ResponseWriter, r *http.Requ
sb.WriteString("\n")
logger.LogIf(ctx, embedFileInZip(inspectZipW, "inspect-input.txt", sb.Bytes(), 0o600))
scheme := "https"
if !globalIsTLS {
scheme = "http"
}
// save MinIO start script to inspect command
var scrb bytes.Buffer
scrb.WriteString(`#!/usr/bin/env bash
fmt.Fprintf(&scrb, `#!/usr/bin/env bash
function main() {
for file in $(ls -1); do
@ -2940,10 +2945,10 @@ function main() {
done
# Read content of inspect-input.txt
MINIO_OPTS=$(grep "Server command line args" <./inspect-input.txt | sed "s/Server command line args: //g" | sed -r "s#https:\/\/#\.\/#g")
MINIO_OPTS=$(grep "Server command line args" <./inspect-input.txt | sed "s/Server command line args: //g" | sed -r "s#%s:\/\/#\.\/#g")
# Start MinIO instance using the options
START_CMD="CI=on _MINIO_AUTO_DISK_HEALING=off minio server ${MINIO_OPTS} &"
START_CMD="CI=on _MINIO_AUTO_DRIVE_HEALING=off minio server ${MINIO_OPTS} &"
echo
echo "Starting MinIO instance: ${START_CMD}"
echo
@ -2955,8 +2960,7 @@ function main() {
sleep 10
}
main "$@"`,
)
main "$@"`, scheme)
logger.LogIf(ctx, embedFileInZip(inspectZipW, "start-minio.sh", scrb.Bytes(), 0o755))
}

View File

@ -496,8 +496,12 @@ func (er erasureObjects) deleteIfDangling(ctx context.Context, bucket, object st
m, ok := isObjectDangling(metaArr, errs, dataErrs)
if ok {
tags := make(map[string]interface{}, 4)
tags["size"] = m.Size
tags["set"] = er.setIndex
tags["pool"] = er.poolIndex
tags["merrs"] = errors.Join(errs...)
tags["derrs"] = errors.Join(dataErrs...)
tags["mtime"] = m.ModTime.Format(http.TimeFormat)
tags["parity"] = m.Erasure.ParityBlocks
if cok {
tags["caller"] = fmt.Sprintf("%s:%d", file, line)

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/minio/minio
go 1.19
go 1.20
require (
cloud.google.com/go/storage v1.33.0