chore: add generic methods and use them part #2

Use things from #5702.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
This commit is contained in:
Dmitriy Matrenichev
2022-06-08 00:08:23 +08:00
parent 7114292b6c
commit 4dbbf4ac50
49 changed files with 199 additions and 424 deletions

View File

@@ -9,6 +9,8 @@ import (
"fmt"
"os"
"time"
"github.com/talos-systems/talos/pkg/machinery/generic/slices"
)
type file string
@@ -47,10 +49,7 @@ func WaitForFileToExist(filename string) Condition {
// WaitForFilesToExist is a service condition that will wait for the existence of all the files.
func WaitForFilesToExist(filenames ...string) Condition {
conditions := make([]Condition, len(filenames))
for i := range filenames {
conditions[i] = WaitForFileToExist(filenames[i])
}
conditions := slices.Map(filenames, WaitForFileToExist)
return WaitForAll(conditions...)
}