mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: ping fails on servers that don't set PATH in cron (#7603)
* fix: ping fails on servers that don't set PATH in cron Find the full path to fping and persist it in the database. Adds the ability to persist settings with Config::set() * Add ability to set webui settings. No display of for paths, because it would be inconsistent.
This commit is contained in:
committed by
Neil Lathwood
parent
47b999cebd
commit
fb45f00340
@@ -119,6 +119,29 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals("I'll be there", $config['you']['and']['me']);
|
||||
}
|
||||
|
||||
public function testSetPersist()
|
||||
{
|
||||
if (getenv('DBTEST')) {
|
||||
dbConnect();
|
||||
dbBeginTransaction();
|
||||
} else {
|
||||
$this->markTestSkipped('Database tests not enabled. Set DBTEST=1 to enable.');
|
||||
}
|
||||
|
||||
$key = 'testing.persist';
|
||||
|
||||
dbDelete('config', '`config_name`=?', array($key)); // FIXME dbInsert breaks transactions
|
||||
$this->assertNull(dbFetchCell('SELECT `config_value` FROM `config` WHERE `config_name`=?', array($key)), "$key should not be set, clean database");
|
||||
Config::set($key, 'one', true);
|
||||
$this->assertEquals('one', dbFetchCell('SELECT `config_value` FROM `config` WHERE `config_name`=?', array($key)));
|
||||
Config::set($key, 'two', true);
|
||||
$this->assertEquals('two', dbFetchCell('SELECT `config_value` FROM `config` WHERE `config_name`=?', array($key)));
|
||||
|
||||
if (getenv('DBTEST')) {
|
||||
dbRollbackTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
public function testHas()
|
||||
{
|
||||
Config::set('long.key.setting', 'no one cares');
|
||||
|
Reference in New Issue
Block a user