mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix rrd version check (#14036)
Remove hardcoded version Add version display in error message
This commit is contained in:
@@ -30,6 +30,7 @@ use Illuminate\Support\Str;
|
|||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
use LibreNMS\Interfaces\Validation;
|
use LibreNMS\Interfaces\Validation;
|
||||||
use LibreNMS\Interfaces\ValidationFixer;
|
use LibreNMS\Interfaces\ValidationFixer;
|
||||||
|
use LibreNMS\Util\Version;
|
||||||
use LibreNMS\ValidationResult;
|
use LibreNMS\ValidationResult;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
|
||||||
@@ -38,13 +39,15 @@ class CheckRrdVersion implements Validation, ValidationFixer
|
|||||||
public function validate(): ValidationResult
|
public function validate(): ValidationResult
|
||||||
{
|
{
|
||||||
// Check that rrdtool config version is what we see
|
// Check that rrdtool config version is what we see
|
||||||
$rrd_version = '0.1'; //Version::get()->rrdtool();
|
$rrd_version = Version::get()->rrdtool();
|
||||||
if (version_compare(Config::get('rrdtool_version'), '1.5.5', '<')
|
$config_version = Config::get('rrdtool_version');
|
||||||
&& version_compare(Config::get('rrdtool_version'), $rrd_version, '>')
|
|
||||||
|
if (version_compare($config_version, '1.5.5', '<')
|
||||||
|
&& version_compare($config_version, $rrd_version, '>')
|
||||||
) {
|
) {
|
||||||
return ValidationResult::fail(
|
return ValidationResult::fail(
|
||||||
trans('validation.validations.rrd.CheckRrdVersion.fail'),
|
trans('validation.validations.rrd.CheckRrdVersion.fail', ['config_version' => $config_version, 'installed_version' => $rrd_version]),
|
||||||
trans('validation.validations.rrd.CheckRrdVersion.fix', ['version' => Config::get('rrdtool_version')])
|
trans('validation.validations.rrd.CheckRrdVersion.fix', ['version' => $config_version])
|
||||||
)->setFixer(__CLASS__, is_writable(base_path('config.php')));
|
)->setFixer(__CLASS__, is_writable(base_path('config.php')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -174,7 +174,7 @@ return [
|
|||||||
'validations' => [
|
'validations' => [
|
||||||
'rrd' => [
|
'rrd' => [
|
||||||
'CheckRrdVersion' => [
|
'CheckRrdVersion' => [
|
||||||
'fail' => 'The rrdtool version you have specified is newer than what is installed.',
|
'fail' => 'The rrdtool version you have specified is newer than what is installed. Config: :config_version Installed :installed_version',
|
||||||
'fix' => 'Either comment out or delete $config[\'rrdtool_version\'] = \':version\'; from your config.php file',
|
'fix' => 'Either comment out or delete $config[\'rrdtool_version\'] = \':version\'; from your config.php file',
|
||||||
'ok' => 'rrdtool version ok',
|
'ok' => 'rrdtool version ok',
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user