Commit f692d5aa authored by szh's avatar szh

up

parent 629a4038
......@@ -42,7 +42,7 @@ type updateInfo struct {
type Server struct {
Disks []*pai.Disk `json:"disks"` //硬盘信息
NodeProcesssInfo ProcessInfo `json:"node_processs_info"` //节点信息
NodeProcessInfo ProcessInfo `json:"node_process_info"` //节点信息
Error string `json:"error"` //错误信息
}
......@@ -101,14 +101,14 @@ func getWalletInfo() error {
if buffer.String() == "" {
tlog.Info("node dose not exist")
return fmt.Errorf("node dose not exist")
} else {
fmt.Println(buffer.String())
rawProcessInfo = getProcessInfo(setting.BityuanSetting.Name)
if rawProcessInfo == "" {
tlog.Info("node down")
return errors.New("node down")
}
}
fmt.Println(buffer.String())
rawProcessInfo = getProcessInfo(setting.BityuanSetting.Name)
if rawProcessInfo == "" {
tlog.Info("node down")
return errors.New("node down")
}
}
record := StrFilter(strings.Split(rawProcessInfo, " "), "")
......@@ -117,7 +117,7 @@ func getWalletInfo() error {
Bityuan.Pid = record[1]
Bityuan.Path = record[10]
Bityuan.PName = path.Base(Bityuan.Path)
ServerStatus.NodeProcesssInfo = Bityuan
ServerStatus.NodeProcessInfo = Bityuan
}
return nil
}
......@@ -384,7 +384,7 @@ func Unlock() error {
}
pass := strings.Replace(string(passwd), "\n", "", -1)
reply, err := setting.PaiClient.Unlock(&types.WalletUnLock{
Passwd: string(pass),
Passwd: pass,
Timeout: 0,
WalletOrTicket: false,
XXX_NoUnkeyedLiteral: struct{}{},
......@@ -470,17 +470,17 @@ func AutoSSHClean() error {
tlog.Info("getAutoSSHProcessInfo", "pai", *pai)
if pai.Stime > 0 && (time.Now().Unix()-pai.Stime) > 72*3600 && pai.Pid > 0 {
err := KillAutoSsh(pai.Pid)
err := KillAutoSSH(pai.Pid)
if err != nil {
tlog.Error("KillAutoSsh", "err", err)
tlog.Error("KillAutoSSH", "err", err)
return err
}
tlog.Info("KillAutoSsh Success", "pid", pai.Pid)
tlog.Info("KillAutoSSH Success", "pid", pai.Pid)
}
return nil
}
func KillAutoSsh(pid int32) error {
func KillAutoSSH(pid int32) error {
ps := fmt.Sprintf("%d", pid)
cmd := exec.Command("kill", ps)
return cmd.Run()
......
......@@ -28,7 +28,7 @@ func GetLocalArchType() string {
return ""
}
func GetLocalUuid() string {
func GetLocalUUID() string {
cmd := exec.Command("dmidecode")
var buf, errbuf bytes.Buffer
cmd.Stdout = &buf
......
......@@ -36,7 +36,7 @@ func CheckPermission(src string) bool {
// IsNotExistMkDir create a directory if it does not exist
func IsNotExistMkDir(src string) error {
if notExist := CheckNotExist(src); notExist == true {
if notExist := CheckNotExist(src); notExist {
if err := MkDir(src); err != nil {
return err
}
......@@ -74,7 +74,7 @@ func MustOpen(fileName, filePath string) (*os.File, error) {
src := dir + "/" + filePath
perm := CheckPermission(src)
if perm == true {
if perm {
return nil, fmt.Errorf("file.CheckPermission Permission denied src: %s", src)
}
......
......@@ -105,7 +105,7 @@ func (p *Pai) GetConfig() bool {
return true
}
} else if pai.GetArchType() == "x86_64" {
uuid := cmd.GetLocalUuid()
uuid := cmd.GetLocalUUID()
if uuid != "" {
p.Serial = uuid
return true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment