Changing from interface type to process type

Signed-off-by: rajasec <rajasec79@gmail.com>
This commit is contained in:
rajasec 2016-03-13 22:08:11 +05:30
parent d1faa82a0a
commit e7d1d78af2
1 changed files with 9 additions and 18 deletions

View File

@ -366,24 +366,15 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
return handler.forward(process) return handler.forward(process)
} }
func validateProcessSpec(spec ...interface{}) error { func validateProcessSpec(spec *specs.Process) error {
for _, arg := range spec { if spec.Cwd == "" {
switch a := arg.(type) { return fmt.Errorf("Cwd property must not be empty")
case *specs.Process: }
if a.Cwd == "" { if !filepath.IsAbs(spec.Cwd) {
return fmt.Errorf("Cwd property must not be empty") return fmt.Errorf("Cwd must be an absolute path")
} }
if !filepath.IsAbs(a.Cwd) { if len(spec.Args) == 0 {
return fmt.Errorf("Cwd must be an absolute path") return fmt.Errorf("args must not be empty")
}
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")
}
} }
return nil return nil
} }