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() { func main() {
initKubeLogs() 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) debug("%+v", err)
switch e := err.(type) { switch e := err.(type) {
case pluginError: case pluginError:
@ -76,8 +77,6 @@ func main() {
} }
} }
cmd := newRootCmd(actionConfig, os.Stdout, os.Args[1:])
if err := cmd.Execute(); err != nil { if err := cmd.Execute(); err != nil {
debug("%+v", err) debug("%+v", err)
os.Exit(1) os.Exit(1)

@ -70,7 +70,9 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
Args: require.NoArgs, Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if client.AllNamespaces { 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() client.SetStateMask()

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

Loading…
Cancel
Save