mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
api/types: move Version to api/types/system
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/v2/pkg/tracing"
|
||||
"github.com/containerd/log"
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/system"
|
||||
"github.com/moby/moby/v2/daemon/command/debug"
|
||||
"github.com/moby/moby/v2/daemon/config"
|
||||
@@ -101,14 +100,14 @@ func (daemon *Daemon) SystemInfo(ctx context.Context) (*system.Info, error) {
|
||||
// Anything else should be logged and ignored because this is looking up
|
||||
// multiple things and is often used for debugging.
|
||||
// The only case valid early return is when the caller doesn't want the result anymore (ie context cancelled).
|
||||
func (daemon *Daemon) SystemVersion(ctx context.Context) (types.Version, error) {
|
||||
func (daemon *Daemon) SystemVersion(ctx context.Context) (system.VersionResponse, error) {
|
||||
defer metrics.StartTimer(metrics.HostInfoFunctions.WithValues("system_version"))()
|
||||
|
||||
kernelVer := kernelVersion(ctx)
|
||||
cfg := daemon.config()
|
||||
|
||||
v := types.Version{
|
||||
Components: []types.ComponentVersion{
|
||||
v := system.VersionResponse{
|
||||
Components: []system.ComponentVersion{
|
||||
{
|
||||
Name: "Engine",
|
||||
Version: dockerversion.Version,
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
|
||||
runcoptions "github.com/containerd/containerd/api/types/runc/options"
|
||||
"github.com/containerd/log"
|
||||
"github.com/moby/moby/api/types"
|
||||
containertypes "github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/system"
|
||||
"github.com/moby/moby/v2/daemon/config"
|
||||
@@ -158,7 +157,7 @@ func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysI
|
||||
return nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) fillPlatformVersion(ctx context.Context, v *types.Version, cfg *configStore) error {
|
||||
func (daemon *Daemon) fillPlatformVersion(ctx context.Context, v *system.VersionResponse, cfg *configStore) error {
|
||||
if err := daemon.populateContainerdVersion(ctx, v); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -215,7 +214,7 @@ func (daemon *Daemon) populateInitCommit(ctx context.Context, v *system.Info, cf
|
||||
return nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version) error {
|
||||
func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *system.VersionResponse) error {
|
||||
if !rootless.RunningWithRootlessKit() {
|
||||
return nil
|
||||
}
|
||||
@@ -227,7 +226,7 @@ func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to retrieve RootlessKit version")
|
||||
}
|
||||
rlV := types.ComponentVersion{
|
||||
rlV := system.ComponentVersion{
|
||||
Name: "rootlesskit",
|
||||
Version: rlInfo.Version,
|
||||
Details: map[string]string{
|
||||
@@ -266,7 +265,7 @@ func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version)
|
||||
log.G(ctx).WithError(err).Warn("Failed to parse slirp4netns version")
|
||||
return nil
|
||||
}
|
||||
v.Components = append(v.Components, types.ComponentVersion{
|
||||
v.Components = append(v.Components, system.ComponentVersion{
|
||||
Name: "slirp4netns",
|
||||
Version: ver,
|
||||
Details: map[string]string{
|
||||
@@ -288,7 +287,7 @@ func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version)
|
||||
log.G(ctx).WithError(err).Warn("Failed to retrieve vpnkit version")
|
||||
return nil
|
||||
}
|
||||
v.Components = append(v.Components, types.ComponentVersion{
|
||||
v.Components = append(v.Components, system.ComponentVersion{
|
||||
Name: "vpnkit",
|
||||
Version: strings.TrimSpace(strings.TrimSpace(string(out))),
|
||||
})
|
||||
@@ -428,7 +427,7 @@ func (daemon *Daemon) populateContainerdCommit(ctx context.Context, v *system.Co
|
||||
return nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) populateContainerdVersion(ctx context.Context, v *types.Version) error {
|
||||
func (daemon *Daemon) populateContainerdVersion(ctx context.Context, v *system.VersionResponse) error {
|
||||
rv, err := daemon.containerd.Version(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
@@ -438,7 +437,7 @@ func (daemon *Daemon) populateContainerdVersion(ctx context.Context, v *types.Ve
|
||||
return nil
|
||||
}
|
||||
|
||||
v.Components = append(v.Components, types.ComponentVersion{
|
||||
v.Components = append(v.Components, system.ComponentVersion{
|
||||
Name: "containerd",
|
||||
Version: rv.Version,
|
||||
Details: map[string]string{
|
||||
@@ -448,12 +447,12 @@ func (daemon *Daemon) populateContainerdVersion(ctx context.Context, v *types.Ve
|
||||
return nil
|
||||
}
|
||||
|
||||
func populateRuncVersion(cfg *configStore, v *types.Version) error {
|
||||
func populateRuncVersion(cfg *configStore, v *system.VersionResponse) error {
|
||||
_, ver, commit, err := parseDefaultRuntimeVersion(&cfg.Runtimes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
v.Components = append(v.Components, types.ComponentVersion{
|
||||
v.Components = append(v.Components, system.ComponentVersion{
|
||||
Name: cfg.Runtimes.Default,
|
||||
Version: ver,
|
||||
Details: map[string]string{
|
||||
@@ -463,7 +462,7 @@ func populateRuncVersion(cfg *configStore, v *types.Version) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func populateInitVersion(ctx context.Context, cfg *configStore, v *types.Version) error {
|
||||
func populateInitVersion(ctx context.Context, cfg *configStore, v *system.VersionResponse) error {
|
||||
initBinary, err := cfg.LookupInitPath()
|
||||
if err != nil {
|
||||
log.G(ctx).WithError(err).Warn("Failed to find docker-init")
|
||||
@@ -484,7 +483,7 @@ func populateInitVersion(ctx context.Context, cfg *configStore, v *types.Version
|
||||
log.G(ctx).WithError(err).Warnf("failed to parse %s version", initBinary)
|
||||
return nil
|
||||
}
|
||||
v.Components = append(v.Components, types.ComponentVersion{
|
||||
v.Components = append(v.Components, system.ComponentVersion{
|
||||
Name: filepath.Base(initBinary),
|
||||
Version: ver,
|
||||
Details: map[string]string{
|
||||
|
||||
@@ -3,7 +3,6 @@ package daemon
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/system"
|
||||
"github.com/moby/moby/v2/daemon/config"
|
||||
"github.com/moby/moby/v2/pkg/sysinfo"
|
||||
@@ -18,7 +17,7 @@ WARNING: Feature flag "windows-dns-proxy" has been removed, forwarding to extern
|
||||
return nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) fillPlatformVersion(ctx context.Context, v *types.Version, cfg *configStore) error {
|
||||
func (daemon *Daemon) fillPlatformVersion(ctx context.Context, v *system.VersionResponse, cfg *configStore) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/build"
|
||||
"github.com/moby/moby/api/types/events"
|
||||
"github.com/moby/moby/api/types/registry"
|
||||
@@ -18,7 +17,7 @@ import (
|
||||
// system specific functionality.
|
||||
type Backend interface {
|
||||
SystemInfo(context.Context) (*system.Info, error)
|
||||
SystemVersion(context.Context) (types.Version, error)
|
||||
SystemVersion(context.Context) (system.VersionResponse, error)
|
||||
SystemDiskUsage(ctx context.Context, opts backend.DiskUsageOptions) (*backend.DiskUsage, error)
|
||||
SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan any)
|
||||
UnsubscribeFromEvents(chan any)
|
||||
|
||||
Reference in New Issue
Block a user