|
|
@ -97,8 +97,8 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|
|
|
// If a release does not exist, install it.
|
|
|
|
// If a release does not exist, install it.
|
|
|
|
histClient := action.NewHistory(cfg)
|
|
|
|
histClient := action.NewHistory(cfg)
|
|
|
|
histClient.Max = 1
|
|
|
|
histClient.Max = 1
|
|
|
|
rel, err := histClient.Run(args[0])
|
|
|
|
versions, err := histClient.Run(args[0])
|
|
|
|
if err == driver.ErrReleaseNotFound || (len(rel) > 0 && rel[len(rel)-1].Info.Status == release.StatusUninstalled) {
|
|
|
|
if err == driver.ErrReleaseNotFound || isReleaseUninstalled(versions) {
|
|
|
|
// Only print this to stdout for table output
|
|
|
|
// Only print this to stdout for table output
|
|
|
|
if outfmt == output.Table {
|
|
|
|
if outfmt == output.Table {
|
|
|
|
fmt.Fprintf(out, "Release %q does not exist. Installing it now.\n", args[0])
|
|
|
|
fmt.Fprintf(out, "Release %q does not exist. Installing it now.\n", args[0])
|
|
|
@ -120,7 +120,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|
|
|
instClient.SubNotes = client.SubNotes
|
|
|
|
instClient.SubNotes = client.SubNotes
|
|
|
|
instClient.Description = client.Description
|
|
|
|
instClient.Description = client.Description
|
|
|
|
instClient.DependencyUpdate = client.DependencyUpdate
|
|
|
|
instClient.DependencyUpdate = client.DependencyUpdate
|
|
|
|
if len(rel) > 0 && rel[len(rel)-1].Info.Status == release.StatusUninstalled {
|
|
|
|
if isReleaseUninstalled(versions) {
|
|
|
|
instClient.Replace = true
|
|
|
|
instClient.Replace = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -254,3 +254,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|
|
|
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func isReleaseUninstalled(versions []*release.Release) bool {
|
|
|
|
|
|
|
|
return len(versions) > 0 && versions[len(versions)-1].Info.Status == release.StatusUninstalled
|
|
|
|
|
|
|
|
}
|
|
|
|