mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-05-07 22:24:32 +08:00
fix: fixed on merge Input json
This commit is contained in:
@@ -213,13 +213,29 @@ func mergeInputOutputData(data *jsonutils.JSONDict, resVal reflect.Value) *jsonu
|
||||
jsonMap, _ := retJson.GetMap()
|
||||
for k, v := range jsonMap {
|
||||
if output.Contains(k) {
|
||||
if v == jsonutils.JSONNull || v.IsZero() {
|
||||
if v == jsonutils.JSONNull {
|
||||
output.Remove(k)
|
||||
} else if !v.IsZero() {
|
||||
output.Set(k, v)
|
||||
} else {
|
||||
switch v.(type) {
|
||||
case *jsonutils.JSONString:
|
||||
if v.IsZero() {
|
||||
output.Remove(k)
|
||||
} else {
|
||||
output.Set(k, v)
|
||||
}
|
||||
default:
|
||||
output.Set(k, v)
|
||||
}
|
||||
}
|
||||
} else if v != jsonutils.JSONNull {
|
||||
switch v.(type) {
|
||||
case *jsonutils.JSONString:
|
||||
if !v.IsZero() {
|
||||
output.Add(v, k)
|
||||
}
|
||||
default:
|
||||
output.Add(v, k)
|
||||
}
|
||||
} else if !v.IsZero() {
|
||||
output.Add(v, k)
|
||||
}
|
||||
}
|
||||
log.Debugf("output: %s", output)
|
||||
|
||||
@@ -24,11 +24,9 @@ import (
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
|
||||
identityapi "yunion.io/x/onecloud/pkg/apis/identity"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/types"
|
||||
guestman "yunion.io/x/onecloud/pkg/hostman/guestman/types"
|
||||
"yunion.io/x/onecloud/pkg/hostman/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
"yunion.io/x/onecloud/pkg/util/dhcp"
|
||||
"yunion.io/x/onecloud/pkg/util/netutils2"
|
||||
)
|
||||
@@ -143,7 +141,7 @@ func (s *SGuestDHCPServer) getGuestConfig(guestDesc, guestNic jsonutils.JSONObje
|
||||
}
|
||||
}
|
||||
|
||||
if len(nicdesc.NTPServers) > 0 {
|
||||
if len(nicdesc.Ntp) > 0 {
|
||||
conf.NTPServers = make([]net.IP, 0)
|
||||
for _, ntp := range strings.Split(nicdesc.Ntp, ",") {
|
||||
conf.NTPServers = append(conf.NTPServers, net.ParseIP(ntp))
|
||||
|
||||
@@ -17,7 +17,6 @@ package ovn
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -28,7 +27,6 @@ import (
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
apis "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
identityapi "yunion.io/x/onecloud/pkg/apis/identity"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
agentmodels "yunion.io/x/onecloud/pkg/vpcagent/models"
|
||||
"yunion.io/x/onecloud/pkg/vpcagent/options"
|
||||
|
||||
Reference in New Issue
Block a user