Merge "Changed the return statements to go idiomatic way"
This commit is contained in:
commit
6c7a6b0dfd
@ -183,16 +183,14 @@ func NewManager(cfg *config.Config, phaseName string, hosts ...HostSelector) (*M
|
|||||||
func newBaremetalHost(mgmtCfg config.ManagementConfiguration,
|
func newBaremetalHost(mgmtCfg config.ManagementConfiguration,
|
||||||
hostDoc document.Document,
|
hostDoc document.Document,
|
||||||
docBundle document.Bundle) (baremetalHost, error) {
|
docBundle document.Bundle) (baremetalHost, error) {
|
||||||
var host baremetalHost
|
|
||||||
|
|
||||||
address, err := document.GetBMHBMCAddress(hostDoc)
|
address, err := document.GetBMHBMCAddress(hostDoc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return host, err
|
return baremetalHost{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
username, password, err := document.GetBMHBMCCredentials(hostDoc, docBundle)
|
username, password, err := document.GetBMHBMCCredentials(hostDoc, docBundle)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return host, err
|
return baremetalHost{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var clientFactory remoteifc.ClientFactory
|
var clientFactory remoteifc.ClientFactory
|
||||||
@ -204,7 +202,7 @@ func newBaremetalHost(mgmtCfg config.ManagementConfiguration,
|
|||||||
case redfishdell.ClientType:
|
case redfishdell.ClientType:
|
||||||
clientFactory = redfishdell.ClientFactory
|
clientFactory = redfishdell.ClientFactory
|
||||||
default:
|
default:
|
||||||
return host, ErrUnknownManagementType{Type: mgmtCfg.Type}
|
return baremetalHost{}, ErrUnknownManagementType{Type: mgmtCfg.Type}
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := clientFactory(
|
client, err := clientFactory(
|
||||||
@ -216,11 +214,10 @@ func newBaremetalHost(mgmtCfg config.ManagementConfiguration,
|
|||||||
mgmtCfg.SystemRebootDelay)
|
mgmtCfg.SystemRebootDelay)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return host, err
|
return baremetalHost{}, err
|
||||||
}
|
}
|
||||||
host = baremetalHost{client, address, hostDoc.GetName(), username, password}
|
|
||||||
|
|
||||||
return host, nil
|
return baremetalHost{client, address, hostDoc.GetName(), username, password}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconcileHosts produces the intersection of two baremetal host arrays.
|
// reconcileHosts produces the intersection of two baremetal host arrays.
|
||||||
|
Loading…
Reference in New Issue
Block a user