diff --git a/pkg/compute/guestdrivers/aws.go b/pkg/compute/guestdrivers/aws.go index 163a7278e0..ff6bb28987 100644 --- a/pkg/compute/guestdrivers/aws.go +++ b/pkg/compute/guestdrivers/aws.go @@ -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 }) diff --git a/pkg/compute/guestdrivers/azure.go b/pkg/compute/guestdrivers/azure.go index 139dbad0e5..6afc543997 100644 --- a/pkg/compute/guestdrivers/azure.go +++ b/pkg/compute/guestdrivers/azure.go @@ -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 }) diff --git a/pkg/util/azure/classic_host.go b/pkg/util/azure/classic_host.go index 1a943b7dd1..f2c7aa5654 100644 --- a/pkg/util/azure/classic_host.go +++ b/pkg/util/azure/classic_host.go @@ -13,10 +13,6 @@ type SClassicHost struct { zone *SZone } -const ( - DEFAULT_USER = "yunion" -) - func (self *SClassicHost) GetMetadata() *jsonutils.JSONDict { return nil } diff --git a/pkg/util/azure/host.go b/pkg/util/azure/host.go index 4dd6fff0ee..970a497cd7 100644 --- a/pkg/util/azure/host.go +++ b/pkg/util/azure/host.go @@ -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, },