Refactor CurrentContextEntryPoint function
Currently it takes ClusterType as first parameter, however this parameter can be retrieved via appropriate function CurrentContextClusterType in the same module. Change-Id: I205fd7d00bf1745cada88d8fd972dac1dbe0fddf
This commit is contained in:
parent
5dc4881d20
commit
af9e46dfec
@ -54,7 +54,7 @@ func GenerateBootstrapIso(settings *environment.AirshipCTLSettings) error {
|
||||
|
||||
// TODO (dukov) replace with the appropriate function once it's available
|
||||
// in document module
|
||||
root, err := globalConf.CurrentContextEntryPoint(config.Ephemeral, config.BootstrapPhase)
|
||||
root, err := globalConf.CurrentContextEntryPoint(config.BootstrapPhase)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func (infra *Infra) Deploy() error {
|
||||
return err
|
||||
}
|
||||
|
||||
kustomizePath, err := globalConf.CurrentContextEntryPoint(infra.ClusterType, config.InitinfraPhase)
|
||||
kustomizePath, err := globalConf.CurrentContextEntryPoint(config.InitinfraPhase)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -650,8 +650,13 @@ func (c *Config) CurrentContextManifest() (*Manifest, error) {
|
||||
|
||||
// CurrentContextEntryPoint returns path to build bundle based on clusterType and phase
|
||||
// example CurrentContextEntryPoint("ephemeral", "initinfra")
|
||||
func (c *Config) CurrentContextEntryPoint(clusterType string, phase string) (string, error) {
|
||||
err := ValidClusterType(clusterType)
|
||||
func (c *Config) CurrentContextEntryPoint(phase string) (string, error) {
|
||||
clusterType, err := c.CurrentContextClusterType()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
err = ValidClusterType(clusterType)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -491,9 +491,8 @@ func TestCurrentContextEntryPoint(t *testing.T) {
|
||||
defer cleanup(t)
|
||||
|
||||
clusterName := "def"
|
||||
clusterType := "ephemeral"
|
||||
|
||||
entryPoint, err := conf.CurrentContextEntryPoint(clusterType, defaultString)
|
||||
entryPoint, err := conf.CurrentContextEntryPoint(defaultString)
|
||||
require.Error(t, err)
|
||||
assert.Equal(t, "", entryPoint)
|
||||
|
||||
@ -501,7 +500,7 @@ func TestCurrentContextEntryPoint(t *testing.T) {
|
||||
conf.Contexts[currentContextName].Manifest = defaultString
|
||||
conf.Contexts[currentContextName].KubeContext().Cluster = clusterName
|
||||
|
||||
entryPoint, err = conf.CurrentContextEntryPoint(clusterType, defaultString)
|
||||
entryPoint, err = conf.CurrentContextEntryPoint(defaultString)
|
||||
require.NoError(t, err)
|
||||
assert.Nil(t, nil, entryPoint)
|
||||
}
|
||||
|
@ -114,18 +114,12 @@ func ByName(name string) HostSelector {
|
||||
// NewManager provides a manager that exposes the capability to perform remote direct functionality and other
|
||||
// out-of-band management on multiple hosts.
|
||||
func NewManager(settings *environment.AirshipCTLSettings, phase string, hosts ...HostSelector) (*Manager, error) {
|
||||
configContext, err := settings.Config.GetCurrentContext()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
managementCfg, err := settings.Config.CurrentContextManagementConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clusterType := configContext.ClusterType()
|
||||
entrypoint, err := settings.Config.CurrentContextEntryPoint(clusterType, phase)
|
||||
entrypoint, err := settings.Config.CurrentContextEntryPoint(phase)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user