mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-02-18 18:17:51 -05:00
Print redis config file if saving failed (#1272)
If saving the Redis settings fails due to a write error, the desired configuration file content is now displayed so that the user can deploy it manually (Same behavior as with database configuration). For that a catch block is introduced on the `NotWritableError` that is added to `IniWriter::write()` in https://github.com/Icinga/icingaweb2/pull/5404. Refs https://github.com/Icinga/icingaweb2/pull/5404 Resolves #1269
This commit is contained in:
parent
c7cc328bf2
commit
3c7228686c
1 changed files with 13 additions and 0 deletions
|
|
@ -20,6 +20,8 @@ use Icinga\Web\Form;
|
|||
use ipl\Validator\PrivateKeyValidator;
|
||||
use ipl\Validator\X509CertValidator;
|
||||
use Throwable;
|
||||
use Zend_Config_Exception;
|
||||
use Zend_Form_Decorator_Abstract;
|
||||
use Zend_Validate_Callback;
|
||||
|
||||
class RedisConfigForm extends ConfigForm
|
||||
|
|
@ -537,6 +539,17 @@ class RedisConfigForm extends ConfigForm
|
|||
|
||||
try {
|
||||
$connectionConfig->saveIni();
|
||||
} catch (NotWritableError | Zend_Config_Exception $e) {
|
||||
$this->addDecorator('ViewScript', array(
|
||||
'viewModule' => 'default',
|
||||
'viewScript' => 'showConfiguration.phtml',
|
||||
'errorMessage' => $e->getMessage(),
|
||||
'configString' => $connectionConfig,
|
||||
'filePath' => $connectionConfig->getConfigFile(),
|
||||
'placement' => Zend_Form_Decorator_Abstract::PREPEND
|
||||
));
|
||||
|
||||
return false;
|
||||
} catch (Throwable $e) {
|
||||
$this->addError($e->getMessage());
|
||||
Logger::error($e->getMessage());
|
||||
|
|
|
|||
Loading…
Reference in a new issue