azure使用统一登录用户名

This commit is contained in:
屈轩
2018-11-17 13:02:10 +08:00
parent 0a8d2b532e
commit fc0e60c5ec
4 changed files with 10 additions and 14 deletions
+4 -2
View File
@@ -5,6 +5,8 @@ import (
"fmt"
"time"
"yunion.io/x/onecloud/pkg/util/ansible"
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
@@ -158,7 +160,7 @@ func (self *SAwsGuestDriver) RequestDeployGuestOnHost(ctx context.Context, guest
return nil, err
}
data := fetchIVMinfo(desc, iVM, guest.Id, DEFAULT_USER, passwd, action)
data := fetchIVMinfo(desc, iVM, guest.Id, ansible.PUBLIC_CLOUD_ANSIBLE_USER, passwd, action)
return data, nil
})
case "rebuild":
@@ -210,7 +212,7 @@ func (self *SAwsGuestDriver) RequestDeployGuestOnHost(ctx context.Context, guest
}
}
data := fetchIVMinfo(desc, iVM, guest.Id, DEFAULT_USER, passwd, action)
data := fetchIVMinfo(desc, iVM, guest.Id, ansible.PUBLIC_CLOUD_ANSIBLE_USER, passwd, action)
return data, nil
})
+4 -7
View File
@@ -9,6 +9,7 @@ import (
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/httperrors"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/util/ansible"
"yunion.io/x/onecloud/pkg/util/seclib2"
"yunion.io/x/pkg/utils"
@@ -22,10 +23,6 @@ type SAzureGuestDriver struct {
SManagedVirtualizedGuestDriver
}
const (
DEFAULT_USER = "yunion"
)
func init() {
driver := SAzureGuestDriver{}
models.RegisterGuestDriver(&driver)
@@ -169,7 +166,7 @@ func (self *SAzureGuestDriver) RequestDeployGuestOnHost(ctx context.Context, gue
return nil, err
}
data := fetchIVMinfo(desc, iVM, guest.Id, DEFAULT_USER, passwd, action)
data := fetchIVMinfo(desc, iVM, guest.Id, ansible.PUBLIC_CLOUD_ANSIBLE_USER, passwd, action)
return data, nil
}
})
@@ -192,7 +189,7 @@ func (self *SAzureGuestDriver) RequestDeployGuestOnHost(ctx context.Context, gue
if err != nil {
return nil, err
}
data := fetchIVMinfo(desc, iVM, guest.Id, DEFAULT_USER, passwd, action)
data := fetchIVMinfo(desc, iVM, guest.Id, ansible.PUBLIC_CLOUD_ANSIBLE_USER, passwd, action)
return data, nil
})
} else if action == "rebuild" {
@@ -209,7 +206,7 @@ func (self *SAzureGuestDriver) RequestDeployGuestOnHost(ctx context.Context, gue
}
log.Debugf("VMrebuildRoot %s, and status is ready", iVM.GetGlobalId())
data := fetchIVMinfo(desc, iVM, guest.Id, DEFAULT_USER, passwd, action)
data := fetchIVMinfo(desc, iVM, guest.Id, ansible.PUBLIC_CLOUD_ANSIBLE_USER, passwd, action)
return data, nil
})
-4
View File
@@ -13,10 +13,6 @@ type SClassicHost struct {
zone *SZone
}
const (
DEFAULT_USER = "yunion"
)
func (self *SClassicHost) GetMetadata() *jsonutils.JSONDict {
return nil
}
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/compute/models"
"yunion.io/x/onecloud/pkg/util/ansible"
)
type SHost struct {
@@ -118,7 +119,7 @@ func (self *SHost) _createVM(name string, imgId string, sysDiskSize int32, cpu i
},
OsProfile: OsProfile{
ComputerName: name,
AdminUsername: DEFAULT_USER,
AdminUsername: ansible.PUBLIC_CLOUD_ANSIBLE_USER,
AdminPassword: passwd,
CustomData: userData,
},