engine: resources: svc: Reduce unnecessary logging

This commit is contained in:
James Shubin
2024-09-18 21:47:29 -04:00
parent 06a023ca66
commit b9e093cd6b

View File

@@ -220,7 +220,9 @@ func (obj *SvcRes) Watch(ctx context.Context) error {
} }
if invalid { if invalid {
if obj.init.Debug {
obj.init.Logf("waiting for service") // waiting for svc to appear... obj.init.Logf("waiting for service") // waiting for svc to appear...
}
if activeSet { if activeSet {
activeSet = false activeSet = false
set.Remove(svc) // no return value should ever occur set.Remove(svc) // no return value should ever occur
@@ -240,11 +242,13 @@ func (obj *SvcRes) Watch(ctx context.Context) error {
set.Add(svc) // no return value should ever occur set.Add(svc) // no return value should ever occur
} }
obj.init.Logf("watching...") // attempting to watch... //obj.init.Logf("watching...") // attempting to watch...
select { select {
case event := <-subChannel: case event := <-subChannel:
if obj.init.Debug {
obj.init.Logf("event: %+v", event) obj.init.Logf("event: %+v", event)
}
// NOTE: the value returned is a map for some reason... // NOTE: the value returned is a map for some reason...
if event[svc] != nil { if event[svc] != nil {
// event[svc].ActiveState is not nil // event[svc].ActiveState is not nil
@@ -352,7 +356,6 @@ func (obj *SvcRes) CheckApply(ctx context.Context, apply bool) (bool, error) {
} }
// apply portion // apply portion
obj.init.Logf("Apply")
files := []string{svc} // the svc represented in a list files := []string{svc} // the svc represented in a list
if obj.Startup == "enabled" { if obj.Startup == "enabled" {
_, _, err = conn.EnableUnitFilesContext(ctx, files, false, true) _, _, err = conn.EnableUnitFilesContext(ctx, files, false, true)