mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
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 Exception;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Module\Setup\Step;
|
use Icinga\Module\Setup\Step;
|
||||||
|
|
||||||
@ -16,6 +17,8 @@ class EnableModuleStep extends Step
|
|||||||
|
|
||||||
protected $errors;
|
protected $errors;
|
||||||
|
|
||||||
|
protected $warnings;
|
||||||
|
|
||||||
public function __construct(array $moduleNames)
|
public function __construct(array $moduleNames)
|
||||||
{
|
{
|
||||||
$this->moduleNames = $moduleNames;
|
$this->moduleNames = $moduleNames;
|
||||||
@ -35,6 +38,8 @@ class EnableModuleStep extends Step
|
|||||||
foreach ($this->moduleNames as $moduleName) {
|
foreach ($this->moduleNames as $moduleName) {
|
||||||
try {
|
try {
|
||||||
$moduleManager->enableModule($moduleName);
|
$moduleManager->enableModule($moduleName);
|
||||||
|
} catch (ConfigurationError $e) {
|
||||||
|
$this->warnings[$moduleName] = $e;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[$moduleName] = $e;
|
$this->errors[$moduleName] = $e;
|
||||||
$success = false;
|
$success = false;
|
||||||
@ -59,6 +64,9 @@ class EnableModuleStep extends Step
|
|||||||
if (isset($this->errors[$moduleName])) {
|
if (isset($this->errors[$moduleName])) {
|
||||||
$report[] = sprintf($failMessage, $moduleName);
|
$report[] = sprintf($failMessage, $moduleName);
|
||||||
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->errors[$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 {
|
} else {
|
||||||
$report[] = sprintf($okMessage, $moduleName);
|
$report[] = sprintf($okMessage, $moduleName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user