From 406f0ab05cdd6b8b149fdad7bb0d6caa6d71d93c Mon Sep 17 00:00:00 2001 From: vaikas-google Date: Mon, 29 Aug 2016 17:14:55 -0700 Subject: [PATCH] print the status after install/upgrade Signed-off-by: vaikas-google --- cmd/helm/install.go | 7 +++++++ cmd/helm/status.go | 27 ++++++++++++++++----------- cmd/helm/upgrade.go | 7 +++++++ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 402c2a549..3365eace1 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -151,6 +151,13 @@ func (i *installCmd) run() error { i.printRelease(res.GetRelease()) + // Print the status like status command does + status, err := i.client.ReleaseStatus(res.GetRelease().Name) + if err != nil { + return prettyError(err) + } + PrintStatus(i.out, status) + return nil } diff --git a/cmd/helm/status.go b/cmd/helm/status.go index f4d8deaea..191f2572d 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -23,6 +23,7 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/timeconv" ) @@ -66,16 +67,20 @@ func (s *statusCmd) run() error { return prettyError(err) } - fmt.Fprintf(s.out, "Last Deployed: %s\n", timeconv.String(res.Info.LastDeployed)) - fmt.Fprintf(s.out, "Namespace: %s\n", res.Namespace) - fmt.Fprintf(s.out, "Status: %s\n", res.Info.Status.Code) - if res.Info.Status.Details != nil { - fmt.Fprintf(s.out, "Details: %s\n", res.Info.Status.Details) - } - fmt.Fprintf(s.out, "\n") - fmt.Fprintf(s.out, "Resources:\n%s\n", res.Info.Status.Resources) - if len(res.Info.Status.Notes) > 0 { - fmt.Fprintf(s.out, "Notes:\n%s\n", res.Info.Status.Notes) - } + PrintStatus(s.out, res) return nil } + +func PrintStatus(out io.Writer, res *services.GetReleaseStatusResponse) { + fmt.Fprintf(out, "Last Deployed: %s\n", timeconv.String(res.Info.LastDeployed)) + fmt.Fprintf(out, "Namespace: %s\n", res.Namespace) + fmt.Fprintf(out, "Status: %s\n", res.Info.Status.Code) + if res.Info.Status.Details != nil { + fmt.Fprintf(out, "Details: %s\n", res.Info.Status.Details) + } + fmt.Fprintf(out, "\n") + fmt.Fprintf(out, "Resources:\n%s\n", res.Info.Status.Resources) + if len(res.Info.Status.Notes) > 0 { + fmt.Fprintf(out, "Notes:\n%s\n", res.Info.Status.Notes) + } +} diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 10251dadd..95b5e7901 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -131,6 +131,13 @@ func (u *upgradeCmd) run() error { success := u.release + " has been upgraded. Happy Helming!\n" fmt.Fprintf(u.out, success) + // Print the status like status command does + status, err := u.client.ReleaseStatus(u.release) + if err != nil { + return prettyError(err) + } + PrintStatus(u.out, status) + return nil }