From 2abd456e212183eac4241fd184c9a5b463b4eb77 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Wed, 6 Mar 2024 21:40:54 +0545 Subject: [PATCH] feat: add error column to playbooks This is for errors that are not related to actions. Example: - db errors when fetching the playbook - when a non existent playbook id is supplied - when a playbook delay expression is invalid (the delay is in action but its parsed by the run consumer.) --- models/playbooks.go | 1 + schema/playbooks.hcl | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/models/playbooks.go b/models/playbooks.go index fc81f25f..1d49fa80 100644 --- a/models/playbooks.go +++ b/models/playbooks.go @@ -76,6 +76,7 @@ type PlaybookRun struct { ComponentID *uuid.UUID `json:"component_id,omitempty"` CheckID *uuid.UUID `json:"check_id,omitempty"` ConfigID *uuid.UUID `json:"config_id,omitempty"` + Error *string `json:"error,omitempty"` Parameters types.JSONStringMap `json:"parameters,omitempty" gorm:"default:null"` AgentID *uuid.UUID `json:"agent_id,omitempty"` } diff --git a/schema/playbooks.hcl b/schema/playbooks.hcl index 818b425c..a78a9efd 100644 --- a/schema/playbooks.hcl +++ b/schema/playbooks.hcl @@ -173,6 +173,10 @@ table "playbook_runs" { default = var.uuid_nil type = uuid } + column "error" { + null = true + type = text + } primary_key { columns = [column.id] }