checkContextExists returns an error if the context directory does not exist.
(dockerCli command.Cli, name string)
| 72 | |
| 73 | // checkContextExists returns an error if the context directory does not exist. |
| 74 | func checkContextExists(dockerCli command.Cli, name string) error { |
| 75 | contextDir := dockerCli.ContextStore().GetStorageInfo(name).MetadataPath |
| 76 | _, err := os.Stat(contextDir) |
| 77 | if os.IsNotExist(err) { |
| 78 | return notFoundErr{fmt.Errorf("context %q does not exist", name)} |
| 79 | } |
| 80 | // Ignore other errors; if relevant, they will produce an error when |
| 81 | // performing the actual delete. |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | type notFoundErr struct{ error } |
| 86 |
no test coverage detected
searching dependent graphs…