mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #4238 from zexi/bugfix/bm-register
baremetal: fix register input params lost
This commit is contained in:
@@ -88,10 +88,10 @@ func (this *HostManager) GetIpmiInfo(s *mcclient.ClientSession, id string, param
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func parseHosts(titles []string, data string) ([]jsonutils.JSONObject, string) {
|
||||
func parseHosts(titles []string, data string) ([]*jsonutils.JSONDict, string) {
|
||||
msg := ""
|
||||
hosts := strings.Split(data, "\n")
|
||||
ret := []jsonutils.JSONObject{}
|
||||
ret := []*jsonutils.JSONDict{}
|
||||
for i, host := range hosts {
|
||||
host = strings.TrimSpace(host)
|
||||
if len(host) == 0 {
|
||||
@@ -122,6 +122,8 @@ func (this *HostManager) DoBatchRegister(s *mcclient.ClientSession, titles []str
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
input := params.(*jsonutils.JSONDict)
|
||||
input.Remove("hosts")
|
||||
|
||||
hosts, msg := parseHosts(titles, data)
|
||||
if len(msg) > 0 {
|
||||
@@ -130,6 +132,7 @@ func (this *HostManager) DoBatchRegister(s *mcclient.ClientSession, titles []str
|
||||
|
||||
results := make(chan modulebase.SubmitResult, len(hosts))
|
||||
for _, host := range hosts {
|
||||
host.Update(input)
|
||||
go func(data jsonutils.JSONObject) {
|
||||
ret, e := this.Create(s, data)
|
||||
id, _ := data.GetString("access_mac")
|
||||
|
||||
Reference in New Issue
Block a user