Skip to content

Commit

Permalink
fix user input complete container id issue
Browse files Browse the repository at this point in the history
Signed-off-by: hengyoush <[email protected]>
  • Loading branch information
hengyoush authored and MandssS committed Jul 24, 2023
1 parent 11087a8 commit 0ee77a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions exec/container/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/chaosblade-io/chaosblade-exec-cri/exec/container"
"github.com/chaosblade-io/chaosblade-spec-go/util"
"github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"

"github.com/chaosblade-io/chaosblade-spec-go/spec"

Expand Down Expand Up @@ -161,7 +161,7 @@ func getMatchedContainerMetaList(pods []v1.Pod, containerIdsValue, containerName
if expectedContainerId == "" {
continue
}
if strings.HasPrefix(containerId, expectedContainerId) {
if strings.HasPrefix(expectedContainerId, containerId) {
if containerStatusErr != nil {
return containerObjectMetaList, spec.ResponseFailWithFlags(spec.ParameterInvalid,
model.ContainerIdsFlag.Name, expectedContainerId,
Expand Down
5 changes: 3 additions & 2 deletions exec/model/executor_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ package model
import (
"context"
"fmt"
"path"
"sync"

"github.com/chaosblade-io/chaosblade-exec-cri/exec/container"
"github.com/chaosblade-io/chaosblade-operator/channel"
"github.com/chaosblade-io/chaosblade-operator/pkg/apis/chaosblade/v1alpha1"
Expand All @@ -30,8 +33,6 @@ import (
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
"path"
"sync"
)

type ExperimentIdentifierInPod struct {
Expand Down

0 comments on commit 0ee77a5

Please sign in to comment.