zones: add logger to Zone and Machine

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-09-07 14:51:01 +00:00
parent 5e5958d22e
commit 1bca1f7da1
3 changed files with 9 additions and 4 deletions
+2
View File
@@ -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:"-"`
+6 -4
View File
@@ -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
View File
@@ -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"`