hostutil: disable host info collection on openbsd (#7699)

This commit is contained in:
Calvin Leung Huang
2019-10-18 12:08:35 -07:00
committed by GitHub
parent afcba41190
commit 3e97f5cf62
3 changed files with 40 additions and 14 deletions

View File

@@ -1,3 +1,5 @@
// +build !openbsd
package hostutil
import (
@@ -31,20 +33,6 @@ type HostInfo struct {
Memory *mem.VirtualMemoryStat `json:"memory"`
}
// HostInfoError is a typed error for more convenient error checking.
type HostInfoError struct {
Type string
Err error
}
func (e *HostInfoError) WrappedErrors() []error {
return []error{e.Err}
}
func (e *HostInfoError) Error() string {
return fmt.Sprintf("%s: %s", e.Type, e.Err.Error())
}
// CollectHostInfo returns information on the host, which includes general
// host status, CPU, memory, and disk utilization.
//

View File

@@ -0,0 +1,17 @@
package hostutil
import "fmt"
// HostInfoError is a typed error for more convenient error checking.
type HostInfoError struct {
Type string
Err error
}
func (e *HostInfoError) WrappedErrors() []error {
return []error{e.Err}
}
func (e *HostInfoError) Error() string {
return fmt.Sprintf("%s: %s", e.Type, e.Err.Error())
}

View File

@@ -0,0 +1,21 @@
// +build openbsd
package hostutil
import (
"fmt"
"time"
)
type HostInfo struct {
Timestamp time.Time `json:"timestamp"`
CPU []interface{} `json:"cpu"`
CPUTimes []interface{} `json:"cpu_times"`
Disk []interface{} `json:"disk"`
Host interface{} `json:"host"`
Memory interface{} `json:"memory"`
}
func CollectHostInfo() (*HostInfo, error) {
return nil, fmt.Errorf("host info not supported on this platform")
}