Combine include/exclude caps into a single cap

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
v0.9
Aaron Lehmann 2021-05-13 11:53:18 -07:00
parent 607dc1f2bf
commit b27fc6169b
2 changed files with 6 additions and 16 deletions

View File

@ -505,11 +505,8 @@ func (a *fileActionCopy) sourcePath(ctx context.Context) (string, error) {
}
func (a *fileActionCopy) addCaps(f *FileOp) {
if len(a.info.IncludePatterns) != 0 {
addCap(&f.constraints, pb.CapFileCopyIncludePatterns)
}
if len(a.info.ExcludePatterns) != 0 {
addCap(&f.constraints, pb.CapFileCopyExcludePatterns)
if len(a.info.IncludePatterns) != 0 || len(a.info.ExcludePatterns) != 0 {
addCap(&f.constraints, pb.CapFileCopyIncludeExcludePatterns)
}
}

View File

@ -50,10 +50,9 @@ const (
CapExecMetaSecurityDeviceWhitelistV1 apicaps.CapID = "exec.meta.security.devices.v1"
CapFileBase apicaps.CapID = "file.base"
CapFileRmWildcard apicaps.CapID = "file.rm.wildcard"
CapFileCopyIncludePatterns apicaps.CapID = "file.copy.includepatterns"
CapFileCopyExcludePatterns apicaps.CapID = "file.copy.excludepatterns"
CapFileBase apicaps.CapID = "file.base"
CapFileRmWildcard apicaps.CapID = "file.rm.wildcard"
CapFileCopyIncludeExcludePatterns apicaps.CapID = "file.copy.includeexcludepatterns"
CapConstraints apicaps.CapID = "constraints"
CapPlatform apicaps.CapID = "platform"
@ -291,13 +290,7 @@ func init() {
})
Caps.Init(apicaps.Cap{
ID: CapFileCopyIncludePatterns,
Enabled: true,
Status: apicaps.CapStatusExperimental,
})
Caps.Init(apicaps.Cap{
ID: CapFileCopyExcludePatterns,
ID: CapFileCopyIncludeExcludePatterns,
Enabled: true,
Status: apicaps.CapStatusExperimental,
})