used this to fix autogenpb 'http' functions
This commit is contained in:
parent
1c479b61f6
commit
d656828a0f
16
http.go
16
http.go
|
@ -37,10 +37,10 @@ func (m *Machine) HttpPostMachine(url string) ([]byte, error) {
|
|||
log.Info("WTF. check == nil")
|
||||
}
|
||||
// log.Info("good? check.hostname =", m.Hostname)
|
||||
return m.HttpPost(url, msg)
|
||||
return m.HttpPostOld(url, msg)
|
||||
}
|
||||
|
||||
func (m *Machine) HttpPost(url string, data []byte) ([]byte, error) {
|
||||
func (m *Machine) HttpPostOld(url string, data []byte) ([]byte, error) {
|
||||
var err error
|
||||
var req *http.Request
|
||||
|
||||
|
@ -49,13 +49,11 @@ func (m *Machine) HttpPost(url string, data []byte) ([]byte, error) {
|
|||
|
||||
usr, _ := user.Current()
|
||||
req.Header.Set("author", usr.Username)
|
||||
/*
|
||||
if f.Machine == nil {
|
||||
// run f.InitMachine() here?
|
||||
log.Info("you must run f.InitMachine()")
|
||||
return nil, fmt.Errorf("you must run f.InitMachine()")
|
||||
}
|
||||
*/
|
||||
// if f.Machine == nil {
|
||||
// // run f.InitMachine() here?
|
||||
// log.Info("you must run f.InitMachine()")
|
||||
// return nil, fmt.Errorf("you must run f.InitMachine()")
|
||||
// }
|
||||
req.Header.Set("hostname", m.Hostname)
|
||||
|
||||
client := &http.Client{}
|
||||
|
|
|
@ -7,7 +7,7 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time
|
|||
|
||||
// global settings for autogenpb `autogenpb:mutex`
|
||||
|
||||
message Machine { // `autogenpb:marshal`
|
||||
message Machine { // `autogenpb:marshal` `autogenpb:http`
|
||||
string hostname = 1; // `autogenpb:unique` `autogenpb:sort`
|
||||
int64 memory = 2;
|
||||
int64 cpus = 3;
|
||||
|
@ -23,7 +23,7 @@ message Machine { // `autogenpb:marshal`
|
|||
string upgradeCmd = 13; // upgrade cmd
|
||||
}
|
||||
|
||||
message Machines { // `autogenpb:marshal` `autogenpb:gui`
|
||||
message Machines { // `autogenpb:marshal` `autogenpb:gui` `autogenpb:http`
|
||||
string uuid = 1; // `autogenpb:uuid:b57e7fac-a8fc-4949-9d50-fa38312dec87`
|
||||
string version = 2; // `autogenpb:version:v0.0.1`
|
||||
repeated Machine machines = 3;
|
||||
|
|
Loading…
Reference in New Issue