fix climc server-deploy (#243)

This commit is contained in:
wanyaoqi
2019-04-04 22:12:32 +08:00
committed by yunion-ci-robot
parent 8498ad66a0
commit bf0274779b
2 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -202,7 +202,7 @@ type ServerDeployInput struct {
Id string
Keypair string `json:"keypair"`
DeleteKeypair bool `json:"__delete_keypair__"`
DeleteKeypair *bool `json:"__delete_keypair__"`
DeployConfigs []*DeployConfig `json:"deploy_configs"`
ResetPassword *bool `json:"reset_password"`
Password string `json:"password"`
+8 -3
View File
@@ -443,12 +443,17 @@ type ServerDeployOptions struct {
func (opts *ServerDeployOptions) Params() (*computeapi.ServerDeployInput, error) {
params := new(computeapi.ServerDeployInput)
{
deleteKeyPair := BoolV(opts.DeleteKeypair)
if deleteKeyPair {
params.DeleteKeypair = true
if opts.DeleteKeypair != nil {
params.DeleteKeypair = opts.DeleteKeypair
} else if len(opts.Keypair) > 0 {
params.Keypair = opts.Keypair
}
params.AutoStart = opts.AutoStart
if opts.ResetPassword != nil {
params.ResetPassword = opts.ResetPassword
} else if len(opts.Password) > 0 {
params.Password = opts.Password
}
}
{
deployInfos, err := ParseServerDeployInfoList(opts.Deploy)