mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 21:53:52 +00:00
don't migrate files you can't access
This commit is contained in:
@@ -230,14 +230,17 @@ func (rules *ClientConfigLoadingRules) Migrate() error {
|
|||||||
if _, err := os.Stat(destination); err == nil {
|
if _, err := os.Stat(destination); err == nil {
|
||||||
// if the destination already exists, do nothing
|
// if the destination already exists, do nothing
|
||||||
continue
|
continue
|
||||||
|
} else if os.IsPermission(err) {
|
||||||
|
// if we can't access the file, skip it
|
||||||
|
continue
|
||||||
} else if !os.IsNotExist(err) {
|
} else if !os.IsNotExist(err) {
|
||||||
// if we had an error other than non-existence, fail
|
// if we had an error other than non-existence, fail
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if sourceInfo, err := os.Stat(source); err != nil {
|
if sourceInfo, err := os.Stat(source); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) || os.IsPermission(err) {
|
||||||
// if the source file doesn't exist, there's no work to do.
|
// if the source file doesn't exist or we can't access it, there's no work to do.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user