Example #1
0
File: list.go Project: slack/helm
func formatList(rels []*release.Release) string {
	table := uitable.New()
	table.MaxColWidth = 30
	table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART")
	for _, r := range rels {
		c := fmt.Sprintf("%s-%s", r.Chart.Metadata.Name, r.Chart.Metadata.Version)
		t := timeconv.String(r.Info.LastDeployed)
		s := r.Info.Status.Code.String()
		v := r.Version
		table.AddRow(r.Name, v, t, s, c)
	}
	return table.String()
}
Example #2
0
func printRelease(rel *release.Release) {
	if rel == nil {
		return
	}
	if flagDebug {
		fmt.Printf("NAME:   %s\n", rel.Name)
		fmt.Printf("INFO:   %s %s\n", timeconv.String(rel.Info.LastDeployed), rel.Info.Status)
		fmt.Printf("CHART:  %s %s\n", rel.Chart.Metadata.Name, rel.Chart.Metadata.Version)
		fmt.Printf("MANIFEST: %s\n", rel.Manifest)
	} else {
		fmt.Println(rel.Name)
	}
}
Example #3
0
func formatHistory(rls []*release.Release) string {
	tbl := uitable.New()
	tbl.MaxColWidth = 30
	tbl.AddRow("REVISION", "UPDATED", "STATUS", "CHART")
	for i := len(rls) - 1; i >= 0; i-- {
		r := rls[i]
		c := formatChartname(r.Chart)
		t := timeconv.String(r.Info.LastDeployed)
		s := r.Info.Status.Code.String()
		v := r.Version
		tbl.AddRow(v, t, s, c)
	}
	return tbl.String()
}
Example #4
0
// printRelease prints info about a release if the flagDebug is true.
func (i *installCmd) printRelease(rel *release.Release) {
	if rel == nil {
		return
	}
	// TODO: Switch to text/template like everything else.
	if flagDebug {
		fmt.Fprintf(i.out, "NAME:   %s\n", rel.Name)
		fmt.Fprintf(i.out, "NAMESPACE:   %s\n", rel.Namespace)
		fmt.Fprintf(i.out, "INFO:   %s %s\n", timeconv.String(rel.Info.LastDeployed), rel.Info.Status)
		fmt.Fprintf(i.out, "CHART:  %s %s\n", rel.Chart.Metadata.Name, rel.Chart.Metadata.Version)
		fmt.Fprintf(i.out, "MANIFEST: %s\n", rel.Manifest)
	} else {
		fmt.Fprintln(i.out, rel.Name)
	}
}
Example #5
0
// PrintStatus prints out the status of a release. Shared because also used by
// install / upgrade
func PrintStatus(out io.Writer, res *services.GetReleaseStatusResponse) {
	if res.Info.LastDeployed != nil {
		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")
	if len(res.Info.Status.Resources) > 0 {
		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)
	}
}
Example #6
0
// PrintStatus prints out the status of a release. Shared because also used by
// install / upgrade
func PrintStatus(out io.Writer, res *services.GetReleaseStatusResponse) {
	if res.Info.LastDeployed != nil {
		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")
	if len(res.Info.Status.Resources) > 0 {
		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)
	}
}
Example #7
0
func status(cmd *cobra.Command, args []string) error {
	if len(args) == 0 {
		return errReleaseRequired
	}

	res, err := helm.GetReleaseStatus(args[0])
	if err != nil {
		return prettyError(err)
	}

	fmt.Printf("Last Deployed: %s\n", timeconv.String(res.Info.LastDeployed))
	fmt.Printf("Status: %s\n", res.Info.Status.Code)
	if res.Info.Status.Details != nil {
		fmt.Printf("Details: %s\n", res.Info.Status.Details)
	}

	return nil
}