// Populate Redfish credentials for a TRS task.  These are fetched from
// Vault, unless Vault is disabled, in which case defaults are used.
Populate Redfish credentials for a TRS task.  These are fetched from
Vault, unless Vault is disabled, in which case defaults are used.
// Populate Redfish credentials for a TRS task . These are fetched from // Vault unless Vault is disabled in which case defaults are used .
func popRFCreds(task *trsapi.HttpTask) error {
	if task.Request == nil {
		return fmt.Errorf("Task request is NIL!")
	}
	if (appParams.VaultEnable == nil) || !(*appParams.VaultEnable) {
		logger.Tracef("popRFCreds(), Vault is disabled, no creds.")
		return nil
	}
	logger.Tracef("popRFCreds(), setting vault creds for '%s'-'%s'",
		task.Request.Host, task.Request.URL.Path)
	targ := targFromTask(task)
	creds, err := compCredStore.GetCompCred(targ)
	if err != nil {
		return fmt.Errorf("Can't get RF creds for '%s': %v", targ, err)
	}
	if strings.ToLower(creds.Xname) != strings.ToLower(targ) {
		logger.Infof("Creds for '%s' don't match XName: '%s'",
			targ, creds.Xname)
	}
	task.Request.SetBasicAuth(creds.Username, creds.Password)
	return nil
}
func popRFCreds ( task * trsapi . HttpTask ) error { if task . Request == nil { return fmt . Errorf ( " " ) } if ( appParams . VaultEnable == nil ) || ! ( * appParams . VaultEnable ) { logger . Tracef ( " " ) return nil } logger . Tracef ( " " , task . Request . Host , task . Request . URL . Path ) targ := targFromTask ( task ) creds , err := compCredStore . GetCompCred ( targ ) if err != nil { return fmt . Errorf ( " " , targ , err ) } if strings . ToLower ( creds . Xname ) != strings . ToLower ( targ ) { logger . Infof ( " " , targ , creds . Xname ) } task . Request . SetBasicAuth ( creds . Username , creds . Password ) return nil }
Populate Redfish credentials for a TRS task.
Populate Redfish credentials for a TRS task .