Only log HasLifecycle details if it is worthy of a warning

This commit is contained in:
Peter Rifel 2021-03-19 23:22:19 -05:00
parent 14bbcece15
commit 7f32b2a211
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
2 changed files with 7 additions and 7 deletions

View File

@ -134,7 +134,7 @@ func (e *executor) RunTasks(taskMap map[string]Task) error {
remaining := time.Second * time.Duration(int(time.Until(ts.deadline).Seconds()))
if _, ok := err.(*TryAgainLaterError); ok {
klog.Infof("Task %q not ready: %v", ts.key, err)
klog.V(2).Infof("Task %q not ready: %v", ts.key, err)
} else {
klog.Warningf("error running task %q (%v remaining to succeed): %v", ts.key, remaining, err)
}

View File

@ -98,18 +98,18 @@ func (c *ModelBuilderContext) setLifecycleOverride(task Task) Task {
// TODO(@chrislovecnm) - wonder if we should update the nodeup tasks to have lifecycle
// TODO - so that we can return an error here, rather than just returning.
// certain tasks have not implemented HasLifecycle interface
hl, ok := task.(HasLifecycle)
if !ok {
klog.V(8).Infof("task %T does not implement HasLifecycle", task)
return task
}
typeName := TypeNameForTask(task)
klog.V(8).Infof("testing task %q", typeName)
// typeName can be values like "InternetGateway"
value, ok := c.LifecycleOverrides[typeName]
if ok {
hl, okHL := task.(HasLifecycle)
if !okHL {
klog.Warningf("task %T does not implement HasLifecycle", task)
return task
}
klog.Warningf("overriding task %s, lifecycle %s", task, value)
hl.SetLifecycle(value)
}