Wizard: Use IcingaException::describe() in the finish's log where appropriate

fixes #9791
This commit is contained in:
Johannes Meyer 2015-08-05 15:54:45 +02:00
parent 3d846ea270
commit e2e1692462
8 changed files with 19 additions and 11 deletions

View File

@ -6,6 +6,7 @@ namespace Icinga\Module\Monitoring;
use Exception;
use Icinga\Module\Setup\Step;
use Icinga\Application\Config;
use Icinga\Exception\IcingaException;
class BackendStep extends Step
{
@ -151,7 +152,7 @@ class BackendStep extends Step
),
Config::resolvePath('modules/monitoring/backends.ini')
);
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->backendIniError->getMessage());
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->backendIniError));
}
if ($this->resourcesIniError === false) {
@ -164,7 +165,7 @@ class BackendStep extends Step
mt('monitoring', 'Resource configuration could not be udpated: %s. An error occured:'),
Config::resolvePath('resources.ini')
);
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->resourcesIniError->getMessage());
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->resourcesIniError));
}
return $report;

View File

@ -6,6 +6,7 @@ namespace Icinga\Module\Monitoring;
use Exception;
use Icinga\Module\Setup\Step;
use Icinga\Application\Config;
use Icinga\Exception\IcingaException;
class InstanceStep extends Step
{
@ -98,7 +99,7 @@ class InstanceStep extends Step
),
Config::resolvePath('modules/monitoring/instances.ini')
),
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->error))
);
}
}

View File

@ -6,6 +6,7 @@ namespace Icinga\Module\Monitoring;
use Exception;
use Icinga\Module\Setup\Step;
use Icinga\Application\Config;
use Icinga\Exception\IcingaException;
class SecurityStep extends Step
{
@ -76,7 +77,7 @@ class SecurityStep extends Step
),
Config::resolvePath('modules/monitoring/config.ini')
),
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->error))
);
}
}

View File

@ -7,6 +7,7 @@ use Exception;
use Icinga\Application\Config;
use Icinga\Data\ConfigObject;
use Icinga\Data\ResourceFactory;
use Icinga\Exception\IcingaException;
use Icinga\Authentication\User\DbUserBackend;
use Icinga\Module\Setup\Step;
@ -194,7 +195,7 @@ class AuthenticationStep extends Step
mt('setup', 'Authentication configuration could not be written to: %s. An error occured:'),
Config::resolvePath('authentication.ini')
);
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->authIniError->getMessage());
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->authIniError));
}
if ($this->dbError === false) {
@ -207,7 +208,7 @@ class AuthenticationStep extends Step
mt('setup', 'Unable to create account "%s". An error occured:'),
$this->data['adminAccountData']['username']
);
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->dbError->getMessage());
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->dbError));
}
if ($this->permIniError === false) {
@ -229,7 +230,7 @@ class AuthenticationStep extends Step
),
$this->data['adminAccountData']['groupname']
);
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->permIniError->getMessage());
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->permIniError));
}
return $report;

View File

@ -5,6 +5,7 @@ namespace Icinga\Module\Setup\Steps;
use Exception;
use PDOException;
use Icinga\Exception\IcingaException;
use Icinga\Module\Setup\Step;
use Icinga\Module\Setup\Utils\DbTool;
use Icinga\Module\Setup\Exception\SetupException;
@ -253,7 +254,7 @@ class DatabaseStep extends Step
} elseif ($this->error !== null) {
$report = $this->messages;
$report[] = mt('setup', 'Failed to fully setup the database. An error occured:');
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage());
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->error));
return $report;
}
}

View File

@ -6,6 +6,7 @@ namespace Icinga\Module\Setup\Steps;
use Exception;
use Icinga\Application\Logger;
use Icinga\Application\Config;
use Icinga\Exception\IcingaException;
use Icinga\Module\Setup\Step;
class GeneralConfigStep extends Step
@ -112,7 +113,7 @@ class GeneralConfigStep extends Step
mt('setup', 'General configuration could not be written to: %s. An error occured:'),
Config::resolvePath('config.ini')
),
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->error))
);
}
}

View File

@ -5,6 +5,7 @@ namespace Icinga\Module\Setup\Steps;
use Exception;
use Icinga\Application\Config;
use Icinga\Exception\IcingaException;
use Icinga\Module\Setup\Step;
class ResourceStep extends Step
@ -143,7 +144,7 @@ class ResourceStep extends Step
mt('setup', 'Resource configuration could not be written to: %s. An error occured:'),
Config::resolvePath('resources.ini')
),
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->error))
);
}
}

View File

@ -5,6 +5,7 @@ namespace Icinga\Module\Setup\Utils;
use Exception;
use Icinga\Application\Icinga;
use Icinga\Exception\IcingaException;
use Icinga\Module\Setup\Step;
class EnableModuleStep extends Step
@ -57,7 +58,7 @@ class EnableModuleStep extends Step
foreach ($this->moduleNames as $moduleName) {
if (isset($this->errors[$moduleName])) {
$report[] = sprintf($failMessage, $moduleName);
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->errors[$moduleName]->getMessage());
$report[] = sprintf(mt('setup', 'ERROR: %s'), IcingaException::describe($this->errors[$moduleName]));
} else {
$report[] = sprintf($okMessage, $moduleName);
}