support non-interactive mode in support bundle (#340)

* support non-interactive mode in support bundle
This commit is contained in:
Salah Aldeen Al Saleh
2021-03-23 18:01:39 -07:00
committed by GitHub
parent 81789181ed
commit 810b3cbf78
2 changed files with 2 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ from a server that can be used to assist when troubleshooting a Kubernetes clust
cmd.Flags().StringSlice("redactors", []string{}, "names of the additional redactors to use")
cmd.Flags().Bool("redact", true, "enable/disable default redactions")
cmd.Flags().Bool("interactive", true, "enable/disable interactive mode")
cmd.Flags().Bool("collect-without-permissions", false, "always generate a support bundle, even if it some require additional permissions")
cmd.Flags().String("since-time", "", "force pod logs collectors to return logs after a specific date (RFC3339)")
cmd.Flags().String("since", "", "force pod logs collectors to return logs newer than a relative duration like 5s, 2m, or 3h.")

View File

@@ -200,7 +200,7 @@ func runTroubleshoot(v *viper.Viper, arg string) error {
c.Printf("%s\r * Failed to analyze support bundle: %v\n", cursor.ClearEntireLine(), err)
}
interactive := isatty.IsTerminal(os.Stdout.Fd())
interactive := v.GetBool("interactive") && isatty.IsTerminal(os.Stdout.Fd())
if interactive {
close(finishedCh) // this removes the spinner