fix hostname with domain name and vis-a-vis
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
0ef6a9b47b
commit
96c44afee1
|
@ -107,7 +107,7 @@ func POSTbody(ge *pb.Event, URL string) string {
|
|||
log.Println("POSTbody() can't make new req")
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
token := ge.Account.Token
|
||||
if (token == "") {
|
||||
token = "POSTbodyEmptyToken"
|
||||
|
|
|
@ -2,6 +2,8 @@ package main
|
|||
|
||||
import "flag"
|
||||
import "log"
|
||||
import "fmt"
|
||||
import "regexp"
|
||||
import "net/http"
|
||||
import "encoding/json"
|
||||
import "io/ioutil"
|
||||
|
@ -142,7 +144,8 @@ func processGetEvent(ge *pb.Event) *pb.Event {
|
|||
evm.Cpus = 1
|
||||
evm.Memory = 512
|
||||
evm.Disk = 20
|
||||
evm.Hostname = vm.Name + "." + enetwork.Name
|
||||
// TODO: bmath -- let's change the stack-api to remove this hack
|
||||
evm.Hostname = vm.Name + "." + enetwork.Name + ".customers.wprod.wit.com"
|
||||
e.Vms = append(e.Vms, &evm)
|
||||
|
||||
log.Println("\tvm.Name =",vm.Name)
|
||||
|
@ -194,7 +197,16 @@ func processAddEvent(ge *pb.Event) *pb.Event {
|
|||
return e
|
||||
}
|
||||
|
||||
url := ge.Account.URL + "vms/" + ge.Account.Domain + "?count=1&cpu=2&ram=512&disk=25"
|
||||
a := regexp.MustCompile(`\.`) // split subdomain on .
|
||||
stuff := a.Split(ge.Account.Domain, -1)
|
||||
log.Printf("processAddEvent() stuff = %q\n", stuff)
|
||||
log.Println("processAddEvent() host =", stuff[0])
|
||||
log.Println("processAddEvent() memory =", ge.Vms[0].Memory)
|
||||
|
||||
memory := fmt.Sprintf("%d", ge.Vms[0].Memory)
|
||||
url := ge.Account.URL + "vms/" + stuff[0] + "?count=1&cpu=2&ram=" + memory + "&disk=25"
|
||||
log.Println("processAddEvent() new URL =", url)
|
||||
|
||||
newVM := string(POSTbody(ge, url))
|
||||
log.Println("processAddEvent() recieved newVM=", newVM)
|
||||
|
||||
|
|
Loading…
Reference in New Issue