summaryrefslogtreecommitdiff
path: root/send.go
diff options
context:
space:
mode:
Diffstat (limited to 'send.go')
-rw-r--r--send.go37
1 files changed, 35 insertions, 2 deletions
diff --git a/send.go b/send.go
index c861c4e..cf75f5a 100644
--- a/send.go
+++ b/send.go
@@ -15,7 +15,7 @@ func send() {
func pingStatus() error {
var url string
- url = urlbase + "/status?hostname=stuff"
+ url = urlbase + "/status?hostname=" + me.hostname
msg, err := me.packages.Marshal()
if err != nil {
log.Info("proto.Marshal() failed:", err)
@@ -31,7 +31,40 @@ func pingStatus() error {
test := strings.TrimSpace(string(body))
// log.Info("virtigo returned body:", test)
for _, line := range strings.Split(test, "\n") {
- log.Info("GOT:", line)
+ switch line {
+ case "upgrade":
+ log.Info("should upgrade now")
+ default:
+ log.Info("GOT:", line)
+ }
+ }
+ return nil
+}
+
+func sendMachine() error {
+ var url string
+ url = urlbase + "/machine"
+ msg, err := me.machine.Marshal()
+ if err != nil {
+ log.Info("proto.Marshal() failed:", err)
+ return err
+ }
+ log.Info("proto Marshal len =", len(msg))
+ body, err := httpPost(url, msg)
+ if err != nil {
+ log.Info("httpPost() failed:", err)
+ return err
+ }
+
+ test := strings.TrimSpace(string(body))
+ // log.Info("virtigo returned body:", test)
+ for _, line := range strings.Split(test, "\n") {
+ switch line {
+ case "upgrade":
+ log.Info("machine upgrade now")
+ default:
+ log.Info("GOT:", line)
+ }
}
return nil
}