mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(region): check status when container exec command (#22422)
This commit is contained in:
@@ -859,7 +859,10 @@ func (c *SContainer) GetDetailsExecInfo(ctx context.Context, userCred mcclient.T
|
||||
}
|
||||
|
||||
func (c *SContainer) PerformExecSync(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input *api.ContainerExecSyncInput) (jsonutils.JSONObject, error) {
|
||||
if !api.ContainerRunningStatus.Has(c.GetStatus()) {
|
||||
if sets.NewString(
|
||||
api.CONTAINER_STATUS_EXITED,
|
||||
api.CONTAINER_STATUS_CREATED,
|
||||
).Has(c.GetStatus()) {
|
||||
return nil, httperrors.NewInvalidStatusError("Can't exec container in status %s", c.Status)
|
||||
}
|
||||
return c.GetPodDriver().RequestExecSyncContainer(ctx, userCred, c, input)
|
||||
|
||||
Reference in New Issue
Block a user