Fixes
Signed-off-by: Haiyan Meng <hmeng@redhat.com>
This commit is contained in:
parent
819d76b6fd
commit
c0a267bf56
2 changed files with 9 additions and 17 deletions
|
@ -37,7 +37,7 @@
|
||||||
"requests": 200000000000
|
"requests": 200000000000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lables": {
|
"labels": {
|
||||||
"group": "test"
|
"group": "test"
|
||||||
},
|
},
|
||||||
"annotations": {
|
"annotations": {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
@ -46,16 +45,11 @@ func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxR
|
||||||
|
|
||||||
// process req.Name
|
// process req.Name
|
||||||
name := req.GetConfig().GetName()
|
name := req.GetConfig().GetName()
|
||||||
var podSandboxDir string
|
|
||||||
|
|
||||||
if name == "" {
|
if name == "" {
|
||||||
podSandboxDir, err := ioutil.TempDir(s.sandboxDir, "")
|
return nil, fmt.Errorf("PodSandboxConfig.Name should not be empty")
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
name = filepath.Base(podSandboxDir)
|
|
||||||
} else {
|
podSandboxDir := filepath.Join(s.sandboxDir, name)
|
||||||
podSandboxDir = filepath.Join(s.sandboxDir, name)
|
|
||||||
if _, err := os.Stat(podSandboxDir); err == nil {
|
if _, err := os.Stat(podSandboxDir); err == nil {
|
||||||
return nil, fmt.Errorf("pod sandbox (%s) already exists", podSandboxDir)
|
return nil, fmt.Errorf("pod sandbox (%s) already exists", podSandboxDir)
|
||||||
}
|
}
|
||||||
|
@ -64,8 +58,6 @@ func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxR
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// creates a spec Generator with the default spec.
|
// creates a spec Generator with the default spec.
|
||||||
g := generate.New()
|
g := generate.New()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue