ref(*): remove dead code

Signed-off-by: Adam Reese <adam@reese.io>
pull/6254/head
Adam Reese 5 years ago
parent 2540c4ec80
commit b2d5e41fc7
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -55,7 +55,7 @@ func newRollbackCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client.Version = ver client.Version = ver
} }
if _, err := client.Run(args[0]); err != nil { if err := client.Run(args[0]); err != nil {
return err return err
} }

@ -29,7 +29,6 @@ import (
"strings" "strings"
"github.com/Masterminds/semver" "github.com/Masterminds/semver"
"github.com/pkg/errors"
"helm.sh/helm/pkg/repo" "helm.sh/helm/pkg/repo"
) )
@ -178,15 +177,6 @@ func (i *Index) SearchRegexp(re string, threshold int) ([]*Result, error) {
return buf, nil return buf, nil
} }
// Chart returns the ChartVersion for a particular name.
func (i *Index) Chart(name string) (*repo.ChartVersion, error) {
c, ok := i.charts[name]
if !ok {
return nil, errors.New("no such chart")
}
return c, nil
}
// SortScore does an in-place sort of the results. // SortScore does an in-place sort of the results.
// //
// Lowest scores are highest on the list. Matching scores are subsorted alphabetically. // Lowest scores are highest on the list. Matching scores are subsorted alphabetically.

@ -59,22 +59,6 @@ func TestStatusCmd(t *testing.T) {
Status: release.StatusDeployed, Status: release.StatusDeployed,
Notes: "release notes", Notes: "release notes",
}), }),
}, {
name: "get status of a deployed release with resources",
cmd: "status flummoxed-chickadee",
golden: "output/status-with-resource.txt",
rels: releasesMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Resources: "resource A\nresource B\n",
}),
}, {
name: "get status of a deployed release with resources in YAML",
cmd: "status flummoxed-chickadee -o yaml",
golden: "output/status.yaml",
rels: releasesMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Resources: "resource A\nresource B\n",
}),
}, { }, {
name: "get status of a deployed release with test suite", name: "get status of a deployed release with test suite",
cmd: "status flummoxed-chickadee", cmd: "status flummoxed-chickadee",

@ -2,4 +2,3 @@ NAME: aeneas
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: FOOBAR
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: aeneas
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: foobar
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: apollo
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: aeneas
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: schema
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,6 +2,5 @@ NAME: flummoxed-chickadee
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed
NOTES: NOTES:
release notes release notes

@ -2,7 +2,6 @@ NAME: flummoxed-chickadee
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed
TEST SUITE: passing-test TEST SUITE: passing-test
Last Started: 2006-01-02 15:04:05 +0000 UTC Last Started: 2006-01-02 15:04:05 +0000 UTC
Last Completed: 2006-01-02 15:04:07 +0000 UTC Last Completed: 2006-01-02 15:04:07 +0000 UTC

@ -2,4 +2,3 @@ NAME: flummoxed-chickadee
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -2,4 +2,3 @@ NAME: schema
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -3,4 +3,3 @@ NAME: crazy-bunny
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -3,4 +3,3 @@ NAME: zany-bunny
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -3,4 +3,3 @@ NAME: funny-bunny
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -3,4 +3,3 @@ NAME: funny-bunny
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -3,4 +3,3 @@ NAME: funny-bunny
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -3,4 +3,3 @@ NAME: crazy-bunny
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -3,4 +3,3 @@ NAME: funny-bunny
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed

@ -73,11 +73,6 @@ func Parse(file io.Reader) (*Rules, error) {
return r, s.Err() return r, s.Err()
} }
// Len returns the number of patterns in this rule set.
func (r *Rules) Len() int {
return len(r.patterns)
}
// Ignore evalutes the file at the given path, and returns true if it should be ignored. // Ignore evalutes the file at the given path, and returns true if it should be ignored.
// //
// Ignore evaluates path against the rules in order. Evaluation stops when a match // Ignore evaluates path against the rules in order. Evaluation stops when a match

@ -138,10 +138,6 @@ func NewList(cfg *Configuration) *List {
} }
} }
func (l *List) SetConfiguration(cfg *Configuration) {
l.cfg = cfg
}
// Run executes the list command, returning a set of matches. // Run executes the list command, returning a set of matches.
func (l *List) Run() ([]*release.Release, error) { func (l *List) Run() ([]*release.Release, error) {
var filter *regexp.Regexp var filter *regexp.Regexp

@ -19,9 +19,7 @@ package action
import ( import (
"fmt" "fmt"
"io" "io"
"regexp"
"strings" "strings"
"text/tabwriter"
"helm.sh/helm/pkg/release" "helm.sh/helm/pkg/release"
) )
@ -37,14 +35,6 @@ func PrintRelease(out io.Writer, rel *release.Release) {
} }
fmt.Fprintf(out, "NAMESPACE: %s\n", rel.Namespace) fmt.Fprintf(out, "NAMESPACE: %s\n", rel.Namespace)
fmt.Fprintf(out, "STATUS: %s\n", rel.Info.Status.String()) fmt.Fprintf(out, "STATUS: %s\n", rel.Info.Status.String())
fmt.Fprintf(out, "\n")
if len(rel.Info.Resources) > 0 {
re := regexp.MustCompile(" +")
w := tabwriter.NewWriter(out, 0, 0, 2, ' ', tabwriter.TabIndent)
fmt.Fprintf(w, "RESOURCES:\n%s\n", re.ReplaceAllString(rel.Info.Resources, "\t"))
w.Flush()
}
executions := executionsByHookEvent(rel) executions := executionsByHookEvent(rel)
if tests, ok := executions[release.HookTest]; ok { if tests, ok := executions[release.HookTest]; ok {

@ -49,33 +49,31 @@ func NewRollback(cfg *Configuration) *Rollback {
} }
// Run executes 'helm rollback' against the given release. // Run executes 'helm rollback' against the given release.
func (r *Rollback) Run(name string) (*release.Release, error) { func (r *Rollback) Run(name string) error {
r.cfg.Log("preparing rollback of %s", name) r.cfg.Log("preparing rollback of %s", name)
currentRelease, targetRelease, err := r.prepareRollback(name) currentRelease, targetRelease, err := r.prepareRollback(name)
if err != nil { if err != nil {
return nil, err return err
} }
if !r.DryRun { if !r.DryRun {
r.cfg.Log("creating rolled back release for %s", name) r.cfg.Log("creating rolled back release for %s", name)
if err := r.cfg.Releases.Create(targetRelease); err != nil { if err := r.cfg.Releases.Create(targetRelease); err != nil {
return nil, err return err
} }
} }
r.cfg.Log("performing rollback of %s", name) r.cfg.Log("performing rollback of %s", name)
res, err := r.performRollback(currentRelease, targetRelease) if _, err := r.performRollback(currentRelease, targetRelease); err != nil {
if err != nil { return err
return res, err
} }
if !r.DryRun { if !r.DryRun {
r.cfg.Log("updating status for rolled back release for %s", name) r.cfg.Log("updating status for rolled back release for %s", name)
if err := r.cfg.Releases.Update(targetRelease); err != nil { if err := r.cfg.Releases.Update(targetRelease); err != nil {
return res, err return err
} }
} }
return nil
return res, nil
} }
// prepareRollback finds the previous release and prepares a new release object with // prepareRollback finds the previous release and prepares a new release object with

@ -292,7 +292,7 @@ func (u *Upgrade) failRelease(rel *release.Release, err error) (*release.Release
rollin.Recreate = u.Recreate rollin.Recreate = u.Recreate
rollin.Force = u.Force rollin.Force = u.Force
rollin.Timeout = u.Timeout rollin.Timeout = u.Timeout
if _, rollErr := rollin.Run(rel.Name); rollErr != nil { if rollErr := rollin.Run(rel.Name); rollErr != nil {
return rel, errors.Wrapf(rollErr, "an error occurred while rolling back the release. original upgrade error: %s", err) return rel, errors.Wrapf(rollErr, "an error occurred while rolling back the release. original upgrade error: %s", err)
} }
return rel, errors.Wrapf(err, "release %s failed, and has been rolled back due to atomic being set", rel.Name) return rel, errors.Wrapf(err, "release %s failed, and has been rolled back due to atomic being set", rel.Name)

@ -81,9 +81,6 @@ func (ch *Chart) IsRoot() bool { return ch.parent == nil }
// Parent returns a subchart's parent chart. // Parent returns a subchart's parent chart.
func (ch *Chart) Parent() *Chart { return ch.parent } func (ch *Chart) Parent() *Chart { return ch.parent }
// SetParent sets a subchart's parent chart.
func (ch *Chart) SetParent(chart *Chart) { ch.parent = chart }
// ChartPath returns the full path to this chart in dot notation. // ChartPath returns the full path to this chart in dot notation.
func (ch *Chart) ChartPath() string { func (ch *Chart) ChartPath() string {
if !ch.IsRoot() { if !ch.IsRoot() {

@ -29,8 +29,6 @@ type Info struct {
Description string `json:"Description,omitempty"` Description string `json:"Description,omitempty"`
// Status is the current state of the release // Status is the current state of the release
Status Status `json:"status,omitempty"` Status Status `json:"status,omitempty"`
// Cluster resources as kubectl would print them.
Resources string `json:"resources,omitempty"`
// Contains the rendered templates/NOTES.txt if available // Contains the rendered templates/NOTES.txt if available
Notes string `json:"notes,omitempty"` Notes string `json:"notes,omitempty"`
} }

@ -15,16 +15,6 @@ limitations under the License.
package release package release
// GetReleaseStatusResponse is the response indicating the status of the named release.
type GetReleaseStatusResponse struct {
// Name is the name of the release.
Name string `json:"name,omitempty"`
// Info contains information about the release.
Info *Info `json:"info,omitempty"`
// Namespace the release was released into
Namespace string `json:"namespace,omitempty"`
}
// UninstallReleaseResponse represents a successful response to an uninstall request. // UninstallReleaseResponse represents a successful response to an uninstall request.
type UninstallReleaseResponse struct { type UninstallReleaseResponse struct {
// Release is the release that was marked deleted. // Release is the release that was marked deleted.

@ -93,16 +93,6 @@ func (rs *records) Replace(key string, rec *record) *record {
return nil return nil
} }
func (rs records) FindByVersion(vers int) (int, bool) {
i := sort.Search(len(rs), func(i int) bool {
return rs[i].rls.Version == vers
})
if i < len(rs) && rs[i].rls.Version == vers {
return i, true
}
return i, false
}
func (rs *records) removeAt(index int) *record { func (rs *records) removeAt(index int) *record {
r := (*rs)[index] r := (*rs)[index]
(*rs)[index] = nil (*rs)[index] = nil

@ -100,26 +100,6 @@ func (s *Storage) ListDeployed() ([]*rspb.Release, error) {
}) })
} }
// ListFilterAll returns the set of releases satisfying the predicate
// (filter0 && filter1 && ... && filterN), i.e. a Release is included in the results
// if and only if all filters return true.
func (s *Storage) ListFilterAll(fns ...relutil.FilterFunc) ([]*rspb.Release, error) {
s.Log("listing all releases with filter")
return s.Driver.List(func(rls *rspb.Release) bool {
return relutil.All(fns...).Check(rls)
})
}
// ListFilterAny returns the set of releases satisfying the predicate
// (filter0 || filter1 || ... || filterN), i.e. a Release is included in the results
// if at least one of the filters returns true.
func (s *Storage) ListFilterAny(fns ...relutil.FilterFunc) ([]*rspb.Release, error) {
s.Log("listing any releases with filter")
return s.Driver.List(func(rls *rspb.Release) bool {
return relutil.Any(fns...).Check(rls)
})
}
// Deployed returns the last deployed release with the provided release name, or // Deployed returns the last deployed release with the provided release name, or
// returns ErrReleaseNotFound if not found. // returns ErrReleaseNotFound if not found.
func (s *Storage) Deployed(name string) (*rspb.Release, error) { func (s *Storage) Deployed(name string) (*rspb.Release, error) {

Loading…
Cancel
Save