Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON output to stop, pause and unpause #9576

Merged
merged 8 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func platform() string {
func runStart(cmd *cobra.Command, args []string) {
register.SetEventLogPath(localpath.EventLog(ClusterFlagValue()))

out.SetJSON(viper.GetString(startOutput) == "json")
out.SetJSON(viper.GetString(outputFormat) == "json")
displayVersion(version.GetVersion())

// No need to do the update check if no one is going to see it
Expand Down Expand Up @@ -1074,7 +1074,7 @@ func validateFlags(cmd *cobra.Command, drvName string) {
}
}

if s := viper.GetString(startOutput); s != "text" && s != "json" {
if s := viper.GetString(outputFormat); s != "text" && s != "json" {
exit.Message(reason.Usage, "Sorry, please set the --output flag to one of the following valid options: [text,json]")
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/minikube/cmd/start_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const (
deleteOnFailure = "delete-on-failure"
forceSystemd = "force-systemd"
kicBaseImage = "base-image"
startOutput = "output"
outputFormat = "output"
ports = "ports"
)

Expand Down Expand Up @@ -147,7 +147,7 @@ func initMinikubeFlags() {
startCmd.Flags().Bool(preload, true, "If set, download tarball of preloaded images if available to improve start time. Defaults to true.")
startCmd.Flags().Bool(deleteOnFailure, false, "If set, delete the current cluster if start fails and try again. Defaults to false.")
startCmd.Flags().Bool(forceSystemd, false, "If set, force the container runtime to use sytemd as cgroup manager. Currently available for docker and crio. Defaults to false.")
startCmd.Flags().StringP(startOutput, "o", "text", "Format to print stdout in. Options include: [text,json]")
startCmd.Flags().StringP(outputFormat, "o", "text", "Format to print stdout in. Options include: [text,json]")
}

// initKubernetesFlags inits the commandline flags for Kubernetes related options
Expand Down
2 changes: 2 additions & 0 deletions cmd/minikube/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var stopCmd = &cobra.Command{
func init() {
stopCmd.Flags().BoolVar(&stopAll, "all", false, "Set flag to stop all profiles (clusters)")
stopCmd.Flags().BoolVar(&keepActive, "keep-context-active", false, "keep the kube-context active after cluster is stopped. Defaults to false.")
stopCmd.Flags().StringP(outputFormat, "o", "text", "Format to print stdout in. Options include: [text,json]")

if err := viper.GetViper().BindPFlags(stopCmd.Flags()); err != nil {
exit.Error(reason.InternalFlagsBind, "unable to bind flags", err)
Expand All @@ -63,6 +64,7 @@ func init() {

// runStop handles the executes the flow of "minikube stop"
func runStop(cmd *cobra.Command, args []string) {
out.SetJSON(viper.GetString(outputFormat) == "json")
register.SetEventLogPath(localpath.EventLog(ClusterFlagValue()))
register.Reg.SetStep(register.Stopping)

Expand Down