Skip to content

Commit

Permalink
treewide: fmt error
Browse files Browse the repository at this point in the history
  • Loading branch information
yousong committed Sep 21, 2020
1 parent 4fb4567 commit 23b9991
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/compute/guestdrivers/qcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (self *SQcloudGuestDriver) ValidateCreateData(ctx context.Context, userCred
return nil, httperrors.NewInputParameterError("The %s disk size must be in the range of 100GB ~ 16000GB", disk.Backend)
}
case api.STORAGE_LOCAL_PRO:
return nil, httperrors.NewInputParameterError("storage %s can not be data disk")
return nil, httperrors.NewInputParameterError("storage %s can not be data disk", disk.Backend)
}
if disk.SizeMb/1024%10 > 0 {
return nil, httperrors.NewInputParameterError("Data disk size must be an integer multiple of 10G")
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/models/cloudaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3080,7 +3080,7 @@ func (self *SCloudaccount) AllowPerformCreateSubscription(ctx context.Context, u
// 创建Azure订阅
func (self *SCloudaccount) PerformCreateSubscription(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.SubscriptonCreateInput) (jsonutils.JSONObject, error) {
if self.Provider != api.CLOUD_PROVIDER_AZURE {
return nil, httperrors.NewNotSupportedError("%s not support create subscription")
return nil, httperrors.NewNotSupportedError("%s not support create subscription", self.Provider)
}
if len(input.Name) == 0 {
return nil, httperrors.NewMissingParameterError("name")
Expand Down
4 changes: 2 additions & 2 deletions pkg/compute/models/dnsrecords.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ func (man *SDnsRecordManager) checkRecordName(typ, name string) error {
}
case "SRV":
if !regutils.MatchDomainSRV(name) {
return httperrors.NewNotAcceptableError("SRV: invalid srv record name: %s", typ, name)
return httperrors.NewNotAcceptableError("SRV: invalid srv record name: %s", name)
}
case "PTR":
if !regutils.MatchPtr(name) {
return httperrors.NewNotAcceptableError("PTR: invalid ptr record name: %s", typ, name)
return httperrors.NewNotAcceptableError("PTR: invalid ptr record name: %s", name)
}
}
if regutils.MatchIPAddr(name) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/models/guest_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func (gt *SGuestTemplate) PerformPublic(
model, err := NetworkManager.FetchByIdOrName(userCred, str)
if err != nil {
return nil, httperrors.NewResourceNotFoundError(
"there is no such secgroup %s descripted by guest template")
"there is no such secgroup %s descripted by guest template", str)
}
network := model.(*SNetwork)
netScope := rbacutils.String2Scope(network.PublicScope)
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/models/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -5421,7 +5421,7 @@ func (host *SHost) PerformSetReservedResourceForIsolatedDevice(
caps := host.GetAttachedLocalStorageCapacity()
if input.ReservedStorage != nil && caps.Capacity < int64(*input.ReservedStorage*len(devs)) {
return nil, httperrors.NewBadRequestError(
"host %s can't reserve %dM storage for each isolated device, not enough")
"host %s can't reserve %dM storage for each isolated device, not enough", host.Name, input.ReservedStorage)
}
defer func() {
go host.ClearSchedDescCache()
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/models/loadbalanceragents_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (lbagent *SLoadbalancerAgent) validateHost(ctx context.Context, userCred mc
func (lbagent *SLoadbalancerAgent) PerformDeploy(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
input := &compute_apis.LoadbalancerAgentDeployInput{}
if err := data.Unmarshal(input); err != nil {
return nil, httperrors.NewBadRequestError("unmarshal input", err)
return nil, httperrors.NewBadRequestError("unmarshal input: %v", err)
}
host := input.Host
for _, k := range []string{"user", "pass", "proj"} {
Expand Down
4 changes: 2 additions & 2 deletions pkg/compute/models/loadbalancerbackendgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ func (man *SLoadbalancerBackendGroupManager) ValidateCreateData(ctx context.Cont
backends[i].BackendType = api.LB_BACKEND_GUEST
}
if backends[i].Weight < 0 || backends[i].Weight > 256 {
return nil, httperrors.NewInputParameterError("weight %s not support, only support range 0 ~ 256")
return nil, httperrors.NewInputParameterError("weight %d not support, only support range 0 ~ 256", backends[i].Weight)
}
if backends[i].Port < 1 || backends[i].Port > 65535 {
return nil, httperrors.NewInputParameterError("port %s not support, only support range 1 ~ 65535")
return nil, httperrors.NewInputParameterError("port %d not support, only support range 1 ~ 65535", backends[i].Port)
}
if len(backends[i].ID) == 0 {
return nil, httperrors.NewMissingParameterError("Missing backend id")
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/models/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ func isValidNetworkInfo(userCred mcclient.TokenCredential, netConfig *api.Networ
if len(netConfig.Network) > 0 {
netObj, err := NetworkManager.FetchByIdOrName(userCred, netConfig.Network)
if err != nil {
return httperrors.NewResourceNotFoundError("Network %s not found %s", err)
return httperrors.NewResourceNotFoundError("Network %s not found: %v", netConfig.Network, err)
}
net := netObj.(*SNetwork)
/*
Expand Down
5 changes: 3 additions & 2 deletions pkg/compute/regiondrivers/aliyun.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ func (self *SAliyunRegionDriver) ValidateCreateDBInstanceAccountData(ctx context

for i, s := range input.Name {
if !unicode.IsLetter(s) && !unicode.IsDigit(s) && s != '_' {
return input, httperrors.NewInputParameterError("invalid character %s for account name", s)
return input, httperrors.NewInputParameterError("invalid character %s for account name", string(s))
}
if s == '_' && (i == 0 || i == len(input.Name)) {
return input, httperrors.NewInputParameterError("account name can not start or end with _")
Expand Down Expand Up @@ -1396,7 +1396,8 @@ func (self *SAliyunRegionDriver) ValidateCreateElasticcacheAccountData(ctx conte
}

if accountPrivilegeV.Value == "repl" && elasticCacheV.Model.(*models.SElasticcache).EngineVersion != "4.0" {
return nil, httperrors.NewInputParameterError("account_privilege %s only support redis version 4.0")
return nil, httperrors.NewInputParameterError("account_privilege %s only support redis version 4.0",
accountPrivilegeV.Value)
}

return data, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/regiondrivers/huawei.go
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,7 @@ func (self *SHuaWeiRegionDriver) RequestCreateElasticcache(ctx context.Context,
}

func (self *SHuaWeiRegionDriver) ValidateCreateElasticcacheAccountData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
return nil, httperrors.NewUnsupportOperationError("% not support create account", self.GetProvider())
return nil, httperrors.NewUnsupportOperationError("%s not support create account", self.GetProvider())
}

func (self *SHuaWeiRegionDriver) RequestElasticcacheAccountResetPassword(ctx context.Context, userCred mcclient.TokenCredential, ea *models.SElasticcacheAccount, task taskman.ITask) error {
Expand Down

0 comments on commit 23b9991

Please sign in to comment.