mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove SystemInfo()
error handling.
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
This commit is contained in:
parent
7ce0e26c16
commit
9134130b39
7 changed files with 9 additions and 15 deletions
|
@ -13,7 +13,7 @@ import (
|
|||
// Backend is the methods that need to be implemented to provide
|
||||
// system specific functionality.
|
||||
type Backend interface {
|
||||
SystemInfo() (*types.Info, error)
|
||||
SystemInfo() *types.Info
|
||||
SystemVersion() types.Version
|
||||
SystemDiskUsage(ctx context.Context) (*types.DiskUsage, error)
|
||||
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 {
|
||||
info, err := s.backend.SystemInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info := s.backend.SystemInfo()
|
||||
|
||||
if s.cluster != nil {
|
||||
info.Swarm = s.cluster.Info()
|
||||
info.Warnings = append(info.Warnings, info.Swarm.Warnings...)
|
||||
|
|
|
@ -48,7 +48,7 @@ type Backend interface {
|
|||
SetContainerDependencyStore(name string, store exec.DependencyGetter) error
|
||||
SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
|
||||
SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
|
||||
SystemInfo() (*types.Info, error)
|
||||
SystemInfo() *types.Info
|
||||
Containers(config *types.ContainerListOptions) ([]*types.Container, error)
|
||||
SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
|
||||
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.
|
||||
func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
||||
info, err := e.backend.SystemInfo()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
info := e.backend.SystemInfo()
|
||||
|
||||
plugins := map[api.PluginDescription]struct{}{}
|
||||
addPlugins := func(typ string, names []string) {
|
||||
|
|
|
@ -1065,8 +1065,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
|
|||
}
|
||||
close(d.startupDone)
|
||||
|
||||
// FIXME: this method never returns an error
|
||||
info, _ := d.SystemInfo()
|
||||
info := d.SystemInfo()
|
||||
|
||||
engineInfo.WithValues(
|
||||
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.
|
||||
func (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map[string]string) {
|
||||
if daemon.EventsService != nil {
|
||||
if info, err := daemon.SystemInfo(); err == nil && info.Name != "" {
|
||||
if info := daemon.SystemInfo(); info.Name != "" {
|
||||
attributes["name"] = info.Name
|
||||
}
|
||||
actor := events.Actor{
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
)
|
||||
|
||||
// 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"))()
|
||||
|
||||
sysInfo := sysinfo.New(true)
|
||||
|
@ -81,7 +81,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|||
daemon.fillSecurityOptions(v, sysInfo)
|
||||
daemon.fillLicense(v)
|
||||
|
||||
return v, nil
|
||||
return v
|
||||
}
|
||||
|
||||
// SystemVersion returns version information about the daemon.
|
||||
|
|
Loading…
Reference in a new issue