Skip to content

Commit

Permalink
Changing from interface type to process type
Browse files Browse the repository at this point in the history
Signed-off-by: rajasec <[email protected]>
  • Loading branch information
rajasec committed Mar 13, 2016
1 parent d1faa82 commit e7d1d78
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,24 +366,15 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
return handler.forward(process)
}

func validateProcessSpec(spec ...interface{}) error {
for _, arg := range spec {
switch a := arg.(type) {
case *specs.Process:
if a.Cwd == "" {
return fmt.Errorf("Cwd property must not be empty")
}
if !filepath.IsAbs(a.Cwd) {
return fmt.Errorf("Cwd must be an absolute path")
}
if len(a.Args) == 0 {
return fmt.Errorf("args must not be empty")
}
//TODO
//Add for remaining spec validation
default:
return fmt.Errorf("not a valid spec")
}
func validateProcessSpec(spec *specs.Process) error {
if spec.Cwd == "" {
return fmt.Errorf("Cwd property must not be empty")
}
if !filepath.IsAbs(spec.Cwd) {
return fmt.Errorf("Cwd must be an absolute path")
}
if len(spec.Args) == 0 {
return fmt.Errorf("args must not be empty")
}
return nil
}

0 comments on commit e7d1d78

Please sign in to comment.