diff options
author | Brent Baude <bbaude@redhat.com> | 2020-05-11 14:09:41 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-05-11 14:09:41 -0500 |
commit | a36e8d8eaa94458325afe19d7af7f29bf7fffbcd (patch) | |
tree | ead87dbfdd976a15f1810b6e559aeb83baf41093 /pkg | |
parent | 7837bf3c071f1259bc08d8f9e52ed2b4edbda428 (diff) | |
download | podman-a36e8d8eaa94458325afe19d7af7f29bf7fffbcd.tar.gz podman-a36e8d8eaa94458325afe19d7af7f29bf7fffbcd.tar.bz2 podman-a36e8d8eaa94458325afe19d7af7f29bf7fffbcd.zip |
add port to podman remote command
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 49a3069d6..028e3bc5f 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -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) { - 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) { |