(config *criconfig.Config)
| 135 | } |
| 136 | |
| 137 | func loadBaseOCISpecs(config *criconfig.Config) (map[string]*oci.Spec, error) { |
| 138 | specs := map[string]*oci.Spec{} |
| 139 | for _, cfg := range config.Runtimes { |
| 140 | if cfg.BaseRuntimeSpec == "" { |
| 141 | continue |
| 142 | } |
| 143 | |
| 144 | // Don't load same file twice |
| 145 | if _, ok := specs[cfg.BaseRuntimeSpec]; ok { |
| 146 | continue |
| 147 | } |
| 148 | |
| 149 | spec, err := loadOCISpec(cfg.BaseRuntimeSpec) |
| 150 | if err != nil { |
| 151 | return nil, fmt.Errorf("failed to load base OCI spec from file: %s: %w", cfg.BaseRuntimeSpec, err) |
| 152 | } |
| 153 | |
| 154 | specs[cfg.BaseRuntimeSpec] = spec |
| 155 | } |
| 156 | |
| 157 | return specs, nil |
| 158 | } |
| 159 | |
| 160 | func loadOCISpec(filename string) (*oci.Spec, error) { |
| 161 | file, err := os.Open(filename) |
searching dependent graphs…