mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
PT-51 Changed html/template by text/template
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/kylelemons/godebug/pretty"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -69,7 +68,7 @@ func checkUpdates(url string, timeout time.Duration, toolName, version string) (
|
||||
return "", err
|
||||
}
|
||||
|
||||
log.Debug(pretty.Sprint(resp))
|
||||
log.Debug(resp.Status)
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@@ -3,13 +3,14 @@ package main
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/howeyc/gopass"
|
||||
"github.com/kylelemons/godebug/pretty"
|
||||
"github.com/montanaflynn/stats"
|
||||
"github.com/pborman/getopt"
|
||||
"github.com/percona/percona-toolkit/src/go/lib/config"
|
||||
@@ -351,7 +352,11 @@ func getData(i iter) []stat {
|
||||
var doc proto.SystemProfile
|
||||
stats := make(map[groupKey]*stat)
|
||||
|
||||
log.Debug(`Documents returned by db.getSiblinfDB("<dbnamehere>").system.profile.Find({"op": {"$nin": []string{"getmore", "delete"}}).Sort("-$natural")`)
|
||||
|
||||
for i.Next(&doc) && i.Err() == nil {
|
||||
log.Debugln("----------------------------------------------------------------------------")
|
||||
log.Debug(pretty.Sprint(doc))
|
||||
if len(doc.Query) > 0 {
|
||||
query := doc.Query
|
||||
if squery, ok := doc.Query["$query"]; ok {
|
||||
|
@@ -2,9 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"os"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/howeyc/gopass"
|
||||
@@ -191,6 +191,7 @@ func main() {
|
||||
dialer := pmgo.NewDialer()
|
||||
|
||||
hostnames, err := getHostnames(dialer, di)
|
||||
log.Debugf("hostnames: %v", hostnames)
|
||||
|
||||
session, err := dialer.DialWithInfo(di)
|
||||
if err != nil {
|
||||
@@ -202,6 +203,7 @@ func main() {
|
||||
if replicaMembers, err := GetReplicasetMembers(dialer, hostnames, di); err != nil {
|
||||
log.Printf("[Error] cannot get replicaset members: %v\n", err)
|
||||
} else {
|
||||
log.Debugf("replicaMembers:\n%+v\n", replicaMembers)
|
||||
t := template.Must(template.New("replicas").Parse(templates.Replicas))
|
||||
t.Execute(os.Stdout, replicaMembers)
|
||||
}
|
||||
@@ -210,6 +212,7 @@ func main() {
|
||||
if hostInfo, err := GetHostinfo(session); err != nil {
|
||||
log.Printf("[Error] cannot get host info: %v\n", err)
|
||||
} else {
|
||||
log.Debugf("hostInfo:\n%+v\n", hostInfo)
|
||||
t := template.Must(template.New("hosttemplateData").Parse(templates.HostInfo))
|
||||
t.Execute(os.Stdout, hostInfo)
|
||||
}
|
||||
|
Reference in New Issue
Block a user