fix(climc): add scope parameter to pod-exec (#20151)

This commit is contained in:
Zexi Li
2024-04-28 11:18:00 +08:00
committed by GitHub
parent 360231b5cd
commit 0169988e0f
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -43,9 +43,13 @@ func init() {
})
R(&options.PodExecOptions{}, "pod-exec", "Execute a command in a container", func(s *mcclient.ClientSession, opt *options.PodExecOptions) error {
ctrs, err := modules.Containers.List(s, jsonutils.Marshal(map[string]string{
listOpt := map[string]string{
"guest_id": opt.ID,
}))
}
if len(opt.Scope) != 0 {
listOpt["scope"] = opt.Scope
}
ctrs, err := modules.Containers.List(s, jsonutils.Marshal(listOpt))
if err != nil {
return errors.Wrapf(err, "list containers by guest_id %s", opt.ID)
}
@@ -239,5 +239,6 @@ func (o *PodCreateOptions) Params() (*computeapi.ServerCreateInput, error) {
type PodExecOptions struct {
ContainerExecOptions
Scope string `help:"Scope of containers query" choices:"system|domain|project"`
Container string `help:"Container name. If omitted, use the first container." short-token:"c"`
}