mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: region task notify not work
This commit is contained in:
@@ -156,7 +156,7 @@ func fetchTaskParams(ctx context.Context, taskName string, taskData *jsonutils.J
|
||||
}
|
||||
} else {
|
||||
if !reqContext.IsZero() {
|
||||
if len(reqContext.TaskId) > 0 {
|
||||
if len(reqContext.TaskId) > 0 && len(reqContext.TaskNotifyUrl) == 0 {
|
||||
data.Add(jsonutils.NewString(reqContext.TaskId), PARENT_TASK_ID_KEY)
|
||||
}
|
||||
if len(reqContext.TaskNotifyUrl) > 0 {
|
||||
|
||||
@@ -18,7 +18,7 @@ const (
|
||||
|
||||
func Authenticate(f appsrv.FilterHandler) appsrv.FilterHandler {
|
||||
return func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
|
||||
tokenStr := r.Header.Get("X-Auth-Token")
|
||||
tokenStr := r.Header.Get(mcclient.AUTH_TOKEN)
|
||||
if len(tokenStr) == 0 {
|
||||
httperrors.UnauthorizedError(w, "Unauthorized")
|
||||
return
|
||||
@@ -30,6 +30,12 @@ func Authenticate(f appsrv.FilterHandler) appsrv.FilterHandler {
|
||||
return
|
||||
}
|
||||
ctx = context.WithValue(ctx, AUTH_TOKEN, token)
|
||||
if taskId := r.Header.Get(mcclient.TASK_ID); taskId != "" {
|
||||
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_TASK_ID, taskId)
|
||||
}
|
||||
if taskNotifyUrl := r.Header.Get(mcclient.TASK_NOTIFY_URL); taskNotifyUrl != "" {
|
||||
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_TASK_NOTIFY_URL, taskNotifyUrl)
|
||||
}
|
||||
f(ctx, w, r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
TASK_ID = "X-Task-Id"
|
||||
TASK_NOTIFY_URL = "X-Task-Notify-Url"
|
||||
AUTH_TOKEN = "X-Auth-Token"
|
||||
|
||||
DEFAULT_API_VERSION = "v1"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user