Fix unknown management type error
When using "redfish-dell" as the management type, airshipctl throws an error due to a missing case statement. This change fixes the regression by re-adding "redfish-dell" as a remote type. Change-Id: I8314a1e356d1bb3bb1705762bbeda1adf1db41d2 Signed-off-by: Drew Walters <andrew.walters@att.com>
This commit is contained in:
parent
c33e0a20ad
commit
00f934af50
|
@ -21,7 +21,9 @@ import (
|
||||||
"opendev.org/airship/airshipctl/pkg/config"
|
"opendev.org/airship/airshipctl/pkg/config"
|
||||||
"opendev.org/airship/airshipctl/pkg/document"
|
"opendev.org/airship/airshipctl/pkg/document"
|
||||||
"opendev.org/airship/airshipctl/pkg/environment"
|
"opendev.org/airship/airshipctl/pkg/environment"
|
||||||
|
"opendev.org/airship/airshipctl/pkg/log"
|
||||||
"opendev.org/airship/airshipctl/pkg/remote/redfish"
|
"opendev.org/airship/airshipctl/pkg/remote/redfish"
|
||||||
|
redfishdell "opendev.org/airship/airshipctl/pkg/remote/redfish/vendors/dell"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client is a set of functions that clients created for out-of-band power management and control should implement. The
|
// Client is a set of functions that clients created for out-of-band power management and control should implement. The
|
||||||
|
@ -167,6 +169,7 @@ func newBaremetalHost(mgmtCfg config.ManagementConfiguration,
|
||||||
// Select the client that corresponds to the management type specified in the airshipctl config.
|
// Select the client that corresponds to the management type specified in the airshipctl config.
|
||||||
switch mgmtCfg.Type {
|
switch mgmtCfg.Type {
|
||||||
case redfish.ClientType:
|
case redfish.ClientType:
|
||||||
|
log.Debug("Remote type: Redfish")
|
||||||
ctx, client, err := redfish.NewClient(
|
ctx, client, err := redfish.NewClient(
|
||||||
address,
|
address,
|
||||||
mgmtCfg.Insecure,
|
mgmtCfg.Insecure,
|
||||||
|
@ -178,6 +181,20 @@ func newBaremetalHost(mgmtCfg config.ManagementConfiguration,
|
||||||
return host, err
|
return host, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
host = baremetalHost{client, ctx, address, hostDoc.GetName(), username, password}
|
||||||
|
case redfishdell.ClientType:
|
||||||
|
log.Debug("Remote type: Redfish for Integrated Dell Remote Access Controller (iDrac) systems")
|
||||||
|
ctx, client, err := redfishdell.NewClient(
|
||||||
|
address,
|
||||||
|
mgmtCfg.Insecure,
|
||||||
|
mgmtCfg.UseProxy,
|
||||||
|
username,
|
||||||
|
password)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return host, err
|
||||||
|
}
|
||||||
|
|
||||||
host = baremetalHost{client, ctx, address, hostDoc.GetName(), username, password}
|
host = baremetalHost{client, ctx, address, hostDoc.GetName(), username, password}
|
||||||
default:
|
default:
|
||||||
return host, ErrUnknownManagementType{Type: mgmtCfg.Type}
|
return host, ErrUnknownManagementType{Type: mgmtCfg.Type}
|
||||||
|
|
|
@ -24,6 +24,8 @@ import (
|
||||||
"opendev.org/airship/airshipctl/pkg/config"
|
"opendev.org/airship/airshipctl/pkg/config"
|
||||||
"opendev.org/airship/airshipctl/pkg/document"
|
"opendev.org/airship/airshipctl/pkg/document"
|
||||||
"opendev.org/airship/airshipctl/pkg/environment"
|
"opendev.org/airship/airshipctl/pkg/environment"
|
||||||
|
"opendev.org/airship/airshipctl/pkg/remote/redfish"
|
||||||
|
redfishdell "opendev.org/airship/airshipctl/pkg/remote/redfish/vendors/dell"
|
||||||
"opendev.org/airship/airshipctl/testutil"
|
"opendev.org/airship/airshipctl/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,6 +109,22 @@ func TestNewManagerByLabelNoHostsFound(t *testing.T) {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewManagerRedfish(t *testing.T) {
|
||||||
|
cfg := &config.ManagementConfiguration{Type: redfish.ClientType}
|
||||||
|
settings := initSettings(t, withManagementConfig(cfg), withTestDataPath("base"))
|
||||||
|
|
||||||
|
_, err := NewManager(settings, config.BootstrapPhase, ByLabel(document.EphemeralHostSelector))
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNewManagerRedfishDell(t *testing.T) {
|
||||||
|
cfg := &config.ManagementConfiguration{Type: redfishdell.ClientType}
|
||||||
|
settings := initSettings(t, withManagementConfig(cfg), withTestDataPath("base"))
|
||||||
|
|
||||||
|
_, err := NewManager(settings, config.BootstrapPhase, ByLabel(document.EphemeralHostSelector))
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
func TestNewManagerUnknownRemoteType(t *testing.T) {
|
func TestNewManagerUnknownRemoteType(t *testing.T) {
|
||||||
badCfg := &config.ManagementConfiguration{Type: "bad-remote-type"}
|
badCfg := &config.ManagementConfiguration{Type: "bad-remote-type"}
|
||||||
settings := initSettings(t, withManagementConfig(badCfg), withTestDataPath("base"))
|
settings := initSettings(t, withManagementConfig(badCfg), withTestDataPath("base"))
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (b baremetalHost) DoRemoteDirect(settings *environment.AirshipCTLSettings)
|
||||||
return config.ErrMissingConfig{What: "RemoteDirect options not defined in bootstrap config"}
|
return config.ErrMissingConfig{What: "RemoteDirect options not defined in bootstrap config"}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Using ephemeral node %s with BMCAddress %s", b.NodeID(), b.BMCAddress)
|
log.Debugf("Using ephemeral node %s with BMC Address %s", b.NodeID(), b.BMCAddress)
|
||||||
|
|
||||||
// Perform remote direct operations
|
// Perform remote direct operations
|
||||||
if remoteConfig.IsoURL == "" {
|
if remoteConfig.IsoURL == "" {
|
||||||
|
|
Loading…
Reference in New Issue