mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
hostutil: disable host info collection on openbsd (#7699)
This commit is contained in:
committed by
GitHub
parent
afcba41190
commit
3e97f5cf62
@@ -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.
|
||||
//
|
||||
|
||||
17
helper/hostutil/hostinfo_error.go
Normal file
17
helper/hostutil/hostinfo_error.go
Normal 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())
|
||||
}
|
||||
21
helper/hostutil/hostinfo_openbsd.go
Normal file
21
helper/hostutil/hostinfo_openbsd.go
Normal 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")
|
||||
}
|
||||
Reference in New Issue
Block a user