feat: added Init() and Cleanup() in hooks
This commit is contained in:
parent
bdd85b01ff
commit
277de43a02
2 changed files with 24 additions and 0 deletions
|
|
@ -142,6 +142,14 @@ func (s *Service) Download() http.HandlerFunc {
|
|||
"version": hook.Plugin.Version(),
|
||||
},
|
||||
}).Send()
|
||||
err = hook.Init()
|
||||
if err != nil {
|
||||
log.Error().
|
||||
Err(err).
|
||||
Str("plugin", hook.Plugin.Name()).
|
||||
Msg("failed to initialize plugin")
|
||||
continue
|
||||
}
|
||||
err = hook.Run()
|
||||
if err != nil {
|
||||
log.Error().
|
||||
|
|
@ -150,6 +158,14 @@ func (s *Service) Download() http.HandlerFunc {
|
|||
Msg("failed to run plugin")
|
||||
continue
|
||||
}
|
||||
err = hook.Cleanup()
|
||||
if err != nil {
|
||||
log.Error().
|
||||
Err(err).
|
||||
Str("plugin", hook.Plugin.Name()).
|
||||
Msg("failed to cleanup plugin")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// take the contents from the last hook and update files
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue