Skip to content

Commit

Permalink
Merge pull request #9671 from Evalle/ISSUE-9664
Browse files Browse the repository at this point in the history
Rename `out.T` to `out.Step`
  • Loading branch information
priyawadhwa authored Nov 13, 2020
2 parents 6f037f8 + 1540ca8 commit 9438167
Show file tree
Hide file tree
Showing 45 changed files with 139 additions and 139 deletions.
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/addons_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ var printAddonsList = func(cc *config.ClusterConfig) {
klog.Errorf("list profiles returned error: %v", err)
}
if len(v) > 1 {
out.T(style.Tip, "To see addons list for other profiles use: `minikube addons -p name list`")
out.Step(style.Tip, "To see addons list for other profiles use: `minikube addons -p name list`")
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var addonsDisableCmd = &cobra.Command{
if err != nil {
exit.Error(reason.InternalDisable, "disable failed", err)
}
out.T(style.AddonDisable, `"The '{{.minikube_addon}}' addon is disabled`, out.V{"minikube_addon": addon})
out.Step(style.AddonDisable, `"The '{{.minikube_addon}}' addon is disabled`, out.V{"minikube_addon": addon})
},
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/minikube/cmd/config/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var addonsEnableCmd = &cobra.Command{
addon := args[0]
// replace heapster as metrics-server because heapster is deprecated
if addon == "heapster" {
out.T(style.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated")
out.Step(style.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated")
addon = "metrics-server"
}
err := addons.SetAndSave(ClusterFlagValue(), addon, "true")
Expand All @@ -51,15 +51,15 @@ var addonsEnableCmd = &cobra.Command{
if ClusterFlagValue() != constants.DefaultClusterName {
tipProfileArg = fmt.Sprintf(" -p %s", ClusterFlagValue())
}
out.T(style.Tip, `Some dashboard features require the metrics-server addon. To enable all features please run:
out.Step(style.Tip, `Some dashboard features require the metrics-server addon. To enable all features please run:
minikube{{.profileArg}} addons enable metrics-server
`, out.V{"profileArg": tipProfileArg})

}

out.T(style.AddonEnable, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon})
out.Step(style.AddonEnable, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon})
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ You can add one by annotating a service with the label {{.labelName}}:{{.addonNa
}

if len(urlString) != 0 {
out.T(style.Celebrate, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
out.Step(style.Celebrate, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
for _, url := range urlString {
if err := browser.OpenURL(url); err != nil {
exit.Error(reason.HostBrowser, fmt.Sprintf("browser failed to open url %s", url), err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var ProfileCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
profile := ClusterFlagValue()
out.T(style.Empty, profile)
out.Step(style.Empty, profile)
os.Exit(0)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ var dashboardCmd = &cobra.Command{
if dashboardURLMode || user.Uid == "0" {
out.Ln(url)
} else {
out.T(style.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})
out.Step(style.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})
if err = browser.OpenURL(url); err != nil {
exit.Message(reason.HostBrowser, "failed to open browser: {{.error}}", out.V{"error": err})
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/minikube/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func runDelete(cmd *cobra.Command, args []string) {
if purge && len(profilesToDelete) > 1 && !deleteAll {
out.ErrT(style.Notice, "Multiple minikube profiles were found - ")
for _, p := range profilesToDelete {
out.T(style.Notice, " - {{.profile}}", out.V{"profile": p.Name})
out.Step(style.Notice, " - {{.profile}}", out.V{"profile": p.Name})
}
exit.Message(reason.Usage, "Usage: minikube delete --all --purge")
}
Expand All @@ -157,7 +157,7 @@ func runDelete(cmd *cobra.Command, args []string) {
if len(errs) > 0 {
HandleDeletionErrors(errs)
} else {
out.T(style.DeletingHost, "Successfully deleted all profiles")
out.Step(style.DeletingHost, "Successfully deleted all profiles")
}
} else {
if len(args) > 0 {
Expand Down Expand Up @@ -198,7 +198,7 @@ func purgeMinikubeDirectory() {
if err := os.RemoveAll(localpath.MiniPath()); err != nil {
exit.Error(reason.HostPurge, "unable to delete minikube config folder", err)
}
out.T(style.Deleted, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", out.V{"minikubeDirectory": localpath.MiniPath()})
out.Step(style.Deleted, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", out.V{"minikubeDirectory": localpath.MiniPath()})
}

// DeleteProfiles deletes one or more profiles
Expand Down Expand Up @@ -246,7 +246,7 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
cs, err := oci.ListContainersByLabel(bin, delLabel)
if err == nil && len(cs) > 0 {
for _, c := range cs {
out.T(style.DeletingHost, `Deleting container "{{.name}}" ...`, out.V{"name": cname})
out.Step(style.DeletingHost, `Deleting container "{{.name}}" ...`, out.V{"name": cname})
err := oci.DeleteContainer(bin, c)
if err != nil { // it will error if there is no container to delete
klog.Errorf("error deleting container %q. You may want to delete it manually :\n%v", cname, err)
Expand Down Expand Up @@ -286,7 +286,7 @@ func deleteProfile(profile *config.Profile) error {

// if driver is oci driver, delete containers and volumes
if driver.IsKIC(profile.Config.Driver) {
out.T(style.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver})
out.Step(style.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver})
for _, n := range profile.Config.Nodes {
machineName := driver.MachineName(*profile.Config, n)
deletePossibleKicLeftOver(machineName, profile.Config.Driver)
Expand Down Expand Up @@ -337,7 +337,7 @@ func deleteProfile(profile *config.Profile) error {
if err := deleteContext(profile.Name); err != nil {
return err
}
out.T(style.Deleted, `Removed all traces of the "{{.name}}" cluster.`, out.V{"name": profile.Name})
out.Step(style.Deleted, `Removed all traces of the "{{.name}}" cluster.`, out.V{"name": profile.Name})
return nil
}

Expand All @@ -353,7 +353,7 @@ func deleteHosts(api libmachine.API, cc *config.ClusterConfig) {
klog.Infof("Host %s does not exist. Proceeding ahead with cleanup.", machineName)
default:
out.FailureT("Failed to delete cluster: {{.error}}", out.V{"error": err})
out.T(style.Notice, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName})
out.Step(style.Notice, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName})
}
}
}
Expand Down Expand Up @@ -384,7 +384,7 @@ func deleteContext(machineName string) error {
}

func deleteInvalidProfile(profile *config.Profile) []error {
out.T(style.DeletingHost, "Trying to delete invalid profile {{.profile}}", out.V{"profile": profile.Name})
out.Step(style.DeletingHost, "Trying to delete invalid profile {{.profile}}", out.V{"profile": profile.Name})

var errs []error
pathToProfile := config.ProfileFolderPath(profile.Name, localpath.MiniPath())
Expand All @@ -410,7 +410,7 @@ func profileDeletionErr(cname string, additionalInfo string) error {
}

func uninstallKubernetes(api libmachine.API, cc config.ClusterConfig, n config.Node, bsName string) error {
out.T(style.Resetting, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName})
out.Step(style.Resetting, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName})
host, err := machine.LoadHost(api, driver.MachineName(cc, n))
if err != nil {
return DeletionError{Err: fmt.Errorf("unable to load host: %v", err), Errtype: MissingCluster}
Expand Down Expand Up @@ -488,7 +488,7 @@ func handleMultipleDeletionErrors(errors []error) {
func deleteProfileDirectory(profile string) {
machineDir := filepath.Join(localpath.MiniPath(), "machines", profile)
if _, err := os.Stat(machineDir); err == nil {
out.T(style.DeletingHost, `Removing {{.directory}} ...`, out.V{"directory": machineDir})
out.Step(style.DeletingHost, `Removing {{.directory}} ...`, out.V{"directory": machineDir})
err := os.RemoveAll(machineDir)
if err != nil {
exit.Error(reason.GuestProfileDeletion, "Unable to remove machine directory", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/generate-docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var generateDocs = &cobra.Command{
if err := generate.Docs(RootCmd, path); err != nil {
exit.Error(reason.InternalGenerateDocs, "Unable to generate docs", err)
}
out.T(style.Documentation, "Docs have been saved at - {{.path}}", out.V{"path": path})
out.Step(style.Documentation, "Docs have been saved at - {{.path}}", out.V{"path": path})
},
}

Expand Down
12 changes: 6 additions & 6 deletions cmd/minikube/cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ var mountCmd = &cobra.Command{
if driver.IsKIC(co.CP.Host.Driver.DriverName()) && runtime.GOOS != "linux" {
bindIP = "127.0.0.1"
}
out.T(style.Mounting, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.Step(style.Mounting, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.Infof("Mount type: {{.name}}", out.V{"type": cfg.Type})
out.Infof("User ID: {{.userID}}", out.V{"userID": cfg.UID})
out.Infof("Group ID: {{.groupID}}", out.V{"groupID": cfg.GID})
Expand All @@ -168,9 +168,9 @@ var mountCmd = &cobra.Command{
if cfg.Type == nineP {
wg.Add(1)
go func() {
out.T(style.Fileserver, "Userspace file server: ")
out.Step(style.Fileserver, "Userspace file server: ")
ufs.StartServer(net.JoinHostPort(bindIP, strconv.Itoa(port)), debugVal, hostPath)
out.T(style.Stopped, "Userspace file server is shutdown")
out.Step(style.Stopped, "Userspace file server is shutdown")
wg.Done()
}()
}
Expand All @@ -180,7 +180,7 @@ var mountCmd = &cobra.Command{
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
for sig := range c {
out.T(style.Unmount, "Unmounting {{.path}} ...", out.V{"path": vmPath})
out.Step(style.Unmount, "Unmounting {{.path}} ...", out.V{"path": vmPath})
err := cluster.Unmount(co.CP.Runner, vmPath)
if err != nil {
out.FailureT("Failed unmount: {{.error}}", out.V{"error": err})
Expand All @@ -193,9 +193,9 @@ var mountCmd = &cobra.Command{
if err != nil {
exit.Error(reason.GuestMount, "mount failed", err)
}
out.T(style.Success, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.Step(style.Success, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath})
out.Ln("")
out.T(style.Notice, "NOTE: This process must stay alive for the mount to be accessible ...")
out.Step(style.Notice, "NOTE: This process must stay alive for the mount to be accessible ...")
wg.Wait()
},
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/minikube/cmd/node_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var nodeAddCmd = &cobra.Command{

name := node.Name(len(cc.Nodes) + 1)

out.T(style.Happy, "Adding node {{.name}} to cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name})
out.Step(style.Happy, "Adding node {{.name}} to cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name})

// TODO: Deal with parameters better. Ideally we should be able to acceot any node-specific minikube start params here.
n := config.Node{
Expand Down Expand Up @@ -77,7 +77,7 @@ var nodeAddCmd = &cobra.Command{
exit.Error(reason.HostSaveProfile, "failed to save config", err)
}

out.T(style.Ready, "Successfully added {{.name}} to {{.cluster}}!", out.V{"name": name, "cluster": cc.Name})
out.Step(style.Ready, "Successfully added {{.name}} to {{.cluster}}!", out.V{"name": name, "cluster": cc.Name})
},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/minikube/cmd/node_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var nodeDeleteCmd = &cobra.Command{
name := args[0]

co := mustload.Healthy(ClusterFlagValue())
out.T(style.DeletingHost, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name})
out.Step(style.DeletingHost, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name})

n, err := node.Delete(*co.Config, name)
if err != nil {
Expand All @@ -50,7 +50,7 @@ var nodeDeleteCmd = &cobra.Command{
deletePossibleKicLeftOver(machineName, co.Config.Driver)
}

out.T(style.Deleted, "Node {{.name}} was successfully deleted.", out.V{"name": name})
out.Step(style.Deleted, "Node {{.name}} was successfully deleted.", out.V{"name": name})
},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/minikube/cmd/node_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var nodeStartCmd = &cobra.Command{

machineName := driver.MachineName(*cc, *n)
if machine.IsRunning(api, machineName) {
out.T(style.Check, "{{.name}} is already running", out.V{"name": name})
out.Step(style.Check, "{{.name}} is already running", out.V{"name": name})
os.Exit(0)
}

Expand All @@ -77,7 +77,7 @@ var nodeStartCmd = &cobra.Command{
exit.Error(reason.GuestNodeStart, "failed to start node", err)
}
}
out.T(style.Happy, "Successfully started node {{.name}}!", out.V{"name": machineName})
out.Step(style.Happy, "Successfully started node {{.name}}!", out.V{"name": machineName})
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/node_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var nodeStopCmd = &cobra.Command{
if err != nil {
out.FatalT("Failed to stop node {{.name}}", out.V{"name": name})
}
out.T(style.Stopped, "Successfully stopped node {{.name}}", out.V{"name": machineName})
out.Step(style.Stopped, "Successfully stopped node {{.name}}", out.V{"name": machineName})
},
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/minikube/cmd/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func runPause(cmd *cobra.Command, args []string) {
name = co.Config.Name
}

out.T(style.Pause, "Pausing node {{.name}} ... ", out.V{"name": name})
out.Step(style.Pause, "Pausing node {{.name}} ... ", out.V{"name": name})

host, err := machine.LoadHost(co.API, driver.MachineName(*co.Config, n))
if err != nil {
Expand All @@ -97,9 +97,9 @@ func runPause(cmd *cobra.Command, args []string) {

register.Reg.SetStep(register.Done)
if namespaces == nil {
out.T(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(ids)})
out.Step(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(ids)})
} else {
out.T(style.Unpause, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")})
out.Step(style.Unpause, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")})
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func openURLs(svc string, urls []string) {
continue
}

out.T(style.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
out.Step(style.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
if err := browser.OpenURL(u); err != nil {
exit.Error(reason.HostBrowser, fmt.Sprintf("open url failed: %s", u), err)
}
Expand Down
Loading

0 comments on commit 9438167

Please sign in to comment.