diff options
| author | Jeff Carr <[email protected]> | 2024-10-30 12:30:34 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-30 12:30:34 -0500 |
| commit | 2a18f506c7e37903e58b838e52b6b6554e7e039c (patch) | |
| tree | 074fca97694ef9fc76acc2218be874d625560e31 /create.go | |
| parent | 410015c33e7d905ee03fab29d24961aab9df093f (diff) | |
simple unique mac
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'create.go')
| -rw-r--r-- | create.go | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -38,19 +38,16 @@ func create(w http.ResponseWriter, r *http.Request) error { fmt.Fprintln(w, result) return errors.New(result) } + if d.Uuid == "" { u := uuid.New() d.Uuid = u.String() } - return nil + if len(d.Networks) == 0 { - mac, err := getNewMac() - if err != nil { - return err - } var newNet *pb.Network newNet = new(pb.Network) - newNet.Mac = mac + newNet.Mac = getNewMac() d.Networks = append(d.Networks, newNet) // d.AddDefaultNetwork(mac) } |
