Applied check to actions

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
pull/6255/head
Vibhav Bobade 5 years ago
parent 5a07055645
commit d00e328020

@ -38,5 +38,9 @@ func NewGet(cfg *Configuration) *Get {
// Run executes 'helm get' against the given release.
func (g *Get) Run(name string) (*release.Release, error) {
if err := g.cfg.KubeClient.IsReachable(); err != nil {
return nil, err
}
return g.cfg.releaseContent(name, g.Version)
}

@ -41,6 +41,10 @@ func NewHistory(cfg *Configuration) *History {
// Run executes 'helm history' against the given release.
func (h *History) Run(name string) ([]*release.Release, error) {
if err := h.cfg.KubeClient.IsReachable(); err != nil {
return nil, err
}
if err := validateReleaseName(name); err != nil {
return nil, errors.Errorf("release name is invalid: %s", name)
}

@ -107,6 +107,10 @@ func NewInstall(cfg *Configuration) *Install {
//
// If DryRun is set to true, this will prepare the release, but not install it
func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.Release, error) {
if err := i.cfg.KubeClient.IsReachable(); err != nil {
return nil, err
}
if err := i.availableName(); err != nil {
return nil, err
}

@ -140,6 +140,10 @@ func NewList(cfg *Configuration) *List {
// Run executes the list command, returning a set of matches.
func (l *List) Run() ([]*release.Release, error) {
if err := l.cfg.KubeClient.IsReachable(); err != nil {
return nil, err
}
var filter *regexp.Regexp
if l.Filter != "" {
var err error

@ -50,6 +50,10 @@ func NewRollback(cfg *Configuration) *Rollback {
// Run executes 'helm rollback' against the given release.
func (r *Rollback) Run(name string) error {
if err := r.cfg.KubeClient.IsReachable(); err != nil {
return err
}
r.cfg.Log("preparing rollback of %s", name)
currentRelease, targetRelease, err := r.prepareRollback(name)
if err != nil {

@ -39,5 +39,9 @@ func NewStatus(cfg *Configuration) *Status {
// Run executes 'helm status' against the given release.
func (s *Status) Run(name string) (*release.Release, error) {
if err := s.cfg.KubeClient.IsReachable(); err != nil {
return nil, err
}
return s.cfg.releaseContent(name, s.Version)
}

@ -47,6 +47,10 @@ func NewUninstall(cfg *Configuration) *Uninstall {
// Run uninstalls the given release.
func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error) {
if err := u.cfg.KubeClient.IsReachable(); err != nil {
return nil, err
}
if u.DryRun {
// In the dry run case, just see if the release exists
r, err := u.cfg.releaseContent(name, 0)

Loading…
Cancel
Save