add check on border-manager service configuration

This commit is contained in:
Nicolas Le Goff
2012-06-13 14:03:46 +02:00
parent 695d99c069
commit b3e97a3e09
2 changed files with 60 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ class module_console_fileEnsureDevSetting extends Command
, 'checkOrmService' , 'checkOrmService'
, 'checkCacheService' , 'checkCacheService'
, 'checkOpcodeCacheService' , 'checkOpcodeCacheService'
, 'checkBorderService'
); );
protected $errors = 0; protected $errors = 0;
protected $alerts = 0; protected $alerts = 0;
@@ -115,6 +116,9 @@ class module_console_fileEnsureDevSetting extends Command
case 'checkOpcodeCacheService' : case 'checkOpcodeCacheService' :
$display = "Opcode"; $display = "Opcode";
break; break;
case 'checkBorderService' :
$display = "Border";
break;
default: default:
throw new \Exception('Unknown test'); throw new \Exception('Unknown test');
break; break;
@@ -192,6 +196,32 @@ class module_console_fileEnsureDevSetting extends Command
$this->verifyCacheOptions($output, $cache); $this->verifyCacheOptions($output, $cache);
} }
private function checkBorderService(OutputInterface $output)
{
$serviceName = $this->configuration->getBorder();
$configuration = $this->configuration->getService($serviceName);
$listChecks = false;
try {
$service = Core\Service\Builder::create(\bootstrap::getCore(), $configuration);
$work_message = '<info>Works !</info>';
$listChecks = true;
} catch (\Exception $e) {
$work_message = '<error>Failed - could not load Border Manager service !</error>';
$this->errors ++;
}
$output->writeln(sprintf("\t--> Verify Border Manager<info>%s</info> : %s", $serviceName, $work_message));
if ($listChecks) {
$borderManager = $service->getDriver();
foreach ($service->getUnregisteredCheckers() as $check) {
$output->writeln(sprintf("\t\t--> <comment>check %s could not be loaded for the following reason %s</comment>", $check['checker'], $check['message']));
}
}
}
private function checkPhraseanetScope(OutputInterface $output) private function checkPhraseanetScope(OutputInterface $output)
{ {
$required = array('servername', 'maintenance', 'debug', 'display_errors', 'database'); $required = array('servername', 'maintenance', 'debug', 'display_errors', 'database');

View File

@@ -39,6 +39,7 @@ class module_console_fileEnsureProductionSetting extends Command
, 'checkOrmService' , 'checkOrmService'
, 'checkCacheService' , 'checkCacheService'
, 'checkOpcodeCacheService' , 'checkOpcodeCacheService'
, 'checkBorderService'
); );
protected $errors = 0; protected $errors = 0;
protected $alerts = 0; protected $alerts = 0;
@@ -113,6 +114,9 @@ class module_console_fileEnsureProductionSetting extends Command
case 'checkOpcodeCacheService' : case 'checkOpcodeCacheService' :
$display = "Opcode"; $display = "Opcode";
break; break;
case 'checkBorderService' :
$display = "Border";
break;
default: default:
throw new \Exception('Unknown test'); throw new \Exception('Unknown test');
break; break;
@@ -188,6 +192,32 @@ class module_console_fileEnsureProductionSetting extends Command
$this->verifyCacheOptions($output, $cache); $this->verifyCacheOptions($output, $cache);
} }
private function checkBorderService(OutputInterface $output)
{
$serviceName = $this->configuration->getBorder();
$configuration = $this->configuration->getService($serviceName);
$listChecks = false;
try {
$service = Core\Service\Builder::create(\bootstrap::getCore(), $configuration);
$work_message = '<info>Works !</info>';
$listChecks = true;
} catch (\Exception $e) {
$work_message = '<error>Failed - could not load Border Manager service !</error>';
$this->errors ++;
}
$output->writeln(sprintf("\t--> Verify Border Manager<info>%s</info> : %s", $serviceName, $work_message));
if ($listChecks) {
$borderManager = $service->getDriver();
foreach ($service->getUnregisteredCheckers() as $check) {
$output->writeln(sprintf("\t\t--> <comment>check %s could not be loaded for the following reason %s</comment>", $check['checker'], $check['message']));
}
}
}
private function checkPhraseanetScope(OutputInterface $output) private function checkPhraseanetScope(OutputInterface $output)
{ {
$required = array('servername', 'maintenance', 'debug', 'display_errors', 'database'); $required = array('servername', 'maintenance', 'debug', 'display_errors', 'database');