diff --git a/helper/hostutil/hostinfo.go b/helper/hostutil/hostinfo.go index e67c788dc7..116cda7043 100644 --- a/helper/hostutil/hostinfo.go +++ b/helper/hostutil/hostinfo.go @@ -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. // diff --git a/helper/hostutil/hostinfo_error.go b/helper/hostutil/hostinfo_error.go new file mode 100644 index 0000000000..ca5d8a2941 --- /dev/null +++ b/helper/hostutil/hostinfo_error.go @@ -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()) +} diff --git a/helper/hostutil/hostinfo_openbsd.go b/helper/hostutil/hostinfo_openbsd.go new file mode 100644 index 0000000000..7594f8f896 --- /dev/null +++ b/helper/hostutil/hostinfo_openbsd.go @@ -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") +}