icingadb-migrate: Verify env ID length

An env ID with the wrong length, either due to a copy-paste error or
human error during testing, results in a SQL CHECK CONSTRAINT violation
that is retried multiple times until it finally fails.
This commit is contained in:
Alvar Penning 2024-07-09 13:24:01 +02:00
parent 6102d9cb2e
commit b7483eb6f8
No known key found for this signature in database

View file

@ -71,6 +71,10 @@ func main() {
_, _ = fmt.Fprintf(os.Stderr, "bad env ID: %s\n", err.Error())
os.Exit(2)
}
if len(envId) != 20 {
_, _ = fmt.Fprintf(os.Stderr, "bad env ID: must be 20 bytes long, has %d bytes\n", len(envId))
os.Exit(2)
}
defer func() { _ = log.Sync() }()