mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-04 04:38:04 +08:00
Merge pull request #576 from GLYASAI/issue-#554
[FIX] node uuid is null
This commit is contained in:
commit
27dba89b95
@ -57,7 +57,7 @@ func RunNodeInstallCmd(option NodeInstallOption) (err error) {
|
||||
if err := preCheckNodeInstall(&option); err != nil {
|
||||
return err
|
||||
}
|
||||
line := fmt.Sprintf("%s -r %s -i %s -t %s -k %s -u %s",
|
||||
line := fmt.Sprintf("'%s' -r '%s' -i '%s' -t '%s' -k '%s' -u '%s'",
|
||||
installNodeShellPath, option.HostRole, option.InternalIP, option.linkModel, option.loginValue, option.NodeID)
|
||||
cmd := exec.Command("bash", "-c", line)
|
||||
cmd.Stdin = option.Stdin
|
||||
|
32
util/ansible/node_test.go
Normal file
32
util/ansible/node_test.go
Normal file
@ -0,0 +1,32 @@
|
||||
package ansible
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPreCheckNodeInstall(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
opt *NodeInstallOption
|
||||
wanterr bool
|
||||
}{
|
||||
{
|
||||
name: "empty node id",
|
||||
opt: &NodeInstallOption{
|
||||
HostRole: "host role",
|
||||
InternalIP: "192.168.1.1",
|
||||
RootPass: "root pass",
|
||||
},
|
||||
wanterr: true,
|
||||
},
|
||||
}
|
||||
|
||||
for idx := range tests {
|
||||
tc := tests[idx]
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if err := preCheckNodeInstall(tc.opt); (err != nil) != tc.wanterr {
|
||||
t.Errorf("want error: %v, but got %v", tc.wanterr, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user