From 4c70a54b578abf22e597a91d75e9374ebbf2c649 Mon Sep 17 00:00:00 2001 From: JoshVanL Date: Mon, 9 Jul 2018 15:22:11 +0100 Subject: [PATCH] Implement force for kubectl command --- pkg/tarmak/kubectl/kubectl.go | 6 ++++-- pkg/tarmak/tarmak.go | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/tarmak/kubectl/kubectl.go b/pkg/tarmak/kubectl/kubectl.go index 9c0a920fd1..53bcd94c90 100644 --- a/pkg/tarmak/kubectl/kubectl.go +++ b/pkg/tarmak/kubectl/kubectl.go @@ -49,8 +49,10 @@ func (k *Kubectl) requestNewAdminCert(cluster *api.Cluster, authInfo *api.AuthIn k.log.Infof("request new certificate from vault (%s)", path) - if err := k.tarmak.Cluster().Environment().Validate(); err != nil { - k.log.Fatal("could not validate config: ", err) + if !k.tarmak.Config().Force() { + if err := k.tarmak.Cluster().Environment().Validate(); err != nil { + k.log.Fatal("could not validate config: ", err) + } } vault := k.tarmak.Environment().Vault() diff --git a/pkg/tarmak/tarmak.go b/pkg/tarmak/tarmak.go index da308d02ba..226a2a35df 100644 --- a/pkg/tarmak/tarmak.go +++ b/pkg/tarmak/tarmak.go @@ -281,10 +281,9 @@ func (t *Tarmak) Version() string { } func (t *Tarmak) Validate() error { - var err error - var result error + var result *multierror.Error - err = t.Cluster().Validate() + err := t.Cluster().Validate() if err != nil { result = multierror.Append(result, err) } @@ -294,7 +293,7 @@ func (t *Tarmak) Validate() error { result = multierror.Append(result, err) } - return result + return result.ErrorOrNil() } func (t *Tarmak) Cleanup() {