1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request from tao12345666333/rm-systeminfo-error-handler

Remove `SystemInfo()` error handling.
This commit is contained in:
Akihiro Suda 2020-03-13 01:59:13 +09:00 committed by GitHub
commit f073ed4187
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 15 deletions
api/server/router/system
daemon

View file

@ -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{})

View file

@ -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...)

View file

@ -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)

View file

@ -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) {

View file

@ -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,

View file

@ -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{

View file

@ -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.