From 9387ede99a45a67b808947d8cdba220a6c1368e5 Mon Sep 17 00:00:00 2001 From: Mattia Codato Date: Tue, 20 Apr 2021 14:23:42 +0200 Subject: [PATCH] Add hook deployment onCollect --- library/Director/Core/CoreApi.php | 6 ++++++ library/Director/Hook/DeploymentHook.php | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/library/Director/Core/CoreApi.php b/library/Director/Core/CoreApi.php index 7734538a..8f792293 100644 --- a/library/Director/Core/CoreApi.php +++ b/library/Director/Core/CoreApi.php @@ -677,6 +677,12 @@ constants $deployment->set('stage_collected', 'y'); $deployment->store(); + + /** @var DeploymentHook[] $hooks */ + $hooks = Hook::all('director/Deployment'); + foreach ($hooks as $hook) { + $hook->onCollect($deployment); + } } foreach ($missing as $deployment) { diff --git a/library/Director/Hook/DeploymentHook.php b/library/Director/Hook/DeploymentHook.php index 937acc83..c8a834bb 100644 --- a/library/Director/Hook/DeploymentHook.php +++ b/library/Director/Hook/DeploymentHook.php @@ -50,4 +50,16 @@ abstract class DeploymentHook $this->onSuccessfulDump($deploymentLog); $this->onSuccessfullDump($deploymentLog); } + + /** + * Please override this method if you want to trigger custom actions + * once success (or failure) information have been collected for a deployed + * stage. startup_succeeded will then be filled, and startup_log might be + * available + * + * @param DirectorDeploymentLog $deployment + */ + public function onCollect(DirectorDeploymentLog $deployment) + { + } }