[Fixes #2439] Trim trailing slash (if present) in state store value

Signed-off-by: Jaipradeesh Janarthanan <jaipradeesh@gmail.com>
This commit is contained in:
Jaipradeesh Janarthanan 2017-05-08 12:57:21 +05:30
parent afd7332a7d
commit 40ace52c37
No known key found for this signature in database
GPG Key ID: E1603C10654FDC77
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import (
"fmt"
"io"
"os"
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
@ -95,6 +96,9 @@ func NewCmdRoot(f *util.Factory, out io.Writer) *cobra.Command {
cmd.PersistentFlags().StringVar(&rootCommand.configFile, "config", "", "config file (default is $HOME/.kops.yaml)")
defaultStateStore := os.Getenv("KOPS_STATE_STORE")
if strings.HasSuffix(defaultStateStore, "/") {
strings.TrimSuffix(defaultStateStore, "/")
}
cmd.PersistentFlags().StringVarP(&rootCommand.RegistryPath, "state", "", defaultStateStore, "Location of state storage")
cmd.PersistentFlags().StringVarP(&rootCommand.clusterName, "name", "", "", "Name of cluster")

View File

@ -49,7 +49,8 @@ A s3 bucket is required to store cluster state information.`
INVALID_STATE_ERROR = `Unable to read state store s3 bucket.
Please use a valid s3 bucket uri when setting --state or KOPS_STATE_STORE evn var.
A valid value follows the format s3://<bucket>.`
A valid value follows the format s3://<bucket>.
Trailing slash will be trimmed.`
)
func (f *Factory) Clientset() (simple.Clientset, error) {