flanksource / mission-control

Other
10 stars 2 forks source link

duplicate key value violates unique constraint "playbook_name_key" #1206

Open adityathebe opened 1 month ago

adityathebe commented 1 month ago

2024/07/30 04:35:29 logger.go:167: /app/db/playbooks.go:202 ERROR: duplicate key value violates unique constraint "playbook_name_key" (SQLSTATE 23505) [2.296ms] [rows:0] INSERT INTO "playbooks" ("namespace","name","icon","description","spec","source","category","created_by","deleted_at","id") VALUES ('mission-control','Kubectl Logs','','','{"title":"Kubectl Logs","category":"Kubernetes","icon":"kubernetes","runsOn":["{{- if .agent }}{{.agent.name}}{{ else }}local{{ end }}"],"configs":[{"agent":"all","types":["Kubernetes::Pod","Kubernetes::Deployment","Kubernetes::Statefulset","Kubernetes::Namespace","Kubernetes::ReplicaSet","Kubernetes::Job","Kubernetes::Node","Kubernetes::Service","Kubernetes::DaemonSet"]}],"parameters":[{"name":"since","default":"1h","label":"Since","type":"list","properties":{"options":[{"label":"1h","value":"1h"},{"label":"2h","value":"2h"},{"label":"4h","value":"4h"},{"label":"8h","value":"8h"},{"label":"12h","value":"12h"},{"label":"1d","value":"24h"},{"label":"3d","value":"72h"}]}},{"name":"lines","default":"5000","label":"Max Lines","type":"text"}],"actions":[{"name":"Stern","runsOn":["{{- if .agent }}{{.agent.name}}{{ else }}local{{ end }}"],"exec":{"script":"# escape delims passed through to stern\nleft=\"{\"\"{\"\nright=\"}\"\"}\"\n\nfunction template() {\n local -n outvar=$1\n outvar=\"$left $2 $right\"\n}\n\nns=\" -n $(.config.tags.namespace)\"\ntype=\"$(.config.type)\"\nname=\"$(.config.name)\"\ntemplate pod \"color .PodColor .PodName\"\ntemplate namespace \".Namespace\"\ntemplate node \".NodeName\"\ntemplate container \"color .ContainerColor .ContainerName\"\ntemplate msg \".Message\"\ntemplate nl ''\"\\n\"''\nstern=\"stern --color always --container-state all --no-follow --since $(.params.since) --tail $(.params.lines)\"\n\ncase $type in\n Kubernetes::Namespace)\n $stern --template \"$namespace/$pod $msg $nl\" -n $name \".*\"\n ;;\n Kubernetes::Pod)\n $stern --template \"$container $msg $nl\" $name $ns\n ;;\n Kubernetes::Statefulset)\n $stern --template \"$pod $container $msg $nl\" statefulset/$name $ns\n ;;\n Kubernetes::ReplicaSet)\n $stern --template \"$pod $container $msg $nl\" replicaset/$name $ns\n ;;\n Kubernetes::Deployment)\n $stern --template \"$pod $container $msg $nl\" deployment/$name $ns\n ;;\n Kubernetes::Job)\n $stern --template \"$pod $container $msg $nl\" job/$name $ns\n ;;\n Kubernetes::DaemonSet)\n $stern --template \"$node $msg $nl\" ds/$name $ns\n ;;\n Kubernetes::Service)\n $stern --template \"$pod $container $msg $nl\" svc/$name $ns\n ;;\n Kubernetes::Node)\n $stern --node $name $ns\n ;;\n *)\n echo -n \"unknown type: $type\"\n ;;\n esac\n","connections":{}}}]}','KubernetesCRD','Kubernetes','01884890-7a73-541b-461f-8d6ad30634d8',NULL,'c03308a8-c663-487b-a501-e16861643317') ON CONFLICT ("id") DO UPDATE SET "namespace"="excluded"."namespace","name"="excluded"."name","icon"="excluded"."icon","description"="excluded"."description","spec"="excluded"."spec","source"="excluded"."source","category"="excluded"."category","created_by"="excluded"."created_by","deleted_at"="excluded"."deleted_at" RETURNING "id" {"level":"error","ts":"2024-07-30T04:35:29.718189875Z","msg":"[kopper] failed to upsert Playbook[c03308a8-c663-487b-a501-e16861643317]: ERROR: duplicate key value violates unique constraint \"playbook_name_key\" (SQLSTATE 23505)"}