From dd4faabd6cc2086258bb474158fae76461d1785c Mon Sep 17 00:00:00 2001 From: moelsayed Date: Sat, 27 Oct 2018 06:15:54 +0200 Subject: [PATCH] handle new not found err in docker --- pki/deploy.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pki/deploy.go b/pki/deploy.go index a544ccff..e4af0d3a 100644 --- a/pki/deploy.go +++ b/pki/deploy.go @@ -176,8 +176,8 @@ func FetchCertificatesFromHost(ctx context.Context, extraHosts []*hosts.Host, ho if err != nil && (!strings.HasPrefix(certName, "kube-etcd") && !strings.Contains(certName, APIProxyClientCertName) && !strings.Contains(certName, RequestHeaderCACertName)) { - if strings.Contains(err.Error(), "no such file or directory") || - strings.Contains(err.Error(), "Could not find the file") { + // IsErrNotFound doesn't catch this because it's a custom error + if isFileNotFoundErr(err) { return nil, nil } return nil, err @@ -280,3 +280,12 @@ func populateCertMap(tmpCerts map[string]CertificatePKI, localConfigPath string, 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 +}