summaryrefslogtreecommitdiff
path: root/validate.go
diff options
context:
space:
mode:
Diffstat (limited to 'validate.go')
-rw-r--r--validate.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/validate.go b/validate.go
index b6572f5..6ea8aba 100644
--- a/validate.go
+++ b/validate.go
@@ -198,8 +198,10 @@ func getNewMac() string {
return ""
}
+// consistancy check. run on a regular basis
+//
// runs on startup. dies if there are duplicates
-// the config file must then be edited by hand
+// the config file must then be edited by hand for now
func ValidateDroplets() (map[string]string, map[string]string, error) {
// uuid map to check for duplicates
var umap map[string]string
@@ -301,6 +303,14 @@ func ValidateDroplet(check *pb.Droplet) error {
// check for duplicate mac addresses
for _, checkn := range check.Networks {
+ log.Info("found mac = ", checkn.Mac, check.Hostname)
+ if checkn.Mac == "" {
+ checkn.Mac = getNewMac()
+ if err := me.cluster.ConfigSave(); err != nil {
+ log.Info("configsave error", err)
+ os.Exit(-1)
+ }
+ }
loop := me.cluster.DropletsAll() // get the list of droplets
for loop.Scan() {
d := loop.Droplet()