mirror of
https://github.com/docker/compose.git
synced 2025-07-23 21:54:40 +02:00
Init helm action by default with no logger, don’t require callers to initialise it.
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
parent
7d0be7ad5a
commit
e3f1bc99d3
@ -36,6 +36,8 @@ type Actions struct {
|
|||||||
initialize func(f func(format string, v ...interface{})) error
|
initialize func(f func(format string, v ...interface{})) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const helmDriver = "configmap"
|
||||||
|
|
||||||
// NewActions new helm action
|
// NewActions new helm action
|
||||||
func NewActions(getter genericclioptions.RESTClientGetter) (*Actions, error) {
|
func NewActions(getter genericclioptions.RESTClientGetter) (*Actions, error) {
|
||||||
if getter == nil {
|
if getter == nil {
|
||||||
@ -55,12 +57,16 @@ func NewActions(getter genericclioptions.RESTClientGetter) (*Actions, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions.initialize = func(f func(format string, v ...interface{})) error {
|
actions.initialize = func(f func(format string, v ...interface{})) error {
|
||||||
err := actions.Config.Init(getter, namespace, "configmap", f)
|
err := actions.Config.Init(getter, namespace, helmDriver, f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return actions.Config.KubeClient.IsReachable()
|
return actions.Config.KubeClient.IsReachable()
|
||||||
}
|
}
|
||||||
|
err := actions.initialize(nil) // by default no logger, users might re-initialize with another logger function
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return actions, nil
|
return actions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,10 +111,6 @@ func (hc *Actions) Get(name string) (*release.Release, error) {
|
|||||||
|
|
||||||
// ListReleases lists chart releases
|
// ListReleases lists chart releases
|
||||||
func (hc *Actions) ListReleases() ([]compose.Stack, error) {
|
func (hc *Actions) ListReleases() ([]compose.Stack, error) {
|
||||||
err := hc.initialize(nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
actList := action.NewList(hc.Config)
|
actList := action.NewList(hc.Config)
|
||||||
releases, err := actList.Run()
|
releases, err := actList.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user