mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #39816 from tao12345666333/rm-systeminfo-error-handler
Remove `SystemInfo()` error handling.
This commit is contained in:
commit
f073ed4187
7 changed files with 9 additions and 15 deletions
api/server/router/system
daemon
|
@ -13,7 +13,7 @@ import (
|
||||||
// Backend is the methods that need to be implemented to provide
|
// Backend is the methods that need to be implemented to provide
|
||||||
// system specific functionality.
|
// system specific functionality.
|
||||||
type Backend interface {
|
type Backend interface {
|
||||||
SystemInfo() (*types.Info, error)
|
SystemInfo() *types.Info
|
||||||
SystemVersion() types.Version
|
SystemVersion() types.Version
|
||||||
SystemDiskUsage(ctx context.Context) (*types.DiskUsage, error)
|
SystemDiskUsage(ctx context.Context) (*types.DiskUsage, error)
|
||||||
SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{})
|
SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{})
|
||||||
|
|
|
@ -44,10 +44,8 @@ func (s *systemRouter) pingHandler(ctx context.Context, w http.ResponseWriter, r
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||||
info, err := s.backend.SystemInfo()
|
info := s.backend.SystemInfo()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if s.cluster != nil {
|
if s.cluster != nil {
|
||||||
info.Swarm = s.cluster.Info()
|
info.Swarm = s.cluster.Info()
|
||||||
info.Warnings = append(info.Warnings, info.Swarm.Warnings...)
|
info.Warnings = append(info.Warnings, info.Swarm.Warnings...)
|
||||||
|
|
|
@ -48,7 +48,7 @@ type Backend interface {
|
||||||
SetContainerDependencyStore(name string, store exec.DependencyGetter) error
|
SetContainerDependencyStore(name string, store exec.DependencyGetter) error
|
||||||
SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
|
SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
|
||||||
SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
|
SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
|
||||||
SystemInfo() (*types.Info, error)
|
SystemInfo() *types.Info
|
||||||
Containers(config *types.ContainerListOptions) ([]*types.Container, error)
|
Containers(config *types.ContainerListOptions) ([]*types.Container, error)
|
||||||
SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
|
SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
|
||||||
DaemonJoinsCluster(provider cluster.Provider)
|
DaemonJoinsCluster(provider cluster.Provider)
|
||||||
|
|
|
@ -47,10 +47,7 @@ func NewExecutor(b executorpkg.Backend, p plugin.Backend, i executorpkg.ImageBac
|
||||||
|
|
||||||
// Describe returns the underlying node description from the docker client.
|
// Describe returns the underlying node description from the docker client.
|
||||||
func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
||||||
info, err := e.backend.SystemInfo()
|
info := e.backend.SystemInfo()
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins := map[api.PluginDescription]struct{}{}
|
plugins := map[api.PluginDescription]struct{}{}
|
||||||
addPlugins := func(typ string, names []string) {
|
addPlugins := func(typ string, names []string) {
|
||||||
|
|
|
@ -1098,8 +1098,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
|
||||||
}
|
}
|
||||||
close(d.startupDone)
|
close(d.startupDone)
|
||||||
|
|
||||||
// FIXME: this method never returns an error
|
info := d.SystemInfo()
|
||||||
info, _ := d.SystemInfo()
|
|
||||||
|
|
||||||
engineInfo.WithValues(
|
engineInfo.WithValues(
|
||||||
dockerversion.Version,
|
dockerversion.Version,
|
||||||
|
|
|
@ -87,7 +87,7 @@ func (daemon *Daemon) LogNetworkEventWithAttributes(nw libnetwork.Network, actio
|
||||||
// LogDaemonEventWithAttributes generates an event related to the daemon itself with specific given attributes.
|
// LogDaemonEventWithAttributes generates an event related to the daemon itself with specific given attributes.
|
||||||
func (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map[string]string) {
|
func (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map[string]string) {
|
||||||
if daemon.EventsService != nil {
|
if daemon.EventsService != nil {
|
||||||
if info, err := daemon.SystemInfo(); err == nil && info.Name != "" {
|
if info := daemon.SystemInfo(); info.Name != "" {
|
||||||
attributes["name"] = info.Name
|
attributes["name"] = info.Name
|
||||||
}
|
}
|
||||||
actor := events.Actor{
|
actor := events.Actor{
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemInfo returns information about the host server the daemon is running on.
|
// SystemInfo returns information about the host server the daemon is running on.
|
||||||
func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
func (daemon *Daemon) SystemInfo() *types.Info {
|
||||||
defer metrics.StartTimer(hostInfoFunctions.WithValues("system_info"))()
|
defer metrics.StartTimer(hostInfoFunctions.WithValues("system_info"))()
|
||||||
|
|
||||||
sysInfo := sysinfo.New(true)
|
sysInfo := sysinfo.New(true)
|
||||||
|
@ -79,7 +79,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
||||||
daemon.fillSecurityOptions(v, sysInfo)
|
daemon.fillSecurityOptions(v, sysInfo)
|
||||||
daemon.fillLicense(v)
|
daemon.fillLicense(v)
|
||||||
|
|
||||||
return v, nil
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemVersion returns version information about the daemon.
|
// SystemVersion returns version information about the daemon.
|
||||||
|
|
Loading…
Add table
Reference in a new issue