mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Remove file_windows.go
Signed-off-by: Manuel Buil <mbuil@suse.com>
This commit is contained in:
parent
0809187cff
commit
d593c83603
@ -1,5 +1,3 @@
|
||||
//go:build !windows
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
|
@ -1,39 +0,0 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func SetFileModeForPath(name string, mode os.FileMode) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetFileModeForFile(file *os.File, mode os.FileMode) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadFile reads from a file
|
||||
func ReadFile(path string) (string, error) {
|
||||
if path == "" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
for start := time.Now(); time.Since(start) < 4*time.Minute; {
|
||||
vpnBytes, err := os.ReadFile(path)
|
||||
if err == nil {
|
||||
return strings.TrimSpace(string(vpnBytes)), nil
|
||||
} else if os.IsNotExist(err) {
|
||||
logrus.Infof("Waiting for %s to be available\n", path)
|
||||
time.Sleep(2 * time.Second)
|
||||
} else {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
return "", errors.New("Timeout while trying to read the file")
|
||||
}
|
Loading…
Reference in New Issue
Block a user