(capAdd, capDrop []string)
| 206 | } |
| 207 | |
| 208 | func generateCapOpts(capAdd, capDrop []string) ([]oci.SpecOpts, error) { |
| 209 | if len(capAdd) == 0 && len(capDrop) == 0 { |
| 210 | return nil, nil |
| 211 | } |
| 212 | |
| 213 | var opts []oci.SpecOpts |
| 214 | if strutil.InStringSlice(capDrop, "ALL") { |
| 215 | opts = append(opts, oci.WithCapabilities(nil)) |
| 216 | } |
| 217 | |
| 218 | if strutil.InStringSlice(capAdd, "ALL") { |
| 219 | opts = append(opts, oci.WithAllCurrentCapabilities) |
| 220 | } else { |
| 221 | var capsAdd []string |
| 222 | for _, c := range capAdd { |
| 223 | capsAdd = append(capsAdd, canonicalizeCapName(c)) |
| 224 | } |
| 225 | opts = append(opts, oci.WithAddedCapabilities(capsAdd)) |
| 226 | } |
| 227 | |
| 228 | if !strutil.InStringSlice(capDrop, "ALL") { |
| 229 | var capsDrop []string |
| 230 | for _, c := range capDrop { |
| 231 | capsDrop = append(capsDrop, canonicalizeCapName(c)) |
| 232 | } |
| 233 | opts = append(opts, oci.WithDroppedCapabilities(capsDrop)) |
| 234 | } |
| 235 | return opts, nil |
| 236 | } |
no test coverage detected
searching dependent graphs…