diff --git a/automation/service/workflow.go b/automation/service/workflow.go index 93b73b7ba..bc2ff231b 100644 --- a/automation/service/workflow.go +++ b/automation/service/workflow.go @@ -506,6 +506,10 @@ func (svc *workflow) Exec(ctx context.Context, workflowID uint64, p types.Workfl return WorkflowErrNotAllowedToExecute() } + if !wf.Enabled && !p.Trace { + return WorkflowErrDisabled() + } + g, convErr := Convert(svc, wf) if len(convErr) > 0 { return convErr @@ -532,6 +536,10 @@ func (svc *workflow) Exec(ctx context.Context, workflowID uint64, p types.Workfl return nil, nil }() + if !t.Enabled && !p.Trace { + return WorkflowErrDisabled() + } + // Start with workflow scope scope := wf.Scope.Merge() diff --git a/automation/service/workflow_actions.gen.go b/automation/service/workflow_actions.gen.go index 18ab0cbab..78a9602d1 100644 --- a/automation/service/workflow_actions.gen.go +++ b/automation/service/workflow_actions.gen.go @@ -504,6 +504,36 @@ func WorkflowErrInvalidID(mm ...*workflowActionProps) *errors.Error { return e } +// WorkflowErrDisabled returns "automation:workflow.disabled" as *errors.Error +// +// +// This function is auto-generated. +// +func WorkflowErrDisabled(mm ...*workflowActionProps) *errors.Error { + var p = &workflowActionProps{} + if len(mm) > 0 { + p = mm[0] + } + + var e = errors.New( + errors.KindInternal, + + p.Format("disabled workflow or trigger", nil), + + errors.Meta("type", "disabled"), + errors.Meta("resource", "automation:workflow"), + + errors.Meta(workflowPropsMetaKey{}, p), + + errors.StackSkip(1), + ) + + if len(mm) > 0 { + } + + return e +} + // WorkflowErrInvalidHandle returns "automation:workflow.invalidHandle" as *errors.Error // // diff --git a/automation/service/workflow_actions.yaml b/automation/service/workflow_actions.yaml index bc0bca569..5ca6fa435 100644 --- a/automation/service/workflow_actions.yaml +++ b/automation/service/workflow_actions.yaml @@ -62,6 +62,9 @@ errors: - error: invalidID message: "invalid ID" + - error: disabled + message: "disabled workflow or trigger" + - error: invalidHandle message: "invalid handle" diff --git a/pkg/expr/expr_types.gen.go b/pkg/expr/expr_types.gen.go index e4ed6abb3..aa2cb2861 100644 --- a/pkg/expr/expr_types.gen.go +++ b/pkg/expr/expr_types.gen.go @@ -553,10 +553,6 @@ func (t *UnsignedInteger) Assign(val interface{}) error { // Vars is an expression type, wrapper for map[string]TypedValue type type Vars struct{ value map[string]TypedValue } -func EmptyVars() *Vars { - return &Vars{make(map[string]TypedValue)} -} - // NewVars creates new instance of Vars expression type func NewVars(val interface{}) (*Vars, error) { if c, err := CastToVars(val); err != nil {