mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Merge pull request #6181 from baude/v2remoteport
add port to podman remote command
This commit is contained in:
@ -57,7 +57,7 @@ func portFlags(flags *pflag.FlagSet) {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
Mode: []entities.EngineMode{entities.ABIMode},
|
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||||
Command: portCommand,
|
Command: portCommand,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ func init() {
|
|||||||
portFlags(flags)
|
portFlags(flags)
|
||||||
|
|
||||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||||
Mode: []entities.EngineMode{entities.ABIMode},
|
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||||
Command: containerPortCommand,
|
Command: containerPortCommand,
|
||||||
Parent: containerCmd,
|
Parent: containerCmd,
|
||||||
})
|
})
|
||||||
|
@ -381,7 +381,29 @@ func (ic *ContainerEngine) Config(_ context.Context) (*config.Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrId string, options entities.ContainerPortOptions) ([]*entities.ContainerPortReport, error) {
|
func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrId string, options entities.ContainerPortOptions) ([]*entities.ContainerPortReport, error) {
|
||||||
return nil, errors.New("not implemented")
|
var (
|
||||||
|
reports []*entities.ContainerPortReport
|
||||||
|
namesOrIds []string
|
||||||
|
)
|
||||||
|
if len(nameOrId) > 0 {
|
||||||
|
namesOrIds = append(namesOrIds, nameOrId)
|
||||||
|
}
|
||||||
|
ctrs, err := getContainersByContext(ic.ClientCxt, options.All, namesOrIds)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, con := range ctrs {
|
||||||
|
if con.State != define.ContainerStateRunning.String() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(con.Ports) > 0 {
|
||||||
|
reports = append(reports, &entities.ContainerPortReport{
|
||||||
|
Id: con.ID,
|
||||||
|
Ports: con.Ports,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return reports, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ic *ContainerEngine) ContainerCp(ctx context.Context, source, dest string, options entities.ContainerCpOptions) (*entities.ContainerCpReport, error) {
|
func (ic *ContainerEngine) ContainerCp(ctx context.Context, source, dest string, options entities.ContainerCpOptions) (*entities.ContainerCpReport, error) {
|
||||||
|
Reference in New Issue
Block a user