Don't get pids on create
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
1d8dc2a072
commit
d19c818cdc
1 changed files with 8 additions and 6 deletions
|
@ -51,7 +51,7 @@ func (s *apiServer) CreateContainer(ctx context.Context, c *types.CreateContaine
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r := <-e.StartResponse
|
r := <-e.StartResponse
|
||||||
apiC, err := createAPIContainer(r.Container)
|
apiC, err := createAPIContainer(r.Container, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ func (s *apiServer) State(ctx context.Context, r *types.StateRequest) (*types.St
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, c := range e.Containers {
|
for _, c := range e.Containers {
|
||||||
apiC, err := createAPIContainer(c)
|
apiC, err := createAPIContainer(c, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ func (s *apiServer) State(ctx context.Context, r *types.StateRequest) (*types.St
|
||||||
return state, nil
|
return state, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func createAPIContainer(c runtime.Container) (*types.Container, error) {
|
func createAPIContainer(c runtime.Container, getPids bool) (*types.Container, error) {
|
||||||
processes, err := c.Processes()
|
processes, err := c.Processes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, grpc.Errorf(codes.Internal, "get processes for container")
|
return nil, grpc.Errorf(codes.Internal, "get processes for container")
|
||||||
|
@ -223,10 +223,12 @@ func createAPIContainer(c runtime.Container) (*types.Container, error) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
pids, err := c.Pids()
|
var pids []int
|
||||||
if err != nil {
|
if getPids {
|
||||||
|
if pids, err = c.Pids(); err != nil {
|
||||||
return nil, grpc.Errorf(codes.Internal, "get all pids for container")
|
return nil, grpc.Errorf(codes.Internal, "get all pids for container")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return &types.Container{
|
return &types.Container{
|
||||||
Id: c.ID(),
|
Id: c.ID(),
|
||||||
BundlePath: c.Path(),
|
BundlePath: c.Path(),
|
||||||
|
|
Loading…
Reference in a new issue