mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
[FIX] fix bug
This commit is contained in:
parent
4a082735f8
commit
59c7a7ccd7
@ -34,7 +34,6 @@ import (
|
||||
"github.com/goodrain/rainbond/node/utils"
|
||||
"github.com/twinj/uuid"
|
||||
"os/exec"
|
||||
"os"
|
||||
"bytes"
|
||||
)
|
||||
|
||||
@ -99,37 +98,19 @@ func (n *NodeService) AddNode(node *client.APIHostNode) *utils.APIHandleError {
|
||||
line := fmt.Sprintf("cd /opt/rainbond/install/scripts; ./%s.sh %s %s %s %s %s", node.Role, node.HostName,
|
||||
node.InternalIP, linkModel, node.RootPass, node.Privatekey)
|
||||
cmd := exec.Command("bash", "-c", line)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
fmt.Println(line)
|
||||
fmt.Println("==================================================start")
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
fmt.Println("==========1.1")
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
fmt.Println("==========1.2")
|
||||
logrus.Error("=====1.3",err)
|
||||
errStr := string(stderr.Bytes())
|
||||
logrus.Error(errStr)
|
||||
fmt.Println("============>", errStr)
|
||||
return utils.CreateAPIHandleError(400, fmt.Errorf(errStr))
|
||||
}
|
||||
fmt.Println("==========1.4")
|
||||
fmt.Println("==========>", string(stdout.Bytes()))
|
||||
logrus.Info("Add node successful, next you can:")
|
||||
logrus.Info("check cluster status: grctl node list")
|
||||
fmt.Println("==========>end")
|
||||
|
||||
//rbnode := node.Clone()
|
||||
//rbnode.CreateTime = time.Now()
|
||||
//rbnode.NodeStatus.Conditions = make([]client.NodeCondition, 0)
|
||||
//if _, err := rbnode.Update(); err != nil {
|
||||
// return utils.CreateAPIHandleErrorFromDBError("save node", err)
|
||||
//}
|
||||
////Determine if the node needs to be installed.
|
||||
//n.nodecluster.CheckNodeInstall(rbnode)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user