mirror of https://github.com/docker/cli.git
cli/context/store: List(): don't interrupt listing for not-found errors
There's no reason to stop listing contexts if a context does not exist while iterating over the directories, Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
951bb481c0
commit
09c94c1c21
|
@ -110,6 +110,9 @@ func (s *metadataStore) list() ([]Metadata, error) {
|
||||||
for _, dir := range ctxDirs {
|
for _, dir := range ctxDirs {
|
||||||
c, err := s.getByID(contextdir(dir))
|
c, err := s.getByID(contextdir(dir))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
return nil, errors.Wrap(err, "failed to read metadata")
|
return nil, errors.Wrap(err, "failed to read metadata")
|
||||||
}
|
}
|
||||||
res = append(res, c)
|
res = append(res, c)
|
||||||
|
|
|
@ -82,6 +82,9 @@ func (s *tlsStore) listContextData(name string) (map[string]EndpointFiles, error
|
||||||
for _, epFS := range epFSs {
|
for _, epFS := range epFSs {
|
||||||
if epFS.IsDir() {
|
if epFS.IsDir() {
|
||||||
fss, err := os.ReadDir(filepath.Join(contextDir, epFS.Name()))
|
fss, err := os.ReadDir(filepath.Join(contextDir, epFS.Name()))
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to list TLS files for endpoint %s", epFS.Name())
|
return nil, errors.Wrapf(err, "failed to list TLS files for endpoint %s", epFS.Name())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue