Merge pull request #3041 from hashicorp/b-3036-update-gopsutil
Update gopsutil to stop calling SetEnv
This commit is contained in:
commit
14bae424e1
|
@ -27,6 +27,7 @@ BUG FIXES:
|
|||
[GH-2939]
|
||||
* cli: Fix autocmpleting global flags [GH-2928]
|
||||
* cli: Fix panic when using 0.6.0 cli with an older cluster [GH-2929]
|
||||
* client: Fix `LC_ALL=C` being set on subprocesses [GH-3041]
|
||||
* deployment: Fix alloc health with services/checks using interpolation
|
||||
[GH-2984]
|
||||
* discovery: Fix timeout validation for script checks [GH-3022]
|
||||
|
|
4
vendor/github.com/shirou/gopsutil/Makefile
generated
vendored
4
vendor/github.com/shirou/gopsutil/Makefile
generated
vendored
|
@ -20,7 +20,7 @@ build_test: ## test only buildable
|
|||
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=windows go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
# Operating systems supported for building only (not implemented error if used)
|
||||
GOOS=dragonfly go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=netbsd go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=solaris go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
# GOOS=dragonfly go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
GOOS=netbsd go test ./... | $(BUILD_FAIL_PATTERN)
|
||||
@echo 'Successfully built on all known operating systems'
|
||||
|
|
2
vendor/github.com/shirou/gopsutil/disk/disk_fallback.go
generated
vendored
2
vendor/github.com/shirou/gopsutil/disk/disk_fallback.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// +build !darwin,!linux,!freebsd,!openbsd,!windows
|
||||
// +build !darwin,!linux,!freebsd,!openbsd,!windows,!solaris
|
||||
|
||||
package disk
|
||||
|
||||
|
|
10
vendor/github.com/shirou/gopsutil/host/host_darwin.go
generated
vendored
10
vendor/github.com/shirou/gopsutil/host/host_darwin.go
generated
vendored
|
@ -181,8 +181,10 @@ func PlatformInformation() (string, string, string, error) {
|
|||
}
|
||||
|
||||
func Virtualization() (string, string, error) {
|
||||
system := ""
|
||||
role := ""
|
||||
|
||||
return system, role, nil
|
||||
return "", "", common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func KernelVersion() (string, error) {
|
||||
_, _, version, err := PlatformInformation()
|
||||
return version, err
|
||||
}
|
||||
|
|
8
vendor/github.com/shirou/gopsutil/host/host_fallback.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/host/host_fallback.go
generated
vendored
|
@ -19,3 +19,11 @@ func Uptime() (uint64, error) {
|
|||
func Users() ([]UserStat, error) {
|
||||
return []UserStat{}, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func Virtualization() (string, string, error) {
|
||||
return "", "", common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func KernelVersion() (string, error) {
|
||||
return "", common.ErrNotImplementedError
|
||||
}
|
||||
|
|
10
vendor/github.com/shirou/gopsutil/host/host_freebsd.go
generated
vendored
10
vendor/github.com/shirou/gopsutil/host/host_freebsd.go
generated
vendored
|
@ -174,10 +174,7 @@ func PlatformInformation() (string, string, string, error) {
|
|||
}
|
||||
|
||||
func Virtualization() (string, string, error) {
|
||||
system := ""
|
||||
role := ""
|
||||
|
||||
return system, role, nil
|
||||
return "", "", common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
// before 9.0
|
||||
|
@ -222,3 +219,8 @@ func getUsersFromUtmp(utmpfile string) ([]UserStat, error) {
|
|||
func SensorsTemperatures() ([]TemperatureStat, error) {
|
||||
return []TemperatureStat{}, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func KernelVersion() (string, error) {
|
||||
_, _, version, err := PlatformInformation()
|
||||
return version, err
|
||||
}
|
||||
|
|
10
vendor/github.com/shirou/gopsutil/host/host_openbsd.go
generated
vendored
10
vendor/github.com/shirou/gopsutil/host/host_openbsd.go
generated
vendored
|
@ -110,10 +110,7 @@ func PlatformInformation() (string, string, string, error) {
|
|||
}
|
||||
|
||||
func Virtualization() (string, string, error) {
|
||||
system := ""
|
||||
role := ""
|
||||
|
||||
return system, role, nil
|
||||
return "", "", common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func Users() ([]UserStat, error) {
|
||||
|
@ -158,3 +155,8 @@ func Users() ([]UserStat, error) {
|
|||
func SensorsTemperatures() ([]TemperatureStat, error) {
|
||||
return []TemperatureStat{}, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func KernelVersion() (string, error) {
|
||||
_, _, version, err := PlatformInformation()
|
||||
return version, err
|
||||
}
|
||||
|
|
68
vendor/github.com/shirou/gopsutil/host/host_solaris.go
generated
vendored
68
vendor/github.com/shirou/gopsutil/host/host_solaris.go
generated
vendored
|
@ -2,6 +2,7 @@ package host
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
@ -76,6 +77,50 @@ func Info() (*InfoStat, error) {
|
|||
}
|
||||
}
|
||||
|
||||
switch result.Platform {
|
||||
case "SmartOS":
|
||||
// If everything works, use the current zone ID as the HostID if present.
|
||||
zonename, err := exec.LookPath("/usr/bin/zonename")
|
||||
if err == nil {
|
||||
out, err := invoke.Command(zonename)
|
||||
if err == nil {
|
||||
sc := bufio.NewScanner(bytes.NewReader(out))
|
||||
for sc.Scan() {
|
||||
line := sc.Text()
|
||||
|
||||
// If we're in the global zone, rely on the hostname.
|
||||
if line == "global" {
|
||||
hostname, err := os.Hostname()
|
||||
if err == nil {
|
||||
result.HostID = hostname
|
||||
}
|
||||
} else {
|
||||
result.HostID = strings.TrimSpace(line)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If HostID is still empty, use hostid(1), which can lie to callers but at
|
||||
// this point there are no hardware facilities available. This behavior
|
||||
// matches that of other supported OSes.
|
||||
if result.HostID == "" {
|
||||
hostID, err := exec.LookPath("/usr/bin/hostid")
|
||||
if err == nil {
|
||||
out, err := invoke.Command(hostID)
|
||||
if err == nil {
|
||||
sc := bufio.NewScanner(bytes.NewReader(out))
|
||||
for sc.Scan() {
|
||||
line := sc.Text()
|
||||
result.HostID = strings.TrimSpace(line)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find the boot time and calculate uptime relative to it
|
||||
bootTime, err := BootTime()
|
||||
if err != nil {
|
||||
|
@ -134,3 +179,26 @@ func Users() ([]UserStat, error) {
|
|||
func SensorsTemperatures() ([]TemperatureStat, error) {
|
||||
return []TemperatureStat{}, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func Virtualization() (string, string, error) {
|
||||
return "", "", common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func KernelVersion() (string, error) {
|
||||
// Parse versions from output of `uname(1)`
|
||||
uname, err := exec.LookPath("/usr/bin/uname")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
out, err := invoke.Command(uname, "-srv")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
fields := strings.Fields(string(out))
|
||||
if len(fields) >= 2 {
|
||||
return fields[1], nil
|
||||
}
|
||||
return "", fmt.Errorf("could not get kernel version")
|
||||
}
|
||||
|
|
9
vendor/github.com/shirou/gopsutil/host/host_windows.go
generated
vendored
9
vendor/github.com/shirou/gopsutil/host/host_windows.go
generated
vendored
|
@ -188,3 +188,12 @@ func Users() ([]UserStat, error) {
|
|||
func SensorsTemperatures() ([]TemperatureStat, error) {
|
||||
return []TemperatureStat{}, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func Virtualization() (string, string, error) {
|
||||
return "", "", common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
func KernelVersion() (string, error) {
|
||||
_, _, version, err := PlatformInformation()
|
||||
return version, err
|
||||
}
|
||||
|
|
16
vendor/github.com/shirou/gopsutil/internal/common/common.go
generated
vendored
16
vendor/github.com/shirou/gopsutil/internal/common/common.go
generated
vendored
|
@ -358,3 +358,19 @@ func Pipeline(cmds ...*exec.Cmd) ([]byte, []byte, error) {
|
|||
// Return the pipeline output and the collected standard error
|
||||
return output.Bytes(), stderr.Bytes(), nil
|
||||
}
|
||||
|
||||
// getSysctrlEnv sets LC_ALL=C in a list of env vars for use when running
|
||||
// sysctl commands (see DoSysctrl).
|
||||
func getSysctrlEnv(env []string) []string {
|
||||
foundLC := false
|
||||
for i, line := range env {
|
||||
if strings.HasPrefix(line, "LC_ALL") {
|
||||
env[i] = "LC_ALL=C"
|
||||
foundLC = true
|
||||
}
|
||||
}
|
||||
if !foundLC {
|
||||
env = append(env, "LC_ALL=C")
|
||||
}
|
||||
return env
|
||||
}
|
||||
|
|
9
vendor/github.com/shirou/gopsutil/internal/common/common_darwin.go
generated
vendored
9
vendor/github.com/shirou/gopsutil/internal/common/common_darwin.go
generated
vendored
|
@ -12,16 +12,13 @@ import (
|
|||
)
|
||||
|
||||
func DoSysctrl(mib string) ([]string, error) {
|
||||
err := os.Setenv("LC_ALL", "C")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
||||
sysctl, err := exec.LookPath("/usr/sbin/sysctl")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
out, err := exec.Command(sysctl, "-n", mib).Output()
|
||||
cmd := exec.Command(sysctl, "-n", mib)
|
||||
cmd.Env = getSysctrlEnv(os.Environ())
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
|
8
vendor/github.com/shirou/gopsutil/internal/common/common_freebsd.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/internal/common/common_freebsd.go
generated
vendored
|
@ -12,15 +12,13 @@ import (
|
|||
)
|
||||
|
||||
func DoSysctrl(mib string) ([]string, error) {
|
||||
err := os.Setenv("LC_ALL", "C")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
sysctl, err := exec.LookPath("/sbin/sysctl")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
out, err := exec.Command(sysctl, "-n", mib).Output()
|
||||
cmd := exec.Command(sysctl, "-n", mib)
|
||||
cmd.Env = getSysctrlEnv(os.Environ())
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
|
8
vendor/github.com/shirou/gopsutil/internal/common/common_linux.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/internal/common/common_linux.go
generated
vendored
|
@ -9,15 +9,13 @@ import (
|
|||
)
|
||||
|
||||
func DoSysctrl(mib string) ([]string, error) {
|
||||
err := os.Setenv("LC_ALL", "C")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
sysctl, err := exec.LookPath("/sbin/sysctl")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
out, err := exec.Command(sysctl, "-n", mib).Output()
|
||||
cmd := exec.Command(sysctl, "-n", mib)
|
||||
cmd.Env = getSysctrlEnv(os.Environ())
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
|
8
vendor/github.com/shirou/gopsutil/internal/common/common_openbsd.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/internal/common/common_openbsd.go
generated
vendored
|
@ -12,15 +12,13 @@ import (
|
|||
)
|
||||
|
||||
func DoSysctrl(mib string) ([]string, error) {
|
||||
err := os.Setenv("LC_ALL", "C")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
sysctl, err := exec.LookPath("/sbin/sysctl")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
out, err := exec.Command(sysctl, "-n", mib).Output()
|
||||
cmd := exec.Command(sysctl, "-n", mib)
|
||||
cmd.Env = getSysctrlEnv(os.Environ())
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
|
19
vendor/github.com/shirou/gopsutil/process/process_linux.go
generated
vendored
19
vendor/github.com/shirou/gopsutil/process/process_linux.go
generated
vendored
|
@ -219,8 +219,8 @@ func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) {
|
|||
|
||||
// NumFDs returns the number of File Descriptors used by the process.
|
||||
func (p *Process) NumFDs() (int32, error) {
|
||||
numFds, _, err := p.fillFromfd()
|
||||
return numFds, err
|
||||
_, fnames, err := p.fillFromfdList()
|
||||
return int32(len(fnames)), err
|
||||
}
|
||||
|
||||
// NumThreads returns the number of threads used by the process.
|
||||
|
@ -514,16 +514,25 @@ func (p *Process) fillFromLimits() ([]RlimitStat, error) {
|
|||
return limitStats, nil
|
||||
}
|
||||
|
||||
// Get num_fds from /proc/(pid)/fd
|
||||
func (p *Process) fillFromfd() (int32, []*OpenFilesStat, error) {
|
||||
// Get list of /proc/(pid)/fd files
|
||||
func (p *Process) fillFromfdList() (string, []string, error) {
|
||||
pid := p.Pid
|
||||
statPath := common.HostProc(strconv.Itoa(int(pid)), "fd")
|
||||
d, err := os.Open(statPath)
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
return statPath, []string{}, err
|
||||
}
|
||||
defer d.Close()
|
||||
fnames, err := d.Readdirnames(-1)
|
||||
return statPath, fnames, err
|
||||
}
|
||||
|
||||
// Get num_fds from /proc/(pid)/fd
|
||||
func (p *Process) fillFromfd() (int32, []*OpenFilesStat, error) {
|
||||
statPath, fnames, err := p.fillFromfdList()
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
numFDs := int32(len(fnames))
|
||||
|
||||
var openfiles []*OpenFilesStat
|
||||
|
|
42
vendor/vendor.json
vendored
42
vendor/vendor.json
vendored
|
@ -1152,52 +1152,52 @@
|
|||
"revisionTime": "2016-04-29T17:20:22Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "E46Dj2ZLd5acESd5H2eJFUXWvOk=",
|
||||
"checksumSHA1": "Hb1sfQh9zulWvKHq1eJB/Egteuc=",
|
||||
"path": "github.com/shirou/gopsutil",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "565f5c8c5e5f8cf2f8a92cf9375f2f1c0e3ea034",
|
||||
"revisionTime": "2017-08-16T21:54:50Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "T2ThCk35wXAZGh37nrgA07199dA=",
|
||||
"path": "github.com/shirou/gopsutil/cpu",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "1c211f0807a3436707409fa313599dd8c7a48664",
|
||||
"revisionTime": "2017-08-17T03:45:37Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "MHee+YeuZOzzMIUPVPgXnWgH3jI=",
|
||||
"checksumSHA1": "T4uyVXPqCS5rj4vYLgv04as0Avw=",
|
||||
"path": "github.com/shirou/gopsutil/disk",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "1c211f0807a3436707409fa313599dd8c7a48664",
|
||||
"revisionTime": "2017-08-17T03:45:37Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "G8v/DPfSDCCVGLVwLzDul6Jt5Oc=",
|
||||
"checksumSHA1": "YBXpUckp1TtJf2mfMLx/bpnm22Q=",
|
||||
"path": "github.com/shirou/gopsutil/host",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "1c211f0807a3436707409fa313599dd8c7a48664",
|
||||
"revisionTime": "2017-08-17T03:45:37Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "YfGdUgCoLdHBhfG+kXczYXu/rKk=",
|
||||
"checksumSHA1": "jUWM0P4G1bHpO9CPS8gcr4rt1t0=",
|
||||
"path": "github.com/shirou/gopsutil/internal/common",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "1c211f0807a3436707409fa313599dd8c7a48664",
|
||||
"revisionTime": "2017-08-17T03:45:37Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "xIAuacHA0LNq1yM5Wd1q4lnbzxU=",
|
||||
"path": "github.com/shirou/gopsutil/mem",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "1c211f0807a3436707409fa313599dd8c7a48664",
|
||||
"revisionTime": "2017-08-17T03:45:37Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "moxD+mq0dMHnbTeFyeEHK0Iq7i8=",
|
||||
"path": "github.com/shirou/gopsutil/net",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "1c211f0807a3436707409fa313599dd8c7a48664",
|
||||
"revisionTime": "2017-08-17T03:45:37Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "BbMfjHQ8vWKK4mJb8nj5guX7dgw=",
|
||||
"checksumSHA1": "C6ybAAUmWz+PQKqJ8byV7Nj5JXQ=",
|
||||
"path": "github.com/shirou/gopsutil/process",
|
||||
"revision": "42b5d5abb29c3033399cd15ef34104715ea487fc",
|
||||
"revisionTime": "2017-07-28T02:04:42Z"
|
||||
"revision": "1c211f0807a3436707409fa313599dd8c7a48664",
|
||||
"revisionTime": "2017-08-17T03:45:37Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Nve7SpDmjsv6+rhkXAkfg/UQx94=",
|
||||
|
|
Loading…
Reference in a new issue