mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix: remove apiversion param from session
This commit is contained in:
@@ -61,8 +61,8 @@ func getServerAttrs(ID string, s *mcclient.ClientSession) (map[string]string, er
|
||||
|
||||
func getInfluxdbURL() (string, error) {
|
||||
|
||||
s := auth.GetAdminSessionWithPublic(nil, "", "")
|
||||
url, err := s.GetServiceURL("influxdb", apiidentity.EndpointInterfacePublic)
|
||||
s := auth.GetAdminSessionWithPublic(nil, "")
|
||||
url, err := s.GetServiceURL("influxdb", apiidentity.EndpointInterfacePublic, "")
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("get influxdb Endpoint error %s", err)
|
||||
@@ -116,7 +116,7 @@ func (obj *SDevtoolTemplate) Binding(ctx context.Context, userCred mcclient.Toke
|
||||
// * create playbook
|
||||
|
||||
template := obj
|
||||
s := auth.GetSession(ctx, userCred, "", "")
|
||||
s := auth.GetSession(ctx, userCred, "")
|
||||
ServerID, err := data.GetString("server_id")
|
||||
|
||||
attrs, err := getServerAttrs(ServerID, s)
|
||||
@@ -189,7 +189,7 @@ func (obj *SDevtoolTemplate) Unbinding(ctx context.Context, userCred mcclient.To
|
||||
// * get cronjob struct and create obj
|
||||
// * create playbook
|
||||
template := obj
|
||||
s := auth.GetSession(ctx, userCred, "", "")
|
||||
s := auth.GetSession(ctx, userCred, "")
|
||||
ServerID, err := data.GetString("server_id")
|
||||
|
||||
newPlaybookName := template.Name + "-" + template.Id[0:8] + "-" + ServerID[0:8]
|
||||
|
||||
@@ -113,7 +113,7 @@ func AddOneCronjob(item *SCronjob, s *mcclient.ClientSession) error {
|
||||
func InitializeCronjobs() error {
|
||||
DevToolCronManager = cronman.InitCronJobManager(true, 8)
|
||||
DevToolCronManager.Start()
|
||||
Session := auth.GetAdminSession(nil, "", "")
|
||||
Session := auth.GetAdminSession(nil, "")
|
||||
|
||||
go func() {
|
||||
items := make([]SCronjob, 0)
|
||||
@@ -131,7 +131,7 @@ func InitializeCronjobs() error {
|
||||
}
|
||||
|
||||
func (job *SCronjob) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerID mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) {
|
||||
Session := auth.GetAdminSession(nil, "", "")
|
||||
Session := auth.GetAdminSession(nil, "")
|
||||
job.SStandaloneResourceBase.PostCreate(ctx, userCred, nil, query, data)
|
||||
AddOneCronjob(job, Session)
|
||||
}
|
||||
@@ -141,7 +141,7 @@ func (job *SCronjob) PostDelete(ctx context.Context, userCred mcclient.TokenCred
|
||||
}
|
||||
|
||||
func (job *SCronjob) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) {
|
||||
Session := auth.GetAdminSession(nil, "", "")
|
||||
Session := auth.GetAdminSession(nil, "")
|
||||
job.SStandaloneResourceBase.PostUpdate(ctx, userCred, query, data)
|
||||
DevToolCronManager.Remove(job.Id)
|
||||
AddOneCronjob(job, Session)
|
||||
|
||||
@@ -84,7 +84,7 @@ func (sm *SScriptManager) InitializeData() error {
|
||||
|
||||
func (sm *SScriptManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, input api.ScriptCreateInput) (api.ScriptCreateInput, error) {
|
||||
// check ansible playbook reference
|
||||
session := auth.GetSessionWithInternal(ctx, userCred, "", "")
|
||||
session := auth.GetSessionWithInternal(ctx, userCred, "")
|
||||
pr, err := ansible.AnsiblePlaybookReference.Get(session, input.PlaybookReference, nil)
|
||||
if err != nil {
|
||||
return input, errors.Wrapf(err, "unable to get AnsiblePlaybookReference %q", input.PlaybookReference)
|
||||
|
||||
@@ -106,7 +106,7 @@ func (self *ApplyScriptTask) OnInit(ctx context.Context, obj db.IStandaloneModel
|
||||
self.taskFailed(ctx, sa, sar, err)
|
||||
return
|
||||
}
|
||||
session := auth.GetAdminSession(ctx, "", "")
|
||||
session := auth.GetAdminSession(ctx, "")
|
||||
sshable, cleanFunc, err := utils.CheckSSHable(session, sa.GuestId)
|
||||
// check sshable
|
||||
if err != nil {
|
||||
@@ -180,7 +180,7 @@ const (
|
||||
|
||||
func (self *ApplyScriptTask) OnAnsiblePlaybookComplete(ctx context.Context, obj db.IStandaloneModel, body jsonutils.JSONObject) {
|
||||
// try to delete local forward
|
||||
session := auth.GetAdminSession(ctx, "", "")
|
||||
session := auth.GetAdminSession(ctx, "")
|
||||
|
||||
sa := obj.(*models.SScriptApply)
|
||||
// try to set metadata for guest
|
||||
|
||||
@@ -40,7 +40,7 @@ func init() {
|
||||
func (self *SshInfoCreateTask) OnInit(ctx context.Context, obj db.IStandaloneModel, body jsonutils.JSONObject) {
|
||||
sshInfo := obj.(*models.SSshInfo)
|
||||
serverId := sshInfo.ServerId
|
||||
session := auth.GetSession(ctx, self.GetUserCred(), "", "")
|
||||
session := auth.GetSession(ctx, self.GetUserCred(), "")
|
||||
sshable, cleanFunc, err := utils.CheckSSHable(session, serverId)
|
||||
if err != nil {
|
||||
sshInfo.MarkCreateFailed(err.Error())
|
||||
|
||||
@@ -41,7 +41,7 @@ func (self *SshInfoDeleteTask) OnInit(ctx context.Context, obj db.IStandaloneMod
|
||||
self.SetStageComplete(ctx, nil)
|
||||
return
|
||||
}
|
||||
session := auth.GetSession(ctx, self.GetUserCred(), "", "")
|
||||
session := auth.GetSession(ctx, self.GetUserCred(), "")
|
||||
clean := utils.GetCleanFunc(session, sshInfo.ServerHypervisor, sshInfo.ServerId, sshInfo.Host, sshInfo.ForwardId, sshInfo.Port)
|
||||
err := clean()
|
||||
if err != nil {
|
||||
|
||||
@@ -68,7 +68,7 @@ func serviceComplete2(service Service) (completeUrl string, expectedCode int) {
|
||||
|
||||
func proxyEndpoints(ctx context.Context, proxyEndpointId string, info sServerInfo) ([]sProxyEndpoint, error) {
|
||||
pes := make([]sProxyEndpoint, 0)
|
||||
session := auth.GetAdminSession(ctx, "", "")
|
||||
session := auth.GetAdminSession(ctx, "")
|
||||
if len(proxyEndpointId) > 0 {
|
||||
ep, err := cloudproxy.ProxyEndpoints.Get(session, proxyEndpointId, nil)
|
||||
if err != nil {
|
||||
@@ -130,7 +130,7 @@ func serviceUrlDirect(ctx context.Context, service Service, proxyEndpointId stri
|
||||
|
||||
func GetServerInfo(ctx context.Context, serverId string) (sServerInfo, error) {
|
||||
// check server
|
||||
session := auth.GetAdminSession(ctx, "", "")
|
||||
session := auth.GetAdminSession(ctx, "")
|
||||
data, err := compute.Servers.Get(session, serverId, nil)
|
||||
if err != nil {
|
||||
if httputils.ErrorCode(err) == 404 {
|
||||
@@ -243,7 +243,7 @@ func GetServiceUrl(ctx context.Context, serviceName string) (string, error) {
|
||||
if url, ok := serviceUrls[serviceName]; ok {
|
||||
return url, nil
|
||||
}
|
||||
session := auth.GetAdminSession(ctx, "", "")
|
||||
session := auth.GetAdminSession(ctx, "")
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("interface", jsonutils.NewString("public"))
|
||||
params.Set("service", jsonutils.NewString(serviceName))
|
||||
@@ -262,7 +262,7 @@ func GetServiceUrl(ctx context.Context, serviceName string) (string, error) {
|
||||
}
|
||||
|
||||
func convertServiceUrl(ctx context.Context, service Service, endpointId string) (port int64, recycle func() error, err error) {
|
||||
session := auth.AdminSessionWithInternal(ctx, "", "", "")
|
||||
session := auth.AdminSessionWithInternal(ctx, "", "")
|
||||
filter := jsonutils.NewDict()
|
||||
filter.Set("proxy_endpoint_id", jsonutils.NewString(endpointId))
|
||||
filter.Set("opaque", jsonutils.NewString(service.Url))
|
||||
@@ -328,7 +328,7 @@ func convertServiceUrl(ctx context.Context, service Service, endpointId string)
|
||||
}
|
||||
|
||||
func checkUrl(ctx context.Context, completeUrl string, expectedCode int, host *ansible_api.AnsibleHost) (bool, error) {
|
||||
session := auth.GetAdminSession(ctx, "", "")
|
||||
session := auth.GetAdminSession(ctx, "")
|
||||
ahost := ansible.Host{}
|
||||
ahost.Name = host.IP
|
||||
ahost.Vars = map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user