Skip to content

Commit

Permalink
hostutil: disable host info collection on openbsd (#7699)
Browse files Browse the repository at this point in the history
  • Loading branch information
calvn authored Oct 18, 2019
1 parent afcba41 commit 3e97f5c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
16 changes: 2 additions & 14 deletions helper/hostutil/hostinfo.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !openbsd

package hostutil

import (
Expand Down Expand Up @@ -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.
//
Expand Down
17 changes: 17 additions & 0 deletions helper/hostutil/hostinfo_error.go
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions helper/hostutil/hostinfo_openbsd.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 3e97f5c

Please sign in to comment.