mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(climc): add scope parameter to pod-exec (#20151)
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user