setup: Don't fail if only a module couldn't be enabled
This commit is contained in:
parent
32f9ce8b7c
commit
01a08d60e1
|
@ -5,6 +5,7 @@ namespace Icinga\Module\Setup\Utils;
|
|||
|
||||
use Exception;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\IcingaException;
|
||||
use Icinga\Module\Setup\Step;
|
||||
|
||||
|
@ -16,6 +17,8 @@ class EnableModuleStep extends Step
|
|||
|
||||
protected $errors;
|
||||
|
||||
protected $warnings;
|
||||
|
||||
public function __construct(array $moduleNames)
|
||||
{
|
||||
$this->moduleNames = $moduleNames;
|
||||
|
@ -35,6 +38,8 @@ class EnableModuleStep extends Step
|
|||
foreach ($this->moduleNames as $moduleName) {
|
||||
try {
|
||||
$moduleManager->enableModule($moduleName);
|
||||
} catch (ConfigurationError $e) {
|
||||
$this->warnings[$moduleName] = $e;
|
||||
} catch (Exception $e) {
|
||||
$this->errors[$moduleName] = $e;
|
||||
$success = false;
|
||||
|
@ -59,6 +64,9 @@ class EnableModuleStep extends Step
|
|||
if (isset($this->errors[$moduleName])) {
|
||||
$report[] = sprintf($failMessage, $moduleName);
|
||||
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->errors[$moduleName]));
|
||||
} elseif (isset($this->warnings[$moduleName])) {
|
||||
$report[] = sprintf($failMessage, $moduleName);
|
||||
$report[] = sprintf(mt('setup', 'WARNING: %s'), $this->warnings[$moduleName]->getMessage());
|
||||
} else {
|
||||
$report[] = sprintf($okMessage, $moduleName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue