(path string, fn resource.VisitorFunc)
| 214 | } |
| 215 | |
| 216 | func walkPathForObjects(path string, fn resource.VisitorFunc) error { |
| 217 | f := kubectl.NewFactory(nil) |
| 218 | |
| 219 | // todo: does "cacheDir" need to be parameterizable? |
| 220 | schema, err := f.Validator(false, "") |
| 221 | if err != nil { |
| 222 | return err |
| 223 | } |
| 224 | |
| 225 | mapper, typer := f.Object() |
| 226 | result := resource.NewBuilder(mapper, typer, resource.DisabledClientForMapping{}, f.Decoder(true)). |
| 227 | ContinueOnError(). |
| 228 | Schema(schema). |
| 229 | FilenameParam(false, path). |
| 230 | Flatten(). |
| 231 | Do() |
| 232 | |
| 233 | err = result.Err() |
| 234 | if err != nil && !checkErrNoResources(err) { |
| 235 | return err |
| 236 | } |
| 237 | |
| 238 | err = result.Visit(fn) |
| 239 | if err != nil { |
| 240 | return err |
| 241 | } |
| 242 | return nil |
| 243 | } |
| 244 | |
| 245 | // withExtensions returns the inputted string with the supported file extensions appended to it |
| 246 | func withExtensions(begin string) []string { |
no test coverage detected