Skip to content

Commit 9e31200

Browse files
author
Haiyan Meng
committed
Several tiny fixes
Signed-off-by: Haiyan Meng <hmeng@redhat.com>
1 parent 0e6dfc0 commit 9e31200

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

cmd/ocitools/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func setupSpec(g generate.Generator, context *cli.Context) error {
321321
}
322322

323323
// Set the DefaultAction of seccomp
324-
if context.IsSet("setcomp-default") {
324+
if context.IsSet("seccomp-default") {
325325
if err := g.SetLinuxSeccompDefault(sd); err != nil {
326326
return err
327327
}
@@ -345,7 +345,7 @@ func setupSpec(g generate.Generator, context *cli.Context) error {
345345
}
346346
}
347347

348-
if context.IsSet("seccomp-allows") {
348+
if context.IsSet("seccomp-allow") {
349349
seccompAllows := context.StringSlice("seccomp-allow")
350350
for _, s := range seccompAllows {
351351
g.AddLinuxSeccompSyscallAllow(s)

generate/generate.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func (g Generator) AddAnnotation(s string) error {
237237

238238
pair := strings.Split(s, "=")
239239
if len(pair) != 2 {
240-
return fmt.Errorf("incorrectly specified sysctl: %s", s)
240+
return fmt.Errorf("incorrectly specified annotation: %s", s)
241241
}
242242
g.spec.Annotations[pair[0]] = pair[1]
243243
return nil
@@ -855,10 +855,10 @@ func (g Generator) SetupPrivileged(privileged bool) {
855855

856856
func checkCap(c string) error {
857857
isValid := false
858-
cp := fmt.Sprintf("CAP_%s", c)
858+
cp := strings.ToUpper(c)
859859

860860
for _, cap := range capability.List() {
861-
if strings.ToUpper(cp) == strings.ToUpper(cap.String()) {
861+
if cp == strings.ToUpper(cap.String()) {
862862
isValid = true
863863
break
864864
}
@@ -881,10 +881,10 @@ func (g Generator) AddProcessCapability(c string) error {
881881
return err
882882
}
883883

884-
cp := fmt.Sprintf("CAP_%s", c)
884+
cp := fmt.Sprintf("CAP_%s", strings.ToUpper(c))
885885

886886
for _, cap := range g.spec.Process.Capabilities {
887-
if strings.ToUpper(cap) == strings.ToUpper(cp) {
887+
if strings.ToUpper(cap) == cp {
888888
return nil
889889
}
890890
}
@@ -899,10 +899,10 @@ func (g Generator) DropProcessCapability(c string) error {
899899
return err
900900
}
901901

902-
cp := fmt.Sprintf("CAP_%s", c)
902+
cp := fmt.Sprintf("CAP_%s", strings.ToUpper(c))
903903

904904
for i, cap := range g.spec.Process.Capabilities {
905-
if strings.ToUpper(cap) == strings.ToUpper(cp) {
905+
if strings.ToUpper(cap) == cp {
906906
g.spec.Process.Capabilities = append(g.spec.Process.Capabilities[:i], g.spec.Process.Capabilities[i+1:]...)
907907
return nil
908908
}

0 commit comments

Comments
 (0)