more work on importing
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
0a28c45a6c
commit
173520b42e
|
@ -3,19 +3,16 @@ package main
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
pb "go.wit.com/lib/protobuf/virtbuf"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// attempts to create a new virtual machine
|
||||
|
||||
func create(w http.ResponseWriter, r *http.Request) (string, error) {
|
||||
/*
|
||||
func oldcreate(w http.ResponseWriter, r *http.Request) (string, error) {
|
||||
msg, err := ioutil.ReadAll(r.Body) // Read the body as []byte
|
||||
if err != nil {
|
||||
result := fmt.Sprintf("ReadAll() error =", err)
|
||||
|
@ -84,6 +81,7 @@ func create(w http.ResponseWriter, r *http.Request) (string, error) {
|
|||
fmt.Fprintln(w, "START=OK")
|
||||
return result, nil
|
||||
}
|
||||
*/
|
||||
|
||||
// for now, because sometimes this should write to stdout and
|
||||
// sometimes to http socket, it returns a string
|
||||
|
|
|
@ -98,10 +98,21 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
|
|||
me.cluster.AddEvent(e)
|
||||
}
|
||||
|
||||
log.Warn("Everything worked")
|
||||
result := fmt.Sprintln("importDomain() worked")
|
||||
|
||||
// remote LocalOnly flag
|
||||
d.LocalOnly = ""
|
||||
|
||||
// probably be safe and don't let this move around the cluster
|
||||
d.PreferredHypervisor = d.Current.Hypervisor
|
||||
|
||||
log.Log(WARN, result)
|
||||
fmt.Fprintln(w, result)
|
||||
log.Warn("Everything worked. Saving config files")
|
||||
if err := me.cluster.ConfigSave(); err != nil {
|
||||
log.Warn("configsave error", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
|
|
3
main.go
3
main.go
|
@ -126,9 +126,6 @@ func main() {
|
|||
log.Info(i, "Event:", e.Droplet, e.FieldName, "orig:", e.OrigVal, "new:", e.NewVal)
|
||||
me.changed = true
|
||||
}
|
||||
// if err := me.cluster.ConfigSave(); err != nil {
|
||||
// log.Info("configsave error", err)
|
||||
// }
|
||||
|
||||
if me.changed {
|
||||
if err := me.cluster.ConfigSave(); err != nil {
|
||||
|
|
|
@ -157,7 +157,7 @@ func ValidateDiskFilenames() ([]*pb.Event, error) {
|
|||
}
|
||||
if !found {
|
||||
log.Info("droplet", d.Hostname, d.Disks)
|
||||
return nil, errors.New("droplet " + d.Hostname + " has nonstandard disk names")
|
||||
log.Warn("droplet " + d.Hostname + " has nonstandard disk names")
|
||||
}
|
||||
}
|
||||
return alle, nil
|
||||
|
|
Loading…
Reference in New Issue