mirror of
https://github.com/siderolabs/talos.git
synced 2025-12-10 20:11:23 +01:00
chore: remove watchErr from metal.getResource
It's only used to detect if resource is `nil` or of incorrect type. Both errors are developer errors, so we should not collect them. Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
This commit is contained in:
parent
1253513bd1
commit
a8ebcca4a9
@ -14,7 +14,6 @@ import (
|
||||
"github.com/cosi-project/runtime/pkg/resource"
|
||||
"github.com/cosi-project/runtime/pkg/safe"
|
||||
"github.com/cosi-project/runtime/pkg/state"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
|
||||
"github.com/siderolabs/talos/pkg/machinery/constants"
|
||||
hardwareResource "github.com/siderolabs/talos/pkg/machinery/resources/hardware"
|
||||
@ -114,17 +113,10 @@ func getResource[T resource.Resource](ctx context.Context, r state.State, namesp
|
||||
return "", fmt.Errorf("failed to watch %s resources: %w", typ, err)
|
||||
}
|
||||
|
||||
var watchErr error
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-watchCtx.Done():
|
||||
err := fmt.Errorf("failed to determine %s of %s: %w", valName, typ, watchCtx.Err())
|
||||
if watchErr != nil {
|
||||
err = multierror.Append(watchErr, err)
|
||||
}
|
||||
|
||||
return "", err
|
||||
return "", fmt.Errorf("failed to determine %s of %s: %w", valName, typ, watchCtx.Err())
|
||||
case event := <-events:
|
||||
switch event.Type() {
|
||||
case state.Created, state.Updated:
|
||||
@ -137,9 +129,7 @@ func getResource[T resource.Resource](ctx context.Context, r state.State, namesp
|
||||
|
||||
eventResource, err := event.Resource()
|
||||
if err != nil {
|
||||
watchErr = multierror.Append(watchErr, fmt.Errorf("invalid resource in wrapped event: %w", err))
|
||||
|
||||
continue
|
||||
return "", fmt.Errorf("incorrect resource: %w", err)
|
||||
}
|
||||
|
||||
if !isReadyFunc(eventResource) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user