summaryrefslogtreecommitdiffstats
path: root/library/Director/Hook/DeploymentHook.php
blob: c8a834bb339082f9000a20d8c9f3490120b1acb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php

namespace Icinga\Module\Director\Hook;

use Icinga\Module\Director\Objects\DirectorDeploymentLog;

abstract class DeploymentHook
{
    /**
     * Please override this method if you want to change the behaviour
     * of the deploy (stop it by throwing an exception for some reason)
     *
     * @param DirectorDeploymentLog $deployment
     */
    public function beforeDeploy(DirectorDeploymentLog $deployment)
    {
    }

    /**
     * Please override this method if you want to trigger custom actions
     * on a successful dump of the Icinga configuration
     *
     * @param DirectorDeploymentLog $deployment
     */
    public function onSuccessfulDump(DirectorDeploymentLog $deployment)
    {
    }

    /**
     * There is a typo in this method name, do not use this.
     *
     * @deprecated Please use onSuccessfulDump
     * @param DirectorDeploymentLog $deployment
     */
    public function onSuccessfullDump(DirectorDeploymentLog $deployment)
    {
    }

    /**
     * Compatibility helper
     *
     * The initial version of this hook had a typo in the onSuccessfulDump method
     * That's why we call this hook, which then calls both the correct and the
     * erroneous method to make sure that we do not break existing implementations.
     *
     * @param DirectorDeploymentLog $deploymentLog
     */
    final public function triggerSuccessfulDump(DirectorDeploymentLog $deploymentLog)
    {
        $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)
    {
    }
}