Fix guided lifecycle job scoping

This commit is contained in:
npc0-hue
2026-08-01 17:11:25 +08:00
parent e37f00c48a
commit 9f82e310b2
6 changed files with 92 additions and 20 deletions
+5 -4
View File
@@ -291,19 +291,20 @@ func (svc *CoreService) dispatchLifecycleJob(instance domain.ServerInstance, act
return domain.Job{}, err
}
profileKey := ""
if err == nil {
if err == nil && strings.TrimSpace(binding.ProfileKey) != "" {
profileKey = binding.ProfileKey
} else {
profileKey = instance.Deployment.ProfileKey
}
actionRef := profileKey
actionRef := ""
profile, hasProfile := runtimeLifecycleProfileForKey(plugin.RuntimeProfiles, profileKey)
if hasProfile {
if ref := runtimeProfileActionRef(profile.ActionRefs, action); ref != "" {
actionRef = ref
}
} else if ref := lifecycleActionRef(plugin, action); ref != "" {
actionRef = ref
}
if strings.TrimSpace(actionRef) == "" {
actionRef = lifecycleActionRef(plugin, action)
}
if strings.TrimSpace(actionRef) == "" {
return domain.Job{}, validationError(fmt.Sprintf("plugin %s lifecycle action is required", action))