mirror of https://gerrit.hackerspace.pl/hscloud
statusz: fix executable sha256
parent
f311e26c93
commit
8fab2beab9
|
@ -251,14 +251,6 @@
|
||||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||||
version = "v0.8.0"
|
version = "v0.8.0"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:a7cc4447e0c2432f217fd2bed937c100ec475272a7a9306477170c2934297357"
|
|
||||||
name = "github.com/q3k/statusz"
|
|
||||||
packages = ["."]
|
|
||||||
pruneopts = "UT"
|
|
||||||
revision = "924f04ea71149b75f5b10f426cc4c39d6d90f6f2"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:8f042d4b4c48d38d7a1201096299bd26d044c97c032ab20ee171fe5b0d201d2e"
|
digest = "1:8f042d4b4c48d38d7a1201096299bd26d044c97c032ab20ee171fe5b0d201d2e"
|
||||||
|
@ -436,7 +428,7 @@
|
||||||
"github.com/golang/glog",
|
"github.com/golang/glog",
|
||||||
"github.com/golang/protobuf/proto",
|
"github.com/golang/protobuf/proto",
|
||||||
"github.com/golang/protobuf/protoc-gen-go",
|
"github.com/golang/protobuf/protoc-gen-go",
|
||||||
"github.com/q3k/statusz",
|
"github.com/shirou/gopsutil/load",
|
||||||
"github.com/ybbus/jsonrpc",
|
"github.com/ybbus/jsonrpc",
|
||||||
"github.com/ziutek/telnet",
|
"github.com/ziutek/telnet",
|
||||||
"golang.org/x/net/context",
|
"golang.org/x/net/context",
|
||||||
|
|
|
@ -46,10 +46,6 @@ required = ["github.com/golang/protobuf/protoc-gen-go", "github.com/gobuffalo/pa
|
||||||
name = "github.com/golang/protobuf"
|
name = "github.com/golang/protobuf"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/q3k/statusz"
|
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/ybbus/jsonrpc"
|
name = "github.com/ybbus/jsonrpc"
|
||||||
version = "2.1.2"
|
version = "2.1.2"
|
||||||
|
|
|
@ -49,6 +49,6 @@ The following flags are automatically registered:
|
||||||
|
|
||||||
The following debug HTTP handlers are installed:
|
The following debug HTTP handlers are installed:
|
||||||
|
|
||||||
- `/debug/status`: show the [statusz](https://github.com/q3k/statusz) page
|
- `/debug/status`: show the statusz page
|
||||||
- `/debug/requests`: show the [net/trace](https://godoc.org/golang.org/x/net/trace) page (including gRPC traces)
|
- `/debug/requests`: show the [net/trace](https://godoc.org/golang.org/x/net/trace) page (including gRPC traces)
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.hackerspace.pl/hscloud/go/pki"
|
"code.hackerspace.pl/hscloud/go/pki"
|
||||||
|
"code.hackerspace.pl/hscloud/go/statusz"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/q3k/statusz"
|
|
||||||
"golang.org/x/net/trace"
|
"golang.org/x/net/trace"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
|
|
|
@ -10,7 +10,7 @@ For the basic status page, just include the module.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
_ "github.com/q3k/statusz"
|
_ "code.hackerspace.pl/hscloud/go/statusz"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -25,7 +25,7 @@ To add a section to the status page, call `AddStatusSection` like so:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
statusz "github.com/q3k/statusz"
|
"code.hackerspace.pl/hscloud/go/statusz"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -178,15 +178,23 @@ func init() {
|
||||||
}
|
}
|
||||||
username = fmt.Sprintf("%s (%s)", user.Username, user.Uid)
|
username = fmt.Sprintf("%s (%s)", user.Username, user.Uid)
|
||||||
|
|
||||||
f, err := os.Open(os.Args[0])
|
exec, err := os.Executable()
|
||||||
if err != nil {
|
if err == nil {
|
||||||
glog.Fatalf("os.Open(%q): %v", os.Args[0], err)
|
f, err := os.Open(exec)
|
||||||
}
|
if err == nil {
|
||||||
h := sha256.New()
|
h := sha256.New()
|
||||||
if _, err := io.Copy(h, f); err != nil {
|
if _, err := io.Copy(h, f); err != nil {
|
||||||
glog.Fatalf("io.Copy: %v", err)
|
glog.Fatalf("io.Copy: %v", err)
|
||||||
}
|
}
|
||||||
binaryHash = fmt.Sprintf("%x", h.Sum(nil))
|
binaryHash = fmt.Sprintf("%x", h.Sum(nil))
|
||||||
|
} else {
|
||||||
|
glog.Errorf("Could not get SHA256 of binary: os.Open(%q): %v", exec, err)
|
||||||
|
binaryHash = "could not read executable"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
glog.Errorf("Could not get SHA256 of binary: os.Executable(): %v", err)
|
||||||
|
binaryHash = "could not get executable"
|
||||||
|
}
|
||||||
|
|
||||||
if DefaultMux {
|
if DefaultMux {
|
||||||
http.HandleFunc("/debug/status", StatusHandler)
|
http.HandleFunc("/debug/status", StatusHandler)
|
||||||
|
|
|
@ -8,14 +8,12 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.hackerspace.pl/hscloud/go/mirko"
|
"code.hackerspace.pl/hscloud/go/mirko"
|
||||||
"github.com/gobuffalo/packr"
|
ipb "code.hackerspace.pl/hscloud/go/proto/infra"
|
||||||
"github.com/q3k/statusz"
|
"code.hackerspace.pl/hscloud/go/statusz"
|
||||||
"vbom.ml/util/sortorder"
|
|
||||||
|
|
||||||
"code.hackerspace.pl/hscloud/go/svc/topo/graph"
|
"code.hackerspace.pl/hscloud/go/svc/topo/graph"
|
||||||
"code.hackerspace.pl/hscloud/go/svc/topo/state"
|
"code.hackerspace.pl/hscloud/go/svc/topo/state"
|
||||||
|
"github.com/gobuffalo/packr"
|
||||||
ipb "code.hackerspace.pl/hscloud/go/proto/infra"
|
"vbom.ml/util/sortorder"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
|
|
Loading…
Reference in New Issue