4.6.1
This commit is contained in:
@@ -71,16 +71,16 @@ func resourceLBCreate(ctx context.Context, d *schema.ResourceData, m interface{}
|
||||
req.HighlyAvailable = haMode.(bool)
|
||||
}
|
||||
if sysctlParams, ok := d.GetOk("sysctl_params"); ok {
|
||||
syscrlSliceMaps := sysctlParams.([]map[string]string)
|
||||
syscrlSliceMaps := sysctlParams.([]interface{})
|
||||
res := make([]map[string]interface{}, 0, len(syscrlSliceMaps))
|
||||
for _, syscrlMap := range syscrlSliceMaps {
|
||||
tempMap := make(map[string]interface{})
|
||||
for k, v := range syscrlMap {
|
||||
if intVal, err := strconv.Atoi(v); err == nil {
|
||||
for k, v := range syscrlMap.(map[string]interface{}) {
|
||||
if intVal, err := strconv.Atoi(v.(string)); err == nil {
|
||||
tempMap[k] = intVal
|
||||
continue
|
||||
}
|
||||
tempMap[k] = v
|
||||
tempMap[k] = v.(string)
|
||||
}
|
||||
res = append(res, tempMap)
|
||||
}
|
||||
@@ -349,26 +349,28 @@ func resourceLbEnable(ctx context.Context, lbId uint64, m interface{}) error {
|
||||
func resourceLbChangeSysctlParams(ctx context.Context, d *schema.ResourceData, lbId uint64, m interface{}) error {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
syscrlSliceMaps := d.Get("sysctl_params").([]map[string]string)
|
||||
syscrlSliceMaps := d.Get("sysctl_params").([]interface{})
|
||||
res := make([]map[string]interface{}, 0, len(syscrlSliceMaps))
|
||||
for _, syscrlMap := range syscrlSliceMaps {
|
||||
tempMap := make(map[string]interface{})
|
||||
for k, v := range syscrlMap {
|
||||
if intVal, err := strconv.Atoi(v); err == nil {
|
||||
for k, v := range syscrlMap.(map[string]interface{}) {
|
||||
if intVal, err := strconv.Atoi(v.(string)); err == nil {
|
||||
tempMap[k] = intVal
|
||||
continue
|
||||
}
|
||||
tempMap[k] = v
|
||||
tempMap[k] = v.(string)
|
||||
}
|
||||
res = append(res, tempMap)
|
||||
}
|
||||
|
||||
req := lb.UpdateSysctParamsRequest{
|
||||
LBID: lbId,
|
||||
SysctlParams: res,
|
||||
if len(res) > 0 {
|
||||
req := lb.UpdateSysctParamsRequest{
|
||||
LBID: lbId,
|
||||
SysctlParams: res,
|
||||
}
|
||||
_, err := c.CloudBroker().LB().UpdateSysctlParams(ctx, req)
|
||||
return err
|
||||
}
|
||||
_, err := c.CloudBroker().LB().UpdateSysctlParams(ctx, req)
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceLbDisable(ctx context.Context, lbId uint64, m interface{}) error {
|
||||
|
||||
@@ -150,32 +150,32 @@ func resourceLBBackendUpdate(ctx context.Context, d *schema.ResourceData, m inte
|
||||
BackendName: d.Get("name").(string),
|
||||
}
|
||||
|
||||
if d.HasChange("algorithm") {
|
||||
req.Algorithm = d.Get("algorithm").(string)
|
||||
if algorithm, ok := d.GetOk("algorithm"); ok {
|
||||
req.Algorithm = algorithm.(string)
|
||||
}
|
||||
if d.HasChange("inter") {
|
||||
req.Inter = uint64(d.Get("inter").(int))
|
||||
if inter, ok := d.GetOk("inter"); ok {
|
||||
req.Inter = uint64(inter.(int))
|
||||
}
|
||||
if d.HasChange("downinter") {
|
||||
req.DownInter = uint64(d.Get("downinter").(int))
|
||||
if downinter, ok := d.GetOk("downinter"); ok {
|
||||
req.DownInter = uint64(downinter.(int))
|
||||
}
|
||||
if d.HasChange("rise") {
|
||||
req.Rise = uint64(d.Get("rise").(int))
|
||||
if rise, ok := d.GetOk("rise"); ok {
|
||||
req.Rise = uint64(rise.(int))
|
||||
}
|
||||
if d.HasChange("fall") {
|
||||
req.Fall = uint64(d.Get("fall").(int))
|
||||
if fall, ok := d.GetOk("fall"); ok {
|
||||
req.Fall = uint64(fall.(int))
|
||||
}
|
||||
if d.HasChange("slowstart") {
|
||||
req.SlowStart = uint64(d.Get("slowstart").(int))
|
||||
if slowstart, ok := d.GetOk("slowstart"); ok {
|
||||
req.SlowStart = uint64(slowstart.(int))
|
||||
}
|
||||
if d.HasChange("maxconn") {
|
||||
req.MaxConn = uint64(d.Get("maxconn").(int))
|
||||
if maxconn, ok := d.GetOk("maxconn"); ok {
|
||||
req.MaxConn = uint64(maxconn.(int))
|
||||
}
|
||||
if d.HasChange("maxqueue") {
|
||||
req.MaxQueue = uint64(d.Get("maxqueue").(int))
|
||||
if maxqueue, ok := d.GetOk("maxqueue"); ok {
|
||||
req.MaxQueue = uint64(maxqueue.(int))
|
||||
}
|
||||
if d.HasChange("weight") {
|
||||
req.Weight = uint64(d.Get("weight").(int))
|
||||
if weight, ok := d.GetOk("weight"); ok {
|
||||
req.Weight = uint64(weight.(int))
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().LB().BackendUpdate(ctx, req)
|
||||
|
||||
@@ -161,32 +161,32 @@ func resourceLBBackendServerUpdate(ctx context.Context, d *schema.ResourceData,
|
||||
Port: uint64(d.Get("port").(int)),
|
||||
}
|
||||
|
||||
if d.HasChange("check") {
|
||||
req.Check = d.Get("check").(string)
|
||||
if check, ok := d.GetOk("check"); ok {
|
||||
req.Check = check.(string)
|
||||
}
|
||||
if d.HasChange("inter") {
|
||||
req.Inter = uint64(d.Get("inter").(int))
|
||||
if inter, ok := d.GetOk("inter"); ok {
|
||||
req.Inter = uint64(inter.(int))
|
||||
}
|
||||
if d.HasChange("downinter") {
|
||||
req.DownInter = uint64(d.Get("downinter").(int))
|
||||
if downinter, ok := d.GetOk("downinter"); ok {
|
||||
req.DownInter = uint64(downinter.(int))
|
||||
}
|
||||
if d.HasChange("rise") {
|
||||
req.Rise = uint64(d.Get("rise").(int))
|
||||
if rise, ok := d.GetOk("rise"); ok {
|
||||
req.Rise = uint64(rise.(int))
|
||||
}
|
||||
if d.HasChange("fall") {
|
||||
req.Fall = uint64(d.Get("fall").(int))
|
||||
if fall, ok := d.GetOk("fall"); ok {
|
||||
req.Fall = uint64(fall.(int))
|
||||
}
|
||||
if d.HasChange("slowstart") {
|
||||
req.SlowStart = uint64(d.Get("slowstart").(int))
|
||||
if slowstart, ok := d.GetOk("slowstart"); ok {
|
||||
req.SlowStart = uint64(slowstart.(int))
|
||||
}
|
||||
if d.HasChange("maxconn") {
|
||||
req.MaxConn = uint64(d.Get("maxconn").(int))
|
||||
if maxconn, ok := d.GetOk("maxconn"); ok {
|
||||
req.MaxConn = uint64(maxconn.(int))
|
||||
}
|
||||
if d.HasChange("maxqueue") {
|
||||
req.MaxQueue = uint64(d.Get("maxqueue").(int))
|
||||
if maxqueue, ok := d.GetOk("maxqueue"); ok {
|
||||
req.MaxQueue = uint64(maxqueue.(int))
|
||||
}
|
||||
if d.HasChange("weight") {
|
||||
req.Weight = uint64(d.Get("weight").(int))
|
||||
if weight, ok := d.GetOk("weight"); ok {
|
||||
req.Weight = uint64(weight.(int))
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().LB().BackendServerUpdate(ctx, req)
|
||||
|
||||
Reference in New Issue
Block a user