Skip to content

Commit

Permalink
Merge pull request #1075 from giuseppe/parse-copy-no-copy
Browse files Browse the repository at this point in the history
parse: support copy and nocopy
  • Loading branch information
openshift-ci[bot] authored Jun 27, 2022
2 parents a65c38a + 4f1b614 commit 97d9656
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// ValidateVolumeOpts validates a volume's options
func ValidateVolumeOpts(options []string) ([]string, error) {
var foundRootPropagation, foundRWRO, foundLabelChange, bindType, foundExec, foundDev, foundSuid, foundChown, foundUpperDir, foundWorkDir int
var foundRootPropagation, foundRWRO, foundLabelChange, bindType, foundExec, foundDev, foundSuid, foundChown, foundUpperDir, foundWorkDir, foundCopy int
finalOpts := make([]string, 0, len(options))
for _, opt := range options {
// support advanced options like upperdir=/path, workdir=/path
Expand Down Expand Up @@ -88,6 +88,11 @@ func ValidateVolumeOpts(options []string) ([]string, error) {
// are intended to be always safe to use, even not on OS
// X).
continue
case "copy", "nocopy":
foundCopy++
if foundCopy > 1 {
return nil, errors.Errorf("invalid options %q, can only specify 1 'copy' or 'nocopy' option", strings.Join(options, ", "))
}
default:
return nil, errors.Errorf("invalid option type %q", opt)
}
Expand Down

0 comments on commit 97d9656

Please sign in to comment.