improvements due to autogenpb

This commit is contained in:
Jeff Carr 2024-12-04 02:25:19 -06:00
parent 70cc9944ad
commit 4dd0f0eaba
4 changed files with 12 additions and 12 deletions

View File

@ -32,7 +32,7 @@ func dumpCluster(w http.ResponseWriter) {
func dumpDroplets(w http.ResponseWriter, full bool) {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
// this line in golang could replace 80 lines of COBOL
header := d.SprintDumpHeader() + " "

View File

@ -65,7 +65,7 @@ func main() {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
if d == nil {
fmt.Println("d == nil")
os.Exit(-1)

View File

@ -164,7 +164,7 @@ func uptimeCheck() (bool, string) {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
total += 1
if d.StartState != pb.DropletState_ON {
continue

View File

@ -30,7 +30,7 @@ import (
func ValidateUniqueMac(mac string) bool {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
for _, n := range d.Networks {
if n.Mac == mac {
log.Info("duplicate MAC", n.Mac, "in droplet", d.Hostname)
@ -68,7 +68,7 @@ func lookupFilename(filename string) *pb.Droplet {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
for _, disk := range d.Disks {
if filebase == disk.Filename {
return d
@ -85,7 +85,7 @@ func ValidateUniqueFilenames() bool {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
for _, disk := range d.Disks {
filename := disk.Filename
addClusterFilepath(disk.Filepath)
@ -115,7 +115,7 @@ func ValidateDiskFilenames() ([]*pb.Event, error) {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
var found bool = false
for _, disk := range d.Disks {
filename := disk.Filename
@ -170,7 +170,7 @@ func getNewMac() string {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
for _, n := range d.Networks {
// log.Println("network:", n.Mac, d.Uuid, d.Hostname)
if _, ok := macs[n.Mac]; ok {
@ -213,7 +213,7 @@ func ValidateDroplets() (map[string]string, map[string]string, error) {
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
// Generate a new UUID
if d.Uuid == "" {
u := uuid.New()
@ -283,7 +283,7 @@ func ValidateDroplet(check *pb.Droplet) error {
// check for duplicate uuid's
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
if check == d {
continue
}
@ -313,7 +313,7 @@ func ValidateDroplet(check *pb.Droplet) error {
}
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
if check == d {
continue
}
@ -342,7 +342,7 @@ func setUniqueSpicePort(check *pb.Droplet) error {
// checkn.SpicePort = getUniqueSpicePort()
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()
d := loop.Next()
if d.SpicePort == 0 {
continue
}