Skip to content

Commit

Permalink
fix(engine): Fix possibly unbound action inputs during clone
Browse files Browse the repository at this point in the history
  • Loading branch information
daryllimyt committed Mar 24, 2024
1 parent 621ba58 commit d0c365c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tracecat/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,20 +346,19 @@ def clone_workflow(
),
)

action_inputs: dict[str, str] = json.loads(cloned_action.inputs)
if action.type == "webhook":
cloned_webhook = Webhook(
owner_id=new_owner_id,
action_id=cloned_action.id,
workflow_id=cloned_workflow.id,
)
# Update the action inputs to point to the new webhook path
action_inputs: dict[str, str] = json.loads(cloned_action.inputs)
action_inputs.update(path=cloned_webhook.id, secret=cloned_webhook.secret)
cloned_action.inputs = json.dumps(action_inputs)

# Assert that there's a new computed secret
session.add(cloned_webhook)

cloned_action.inputs = json.dumps(action_inputs)
action_replacements[action.id] = (cloned_action.id, action_inputs)
session.add(cloned_action)

Expand Down

0 comments on commit d0c365c

Please sign in to comment.