// dbFindConsolePodForNode will find the node console assigned to the given node.
// Any error(s) will be returned.
dbFindConsolePodForNode will find the node console assigned to the given node.
Any error(s) will be returned.
// dbFindConsolePodForNode will find the node console assigned to the given node . // Any error ( s ) will be returned .
func dbFindConsolePodForNode(nci *NodeConsoleInfo) (err error) {
	sqlStmt := `
        select console_pod_id from ownership where node_name=$1
    `
	if nci == nil || nci.NodeName == "" {
		return errors.New("Nil or empty NodeName.")
	}
	var s sql.NullString
	row := DB.QueryRow(sqlStmt, nci.NodeName)
	err = row.Scan(&s)
	switch err {
	case sql.ErrNoRows:
		nci.NodeConsoleName = ""
		log.Printf("Unable to find node %s", nci.NodeName)
		return nil
	case nil:
		if s.Valid {
			nci.NodeConsoleName = s.String
			log.Printf("Found console_pod_id %s for node %s",
				nci.NodeConsoleName, nci.NodeName)
		} else {
			nci.NodeConsoleName = ""
		}
		return nil
	default:
		nci.NodeConsoleName = ""
		log.Printf("dbFindConsolePodForNode had an error: %s", err)
		return err
	}
	return nil
}
func dbFindConsolePodForNode ( nci * NodeConsoleInfo ) ( err error ) { sqlStmt := `
        select console_pod_id from ownership where node_name=$1
    ` if nci == nil || nci . NodeName == " " { return errors . New ( " " ) } var s sql . NullString row := DB . QueryRow ( sqlStmt , nci . NodeName ) err = row . Scan ( & s ) switch err { case sql . ErrNoRows : nci . NodeConsoleName = " " log . Printf ( " " , nci . NodeName ) return nil case nil : if s . Valid { nci . NodeConsoleName = s . String log . Printf ( " " , nci . NodeConsoleName , nci . NodeName ) } else { nci . NodeConsoleName = " " } return nil default : nci . NodeConsoleName = " " log . Printf ( " " , err ) return err } return nil }
dbFindConsolePodForNode will find the node console assigned to the given node.
dbFindConsolePodForNode will find the node console assigned to the given node .
// Look for the node and if found set *nci.NodeConsoleName = console_pod_id // Return any error found. // We did not find the node. // Signal that we did not find a console pod. // We found the console pod.  Set it here. // This is a NULL value. // Signal that we did not find a console pod. // Signal that we did not find a console pod. // Return the error.