Append both env variables instead of fetching twice and overriding them.

Previously the second line would fetch the clean environment variables
and drop the changes from the first line.
This commit is contained in:
Justyna Betkier 2024-04-24 11:50:33 +02:00
parent 8a9031f9c9
commit 8ba3327de7

View File

@ -615,8 +615,9 @@ func CoreDump(dir string) {
Logf("Dumping logs locally to: %s", dir)
cmd = exec.Command(path.Join(TestContext.RepoRoot, "cluster", "log-dump", "log-dump.sh"), dir)
}
cmd.Env = append(os.Environ(), fmt.Sprintf("LOG_DUMP_SYSTEMD_SERVICES=%s", parseSystemdServices(TestContext.SystemdServices)))
cmd.Env = append(os.Environ(), fmt.Sprintf("LOG_DUMP_SYSTEMD_JOURNAL=%v", TestContext.DumpSystemdJournal))
env := os.Environ()
env = append(env, fmt.Sprintf("LOG_DUMP_SYSTEMD_SERVICES=%s", parseSystemdServices(TestContext.SystemdServices)))
cmd.Env = append(env, fmt.Sprintf("LOG_DUMP_SYSTEMD_JOURNAL=%v", TestContext.DumpSystemdJournal))
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr