When we try to execute a policy with registered hooks, the agent tries to execute the hook's serialized JSON instead of the actual command, and the timeout is not taken into account.
Furthermore, the GUI does not display the registered hooks (even if they are effectively stored in the DB).
Here is the command executed by an agent in one of my Proxmox containers:
The job should execute the registered hooks correctly.
Apr 24 10:02:24 forgejo arkeep-agent[650]: {"level":"info","ts":1777017744.2933629,"logger":"executor","caller":"executor/executor.go:242","msg":"resolved 1 source(s)","job_id":"019dbe82-eb66-7a30-9d1b-ccadf95d82e3"}
Apr 24 10:02:24 forgejo arkeep-agent[650]: {"level":"info","ts":1777017744.293381,"logger":"executor","caller":"executor/executor.go:242","msg":"running pre-backup hook: {\"name\":\"test\",\"command\":\"ls\",\"args\":[],\"timeout_secs\":30}","job_id":"019dbe82-eb66-7a30-9d1b-ccadf95d82e3"}
Apr 24 10:02:24 forgejo arkeep-agent[650]: {"level":"info","ts":1777017744.294059,"logger":"executor","caller":"executor/executor.go:242","msg":"pre-backup hook output: /bin/sh: 1: {name:test,command:ls,args:[],timeout_secs:30}: not found\n","job_id":"019dbe82-eb66-7a30-9d1b-ccadf95d82e3"}
Apr 24 10:02:24 forgejo arkeep-agent[650]: {"level":"error","ts":1777017744.2940733,"logger":"executor","caller":"executor/executor.go:238","msg":"pre-backup hook failed (exit 127): hook: command failed: exit code 127","job_id":"019dbe82-eb66-7a30-9d1b-ccadf95d82e3","stacktrace":"github.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).executeBackup.func1\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:238\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).executeBackup.func2\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:247\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).executeBackup\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:284\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).execute\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:219\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).Run\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:190\nmain.run.func2\n\t/home/runner/work/arkeep/arkeep/agent/cmd/agent/main.go:231"}
Apr 24 19:34:02 forgejo arkeep-agent[650]: {"level":"info","ts":1777052042.9249065,"logger":"executor","caller":"executor/executor.go:201","msg":"job enqueued","job_id":"019dc08e-467b-7b1e-a486-5ab520505d1e","policy_id":"019dbc3d-912f-7e5f-9011-d18cdc325430","type":"JOB_TYPE_BACKUP"}
Apr 24 19:34:02 forgejo arkeep-agent[650]: {"level":"info","ts":1777052042.9443226,"logger":"executor","caller":"executor/executor.go:242","msg":"backup started","job_id":"019dc08e-467b-7b1e-a486-5ab520505d1e"}
Apr 24 19:34:02 forgejo arkeep-agent[650]: {"level":"info","ts":1777052042.944377,"logger":"executor","caller":"executor/executor.go:242","msg":"resolved 1 source(s)","job_id":"019dc08e-467b-7b1e-a486-5ab520505d1e"}
Apr 24 19:34:02 forgejo arkeep-agent[650]: {"level":"info","ts":1777052042.944393,"logger":"executor","caller":"executor/executor.go:242","msg":"running pre-backup hook: {\"name\":\"test\",\"command\":\"ls\",\"args\":[],\"timeout_secs\":30}","job_id":"019dc08e-467b-7b1e-a486-5ab520505d1e"}
Apr 24 19:34:02 forgejo arkeep-agent[650]: {"level":"info","ts":1777052042.945083,"logger":"executor","caller":"executor/executor.go:242","msg":"pre-backup hook output: /bin/sh: 1: {name:test,command:ls,args:[],timeout_secs:30}: not found\n","job_id":"019dc08e-467b-7b1e-a486-5ab520505d1e"}
Apr 24 19:34:02 forgejo arkeep-agent[650]: {"level":"error","ts":1777052042.945099,"logger":"executor","caller":"executor/executor.go:238","msg":"pre-backup hook failed (exit 127): hook: command failed: exit code 127","job_id":"019dc08e-467b-7b1e-a486-5ab520505d1e","stacktrace":"github.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).executeBackup.func1\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:238\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).executeBackup.func2\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:247\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).executeBackup\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:284\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).execute\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:219\ngithub.com/arkeep-io/arkeep/agent/internal/executor.(*Executor).Run\n\t/home/runner/work/arkeep/arkeep/agent/internal/executor/executor.go:190\nmain.run.func2\n\t/home/runner/work/arkeep/arkeep/agent/cmd/agent/main.go:231"}
Component
Server
Description
Agent doesn't parse the hooks JSON:
When we try to execute a policy with registered hooks, the agent tries to execute the hook's serialized JSON instead of the actual command, and the timeout is not taken into account.
Furthermore, the GUI does not display the registered hooks (even if they are effectively stored in the DB).
Here is the command executed by an agent in one of my Proxmox containers:
The command was:
/bin/sh -c {"name":"test","command":"ls","args":[],"timeout_secs":30}instead of:
/bin/sh -c lsSo the job failed:
Steps to Reproduce
Expected Behavior
The job should execute the registered hooks correctly.
Arkeep Version
v0.3.0
Deployment Method
systemd
Relevant Logs
Additional Context
No response