Merge pull request #6653 from thomastaylor312/fix/action_config

fix(action): Fixes ordering of variable binding
pull/6657/head
Taylor Thomas 5 years ago committed by GitHub
commit 34b930cb9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,9 +64,10 @@ func initKubeLogs() {
func main() {
initKubeLogs()
actionConfig, err := action.InitActionConfig(settings, false, os.Getenv("HELM_DRIVER"), debug)
actionConfig := new(action.Configuration)
cmd := newRootCmd(actionConfig, os.Stdout, os.Args[1:])
if err != nil {
if err := actionConfig.Init(settings, false, os.Getenv("HELM_DRIVER"), debug); err != nil {
debug("%+v", err)
switch e := err.(type) {
case pluginError:
@ -76,8 +77,6 @@ func main() {
}
}
cmd := newRootCmd(actionConfig, os.Stdout, os.Args[1:])
if err := cmd.Execute(); err != nil {
debug("%+v", err)
os.Exit(1)

@ -70,7 +70,9 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
if client.AllNamespaces {
action.InitActionConfig(settings, true, os.Getenv("HELM_DRIVER"), debug)
if err := cfg.Init(settings, true, os.Getenv("HELM_DRIVER"), debug); err != nil {
return err
}
}
client.SetStateMask()

@ -210,9 +210,7 @@ func (c *Configuration) recordRelease(r *release.Release) {
}
// InitActionConfig initializes the action configuration
func InitActionConfig(envSettings *cli.EnvSettings, allNamespaces bool, helmDriver string, log DebugLog) (*Configuration, error) {
var actionConfig Configuration
func (c *Configuration) Init(envSettings *cli.EnvSettings, allNamespaces bool, helmDriver string, log DebugLog) error {
kubeconfig := envSettings.KubeConfig()
kc := kube.New(kubeconfig)
@ -220,7 +218,7 @@ func InitActionConfig(envSettings *cli.EnvSettings, allNamespaces bool, helmDriv
clientset, err := kc.Factory.KubernetesClientSet()
if err != nil {
return nil, err
return err
}
var namespace string
if !allNamespaces {
@ -245,10 +243,10 @@ func InitActionConfig(envSettings *cli.EnvSettings, allNamespaces bool, helmDriv
panic("Unknown driver in HELM_DRIVER: " + helmDriver)
}
actionConfig.RESTClientGetter = kubeconfig
actionConfig.KubeClient = kc
actionConfig.Releases = store
actionConfig.Log = log
c.RESTClientGetter = kubeconfig
c.KubeClient = kc
c.Releases = store
c.Log = log
return &actionConfig, nil
return nil
}

Loading…
Cancel
Save