[#58] Update func names and params for golint

This patch addresses golint errors such as:
pkg/config/config.go:994:21: don't use leading k in Go names; func
parameter kCluster should be cluster
pkg/config/config.go:1003:21: don't use leading k in Go names; func
parameter kContext should be context
pkg/config/config.go:1012:22: don't use leading k in Go names; func
parameter kAuthInfo should be authInfo
pkg/remote/redfish/utils.go:49:6: func GetVirtualMediaId should be
GetVirtualMediaID
pkg/remote/redfish/utils.go:51:2: func parameter managerId should be
managerID
pkg/remote/redfish/utils.go:64:2: func parameter systemId should be
systemID
pkg/remote/redfish/utils.go:87:67: func parameter systemId should be
systemID
pkg/remote/redfish/utils.go:108:2: func parameter managerId should be
managerID
pkg/remote/redfish/utils.go:109:2: func parameter vMediaId should be
vMediaID

Relates-To: #58

Change-Id: I231becdb19fa962e888df46ef1a6b66e64d32e72
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
This commit is contained in:
Alexander Hughes 2020-02-28 09:57:22 -05:00
parent dd1dba6eb3
commit 27825bdf2c
3 changed files with 20 additions and 20 deletions

View File

@ -991,8 +991,8 @@ PLACEHOLDER UNTIL I IDENTIFY if CLIENTADM
HAS SOMETHING LIKE THIS
*/
func KClusterString(kCluster *clientcmdapi.Cluster) string {
yamlData, err := yaml.Marshal(&kCluster)
func KClusterString(cluster *clientcmdapi.Cluster) string {
yamlData, err := yaml.Marshal(&cluster)
if err != nil {
return ""
}
@ -1000,8 +1000,8 @@ func KClusterString(kCluster *clientcmdapi.Cluster) string {
return string(yamlData)
}
func KContextString(kContext *clientcmdapi.Context) string {
yamlData, err := yaml.Marshal(&kContext)
func KContextString(context *clientcmdapi.Context) string {
yamlData, err := yaml.Marshal(&context)
if err != nil {
return ""
}
@ -1009,8 +1009,8 @@ func KContextString(kContext *clientcmdapi.Context) string {
return string(yamlData)
}
func KAuthInfoString(kAuthInfo *clientcmdapi.AuthInfo) string {
yamlData, err := yaml.Marshal(&kAuthInfo)
func KAuthInfoString(authInfo *clientcmdapi.AuthInfo) string {
yamlData, err := yaml.Marshal(&authInfo)
if err != nil {
return ""
}

View File

@ -48,7 +48,7 @@ func (cfg RedfishRemoteDirect) DoRemoteDirect() error {
alog.Debugf("Ephemeral node managerID: '%s'", managerID)
/* Get manager's Cd or DVD virtual media ID */
vMediaID, vMediaType, err := GetVirtualMediaId(cfg.Context, cfg.Api, managerID)
vMediaID, vMediaType, err := GetVirtualMediaID(cfg.Context, cfg.Api, managerID)
if err != nil {
return err
}

View File

@ -46,9 +46,9 @@ func IsIDInList(idRefList []redfishClient.IdRef, id string) bool {
// This function walks through the list of manager's virtual media resources
// and gets the ID of virtualmedia which has type "CD" or "DVD"
func GetVirtualMediaId(ctx context.Context,
func GetVirtualMediaID(ctx context.Context,
api redfishApi.RedfishAPI,
managerId string,
managerID string,
) (string, string, error) {
// TODO: Sushy emulator has a bug which sends 'virtualMedia.inserted' field as
// string instead of a boolean which causes the redfish client to fail
@ -61,12 +61,12 @@ func GetVirtualMediaId(ctx context.Context,
// which is compatible with the given media type.
func SetSystemBootSourceForMediaType(ctx context.Context,
api redfishApi.RedfishAPI,
systemId string,
systemID string,
mediaType string) error {
/* Check available boot sources for system */
system, _, err := api.GetSystem(ctx, systemId)
system, _, err := api.GetSystem(ctx, systemID)
if err != nil {
return NewRedfishClientErrorf("Get System[%s] failed with err: %s", systemId, err.Error())
return NewRedfishClientErrorf("Get System[%s] failed with err: %s", systemID, err.Error())
}
allowableValues := system.Boot.BootSourceOverrideTargetRedfishAllowableValues
@ -75,19 +75,19 @@ func SetSystemBootSourceForMediaType(ctx context.Context,
/* set boot source */
systemReq := redfishClient.ComputerSystem{}
systemReq.Boot.BootSourceOverrideTarget = bootSource
_, httpResp, err := api.SetSystem(ctx, systemId, systemReq)
_, httpResp, err := api.SetSystem(ctx, systemID, systemReq)
return ScreenRedfishError(httpResp, err)
}
}
return NewRedfishClientErrorf("failed to set system[%s] boot source", systemId)
return NewRedfishClientErrorf("failed to set system[%s] boot source", systemID)
}
// Reboots a system by force shutoff and turning on.
func RebootSystem(ctx context.Context, api redfishApi.RedfishAPI, systemId string) error {
func RebootSystem(ctx context.Context, api redfishApi.RedfishAPI, systemID string) error {
resetReq := redfishClient.ResetRequestBody{}
resetReq.ResetType = redfishClient.RESETTYPE_FORCE_OFF
_, httpResp, err := api.ResetSystem(ctx, systemId, resetReq)
_, httpResp, err := api.ResetSystem(ctx, systemID, resetReq)
if err = ScreenRedfishError(httpResp, err); err != nil {
return err
}
@ -95,7 +95,7 @@ func RebootSystem(ctx context.Context, api redfishApi.RedfishAPI, systemId strin
time.Sleep(SystemRebootDelay)
resetReq.ResetType = redfishClient.RESETTYPE_ON
_, httpResp, err = api.ResetSystem(ctx, systemId, resetReq)
_, httpResp, err = api.ResetSystem(ctx, systemID, resetReq)
return ScreenRedfishError(httpResp, err)
}
@ -105,12 +105,12 @@ func RebootSystem(ctx context.Context, api redfishApi.RedfishAPI, systemId strin
// virtualMedia device is either of type CD or DVD.
func SetVirtualMedia(ctx context.Context,
api redfishApi.RedfishAPI,
managerId string,
vMediaId string,
managerID string,
vMediaID string,
isoPath string) error {
vMediaReq := redfishClient.InsertMediaRequestBody{}
vMediaReq.Image = isoPath
vMediaReq.Inserted = true
_, httpResp, err := api.InsertVirtualMedia(ctx, managerId, vMediaId, vMediaReq)
_, httpResp, err := api.InsertVirtualMedia(ctx, managerID, vMediaID, vMediaReq)
return ScreenRedfishError(httpResp, err)
}