mirror of https://github.com/kubernetes/kops.git
[Fixes #2439] Trim trailing slash (if present) in state store value
Signed-off-by: Jaipradeesh Janarthanan <jaipradeesh@gmail.com>
This commit is contained in:
parent
afd7332a7d
commit
40ace52c37
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/spf13/cobra"
|
"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)")
|
cmd.PersistentFlags().StringVar(&rootCommand.configFile, "config", "", "config file (default is $HOME/.kops.yaml)")
|
||||||
|
|
||||||
defaultStateStore := os.Getenv("KOPS_STATE_STORE")
|
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.RegistryPath, "state", "", defaultStateStore, "Location of state storage")
|
||||||
|
|
||||||
cmd.PersistentFlags().StringVarP(&rootCommand.clusterName, "name", "", "", "Name of cluster")
|
cmd.PersistentFlags().StringVarP(&rootCommand.clusterName, "name", "", "", "Name of cluster")
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ A s3 bucket is required to store cluster state information.`
|
||||||
|
|
||||||
INVALID_STATE_ERROR = `Unable to read state store s3 bucket.
|
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.
|
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) {
|
func (f *Factory) Clientset() (simple.Clientset, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue