1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Command to verify the existence of an a application in a Cloud Foundry. |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Graviton\Deployment\Command\CloudFoundry; |
7
|
|
|
|
8
|
|
|
use Graviton\Deployment\Command\AbstractCommand; |
9
|
|
|
use Graviton\Deployment\Steps\CloudFoundry\StepApp; |
10
|
|
|
use Graviton\Deployment\Steps\CloudFoundry\StepLogin; |
11
|
|
|
use Graviton\Deployment\Steps\CloudFoundry\StepLogout; |
12
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
13
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
14
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @author List of contributors <https://github.com/libgraviton/deploy-scripts/graphs/contributors> |
18
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
19
|
|
|
* @link http://swisscom.ch |
20
|
|
|
*/ |
21
|
|
|
final class CheckApplicationCommand extends AbstractCommand |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Configures the current command. |
25
|
|
|
* |
26
|
|
|
* @return void |
27
|
|
|
*/ |
28
|
2 |
|
protected function configure() |
29
|
|
|
{ |
30
|
2 |
|
$this |
31
|
2 |
|
->setName('graviton:deployment:cf:checkApplication') |
32
|
2 |
|
->setDescription('Determines, if a special CF application is alive.') |
33
|
2 |
|
->addArgument( |
34
|
2 |
|
'applicationName', |
35
|
2 |
|
InputArgument::REQUIRED, |
36
|
|
|
'Which application shall be checked?' |
37
|
2 |
|
) |
38
|
2 |
|
->addArgument( |
39
|
2 |
|
'slice', |
40
|
2 |
|
InputArgument::REQUIRED, |
41
|
|
|
'Which deployed slice (green or blue) do you want to check?' |
42
|
2 |
|
); |
43
|
2 |
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Executes the current command. |
47
|
|
|
* |
48
|
|
|
* @param InputInterface $input User input on console |
49
|
|
|
* @param OutputInterface $output Output of the command |
50
|
|
|
* |
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
1 |
|
protected function execute(InputInterface $input, OutputInterface $output) |
54
|
|
|
{ |
55
|
1 |
|
$applicationName = $input->getArgument('applicationName'); |
56
|
1 |
|
$slice = $input->getArgument('slice'); |
57
|
|
|
|
58
|
1 |
|
$this->addStep(new StepLogin($this->configuration)) |
59
|
1 |
|
->addStep(new StepApp($this->configuration, $applicationName, $slice)) |
60
|
1 |
|
->addStep(new StepLogout($this->configuration)); |
61
|
1 |
|
$this->setStartMessage('Application health check. Stated messages:'); |
62
|
1 |
|
parent::execute($input, $output); |
63
|
1 |
|
} |
64
|
|
|
} |
65
|
|
|
|