remove zoopb from forge
This commit is contained in:
parent
a170250cb4
commit
f540aab434
8
http.go
8
http.go
|
@ -4,15 +4,14 @@ package forgepb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/zoopb"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
func (f *Forge) HttpPostMachine(url string) ([]byte, error) {
|
func (f *Forge) HttpPostMachine(url string) ([]byte, error) {
|
||||||
if f.Machine == nil {
|
if f.Machine == nil {
|
||||||
// run f.InitMachine() here?
|
// run f.InitMachine() here?
|
||||||
|
@ -40,6 +39,7 @@ func (f *Forge) HttpPostMachine(url string) ([]byte, error) {
|
||||||
log.Info("good? check.hostname =", check.Hostname)
|
log.Info("good? check.hostname =", check.Hostname)
|
||||||
return f.HttpPost(url, msg)
|
return f.HttpPost(url, msg)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) {
|
func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) {
|
||||||
var err error
|
var err error
|
||||||
|
@ -50,12 +50,14 @@ func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) {
|
||||||
|
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
req.Header.Set("author", usr.Username)
|
req.Header.Set("author", usr.Username)
|
||||||
|
/*
|
||||||
if f.Machine == nil {
|
if f.Machine == nil {
|
||||||
// run f.InitMachine() here?
|
// run f.InitMachine() here?
|
||||||
log.Info("you must run f.InitMachine()")
|
log.Info("you must run f.InitMachine()")
|
||||||
return nil, fmt.Errorf("you must run f.InitMachine()")
|
return nil, fmt.Errorf("you must run f.InitMachine()")
|
||||||
}
|
}
|
||||||
req.Header.Set("hostname", f.Machine.Hostname)
|
*/
|
||||||
|
req.Header.Set("hostname", "fixme:hostname")
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|
10
init.go
10
init.go
|
@ -6,12 +6,10 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/lib/protobuf/zoopb"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,10 +19,12 @@ import (
|
||||||
func Init() *Forge {
|
func Init() *Forge {
|
||||||
f := InitPB()
|
f := InitPB()
|
||||||
|
|
||||||
|
/*
|
||||||
f.Machine = new(zoopb.Machine)
|
f.Machine = new(zoopb.Machine)
|
||||||
if err := f.Machine.ConfigLoad(); err != nil {
|
if err := f.Machine.ConfigLoad(); err != nil {
|
||||||
log.Log(WARN, "zoopb.ConfigLoad() failed", err)
|
log.Log(WARN, "zoopb.ConfigLoad() failed", err)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if f.Config.Username == "" {
|
if f.Config.Username == "" {
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
f.Config.Username = usr.Username
|
f.Config.Username = usr.Username
|
||||||
|
@ -40,7 +40,7 @@ func Init() *Forge {
|
||||||
f.SetConfigSave(true)
|
f.SetConfigSave(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
f.Machine.InitWit()
|
// f.Machine.InitWit()
|
||||||
|
|
||||||
if f.hasFullScan {
|
if f.hasFullScan {
|
||||||
// duplicate time checking below. which one to keep?
|
// duplicate time checking below. which one to keep?
|
||||||
|
@ -135,17 +135,20 @@ func (f *Forge) InitPB() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Forge) InitMachine() {
|
func (f *Forge) InitMachine() {
|
||||||
|
/*
|
||||||
f.Machine = new(zoopb.Machine)
|
f.Machine = new(zoopb.Machine)
|
||||||
if err := f.Machine.ConfigLoad(); err != nil {
|
if err := f.Machine.ConfigLoad(); err != nil {
|
||||||
log.Log(WARN, "zoopb.ConfigLoad() failed", err)
|
log.Log(WARN, "zoopb.ConfigLoad() failed", err)
|
||||||
f.Machine.InitWit()
|
f.Machine.InitWit()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if f.Config.Username == "" {
|
if f.Config.Username == "" {
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
f.Config.Username = usr.Username
|
f.Config.Username = usr.Username
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if f.Machine.Hostname == "" {
|
if f.Machine.Hostname == "" {
|
||||||
r, err := shell.RunVerbose([]string{"hostname", "-f"})
|
r, err := shell.RunVerbose([]string{"hostname", "-f"})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -153,6 +156,7 @@ func (f *Forge) InitMachine() {
|
||||||
f.Machine.Hostname = strings.TrimSpace(tmp)
|
f.Machine.Hostname = strings.TrimSpace(tmp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// only init's the protobuf. intended to not scan or change anything
|
// only init's the protobuf. intended to not scan or change anything
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/lib/protobuf/zoopb"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// maybe an interface someday?
|
// maybe an interface someday?
|
||||||
|
@ -18,7 +17,7 @@ type Forge struct {
|
||||||
goWork bool // means the user is currently using a go.work file
|
goWork bool // means the user is currently using a go.work file
|
||||||
Config *ForgeConfigs // config repos for readonly, private, etc
|
Config *ForgeConfigs // config repos for readonly, private, etc
|
||||||
Repos *gitpb.Repos // the repo protobufs
|
Repos *gitpb.Repos // the repo protobufs
|
||||||
Machine *zoopb.Machine // things for virtigo to track vm's
|
// Machine *zoopb.Machine // things for virtigo to track vm's
|
||||||
configSave bool // if you need to save the config because things changed
|
configSave bool // if you need to save the config because things changed
|
||||||
hasFullScan bool // track last scan so it can be throttled
|
hasFullScan bool // track last scan so it can be throttled
|
||||||
fullscan time.Time // time of the last scan so it can be throttled
|
fullscan time.Time // time of the last scan so it can be throttled
|
||||||
|
|
Loading…
Reference in New Issue