1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-16 08:25:51 +00:00

handle new not found err in docker

This commit is contained in:
moelsayed 2018-10-27 06:15:54 +02:00 committed by Alena Prokharchyk
parent dd4d19a945
commit dd4faabd6c

View File

@ -176,8 +176,8 @@ func FetchCertificatesFromHost(ctx context.Context, extraHosts []*hosts.Host, ho
if err != nil && (!strings.HasPrefix(certName, "kube-etcd") && if err != nil && (!strings.HasPrefix(certName, "kube-etcd") &&
!strings.Contains(certName, APIProxyClientCertName) && !strings.Contains(certName, APIProxyClientCertName) &&
!strings.Contains(certName, RequestHeaderCACertName)) { !strings.Contains(certName, RequestHeaderCACertName)) {
if strings.Contains(err.Error(), "no such file or directory") || // IsErrNotFound doesn't catch this because it's a custom error
strings.Contains(err.Error(), "Could not find the file") { if isFileNotFoundErr(err) {
return nil, nil return nil, nil
} }
return nil, err return nil, err
@ -280,3 +280,12 @@ func populateCertMap(tmpCerts map[string]CertificatePKI, localConfigPath string,
return certs return certs
} }
func isFileNotFoundErr(e error) bool {
if strings.Contains(e.Error(), "no such file or directory") ||
strings.Contains(e.Error(), "Could not find the file") ||
strings.Contains(e.Error(), "No such container:path:") {
return true
}
return false
}