diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-09 23:04:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 23:04:23 +0200 |
commit | 3ff96383f306cecfeed75986078144ad757e3d70 (patch) | |
tree | 301a71ee7621be9d6bfd1b77552c1574f5fc18d2 /pkg/domain | |
parent | 2a6487c4aaa312e9284d223540e971b109d0fcf2 (diff) | |
parent | 931bd5ace6d6efa19e0b123d8d70b273ea79d5ab (diff) | |
download | podman-3ff96383f306cecfeed75986078144ad757e3d70.tar.gz podman-3ff96383f306cecfeed75986078144ad757e3d70.tar.bz2 podman-3ff96383f306cecfeed75986078144ad757e3d70.zip |
Merge pull request #6148 from jwhonce/wip/version
V2 Implement tunnelled podman version
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/entities/engine_container.go | 1 | ||||
-rw-r--r-- | pkg/domain/entities/system.go | 14 | ||||
-rw-r--r-- | pkg/domain/infra/abi/system.go | 10 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/system.go | 4 |
4 files changed, 29 insertions, 0 deletions
diff --git a/pkg/domain/entities/engine_container.go b/pkg/domain/entities/engine_container.go index bb13794bd..719ac3f9e 100644 --- a/pkg/domain/entities/engine_container.go +++ b/pkg/domain/entities/engine_container.go @@ -73,6 +73,7 @@ type ContainerEngine interface { SystemDf(ctx context.Context, options SystemDfOptions) (*SystemDfReport, error) Unshare(ctx context.Context, args []string) error VarlinkService(ctx context.Context, opts ServiceOptions) error + Version(ctx context.Context) (*SystemVersionReport, error) VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*IdOrNameResponse, error) VolumeInspect(ctx context.Context, namesOrIds []string, opts VolumeInspectOptions) ([]*VolumeInspectReport, error) VolumeList(ctx context.Context, opts VolumeListOptions) ([]*VolumeListReport, error) diff --git a/pkg/domain/entities/system.go b/pkg/domain/entities/system.go index c62f40025..5e4760d12 100644 --- a/pkg/domain/entities/system.go +++ b/pkg/domain/entities/system.go @@ -3,6 +3,8 @@ package entities import ( "time" + "github.com/containers/libpod/libpod/define" + "github.com/docker/docker/api/types" "github.com/spf13/cobra" ) @@ -83,3 +85,15 @@ type SystemDfVolumeReport struct { type SystemResetOptions struct { Force bool } + +// SystemVersionReport describes version information about the running Podman service +type SystemVersionReport struct { + // Always populated + Client *define.Version `json:",omitempty"` + // May be populated, when in tunnel mode + Server *define.Version `json:",omitempty"` +} + +type ComponentVersion struct { + types.Version +} diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index fc92da1b2..d701d65de 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -407,3 +407,13 @@ func (ic *ContainerEngine) Unshare(ctx context.Context, args []string) error { cmd.Stderr = os.Stderr return cmd.Run() } + +func (ic ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionReport, error) { + var report entities.SystemVersionReport + v, err := define.GetVersion() + if err != nil { + return nil, err + } + report.Client = &v + return &report, err +} diff --git a/pkg/domain/infra/tunnel/system.go b/pkg/domain/infra/tunnel/system.go index d00795741..dafada805 100644 --- a/pkg/domain/infra/tunnel/system.go +++ b/pkg/domain/infra/tunnel/system.go @@ -34,3 +34,7 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System func (ic *ContainerEngine) Unshare(ctx context.Context, args []string) error { return errors.New("unshare is not supported on remote clients") } + +func (ic ContainerEngine) Version(ctx context.Context) (*entities.SystemVersionReport, error) { + return system.Version(ic.ClientCxt) +} |