From e7d1d78af266c5b82a958e412d8ae40a5b8b3cde Mon Sep 17 00:00:00 2001 From: rajasec Date: Sun, 13 Mar 2016 22:08:11 +0530 Subject: [PATCH] Changing from interface type to process type Signed-off-by: rajasec --- utils.go | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/utils.go b/utils.go index 24b7df1f..a720e3d2 100644 --- a/utils.go +++ b/utils.go @@ -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 }