Browse Source

zones: add logger to Zone and Machine

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/12/head
Alejandro Mery 1 year ago
parent
commit
1bca1f7da1
  1. 2
      pkg/zones/machine.go
  2. 10
      pkg/zones/scan.go
  3. 1
      pkg/zones/zones.go

2
pkg/zones/machine.go

@ -10,6 +10,8 @@ import (
// A Machine is a machine on a Zone
type Machine struct {
zone *Zone
logger
ID int `toml:"id"`
Name string `toml:"-" json:"-" yaml:"-"`

10
pkg/zones/scan.go

@ -32,8 +32,9 @@ func (m *Zones) scanDirectory(_ *ScanOptions) error {
for _, e := range entries {
if e.IsDir() {
z := &Zone{
zones: m,
Name: e.Name(),
zones: m,
logger: m,
Name: e.Name(),
}
if err := z.scan(); err != nil {
@ -132,8 +133,9 @@ func (z *Zone) scan() error {
for _, e := range entries {
if e.IsDir() {
m := &Machine{
zone: z,
Name: e.Name(),
zone: z,
logger: z,
Name: e.Name(),
}
if err := m.init(); err != nil {

1
pkg/zones/zones.go

@ -88,6 +88,7 @@ func FilterMachines(m MachineIterator, cond func(*Machine) bool) (Machines, int)
// Zone represents one zone in a cluster
type Zone struct {
zones *Zones
logger
ID int `toml:"id"`
Name string `toml:"name"`

Loading…
Cancel
Save