code is better because of autogenpb
This commit is contained in:
parent
5d9eb5add6
commit
1abcc862fe
6
http.go
6
http.go
|
@ -77,10 +77,10 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if route == "/list" {
|
if route == "/list" {
|
||||||
log.HttpMode(w)
|
log.HttpMode(w)
|
||||||
defer log.HttpMode(nil)
|
defer log.HttpMode(nil)
|
||||||
loop := me.machines.SortByName()
|
loop := me.machines.SortByHostname()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
m := loop.Machine()
|
m := loop.Next()
|
||||||
zood := m.FindPackageByName("zood")
|
zood := m.Packages.FindByName("zood")
|
||||||
v := me.targets["zood"] // this is the target version
|
v := me.targets["zood"] // this is the target version
|
||||||
if zood == nil {
|
if zood == nil {
|
||||||
log.Info("machine", m.Hostname, "does not have zood installed")
|
log.Info("machine", m.Hostname, "does not have zood installed")
|
||||||
|
|
|
@ -11,7 +11,7 @@ func updateMachine(u *zoopb.Machine) string {
|
||||||
if u == nil {
|
if u == nil {
|
||||||
return "nil"
|
return "nil"
|
||||||
}
|
}
|
||||||
m := me.machines.FindByName(u.Hostname)
|
m := me.machines.FindByHostname(u.Hostname)
|
||||||
if m == nil {
|
if m == nil {
|
||||||
log.Info("adding new machine", u.Hostname)
|
log.Info("adding new machine", u.Hostname)
|
||||||
me.machines.Append(u)
|
me.machines.Append(u)
|
||||||
|
@ -38,7 +38,7 @@ func updateMachine(u *zoopb.Machine) string {
|
||||||
if u.Packages == nil {
|
if u.Packages == nil {
|
||||||
u.Packages = new(zoopb.Packages)
|
u.Packages = new(zoopb.Packages)
|
||||||
}
|
}
|
||||||
if zood := m.FindPackageByName("zood"); zood != nil {
|
if zood := m.Packages.FindByName("zood"); zood != nil {
|
||||||
log.Log(INFO, m.Hostname, "has zood version", zood.Version)
|
log.Log(INFO, m.Hostname, "has zood version", zood.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ func updatePackages(m *zoopb.Machine, newp *zoopb.Packages) bool {
|
||||||
|
|
||||||
loop := newp.SortByName()
|
loop := newp.SortByName()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
p := loop.Package()
|
p := loop.Next()
|
||||||
if p.Name == "zood" {
|
if p.Name == "zood" {
|
||||||
if pold := m.FindPackageByName("zood"); pold == nil {
|
if pold := m.Packages.FindByName("zood"); pold == nil {
|
||||||
changed = true
|
changed = true
|
||||||
log.Log(ZOOD, "updatePackages() new package", p.Name , "version", p.Version, "machine", m.Hostname)
|
log.Log(ZOOD, "updatePackages() new package", p.Name , "version", p.Version, "machine", m.Hostname)
|
||||||
m.Packages.Append(p)
|
m.Packages.Append(p)
|
||||||
|
|
|
@ -41,11 +41,11 @@ func NewWatchdog() {
|
||||||
case t := <-me.dog.C:
|
case t := <-me.dog.C:
|
||||||
// log.Info("zookeeper Watchdog() ticked", me.hostname, "Current time: ", t)
|
// log.Info("zookeeper Watchdog() ticked", me.hostname, "Current time: ", t)
|
||||||
var counter int
|
var counter int
|
||||||
loop := me.machines.SortByName()
|
loop := me.machines.SortByHostname()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
m := loop.Machine()
|
m := loop.Next()
|
||||||
counter += 1
|
counter += 1
|
||||||
zood := m.FindPackageByName("zood")
|
zood := m.Packages.FindByName("zood")
|
||||||
if zood == nil {
|
if zood == nil {
|
||||||
log.Info("machine", m.Hostname, "does not have zood installed")
|
log.Info("machine", m.Hostname, "does not have zood installed")
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue