mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Detect if LibreNMS is installed from the official Docker image (librenms/docker#46) (#10879)
This commit is contained in:
@@ -45,4 +45,14 @@ class Env
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if LibreNMS is installed from the official Docker image.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function librenmsDocker()
|
||||
{
|
||||
return getenv('LIBRENMS_DOCKER') === '1';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
namespace LibreNMS\Validations;
|
||||
|
||||
use LibreNMS\Util\Env;
|
||||
use LibreNMS\Util\Git;
|
||||
use LibreNMS\ValidationResult;
|
||||
use LibreNMS\Validator;
|
||||
@@ -39,6 +40,11 @@ class Dependencies extends BaseValidation
|
||||
*/
|
||||
public function validate(Validator $validator)
|
||||
{
|
||||
if (Env::librenmsDocker()) {
|
||||
$validator->ok("Installed from the official Docker image; no Composer required");
|
||||
return;
|
||||
}
|
||||
|
||||
# if git is not installed, do not assume composer is either
|
||||
if (!Git::repoPresent()) {
|
||||
$validator->ok("Installed from package; no Composer required");
|
||||
|
||||
@@ -29,6 +29,7 @@ use DateTime;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Util\Env;
|
||||
use LibreNMS\Util\Git;
|
||||
use LibreNMS\ValidationResult;
|
||||
use LibreNMS\Validator;
|
||||
@@ -37,6 +38,11 @@ class Updates extends BaseValidation
|
||||
{
|
||||
public function validate(Validator $validator)
|
||||
{
|
||||
if (Env::librenmsDocker()) {
|
||||
$validator->warn('Updates are managed through the official Docker image');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Git::repoPresent()) {
|
||||
$validator->warn('Non-git install, updates are manual or from package');
|
||||
return;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
namespace LibreNMS\Validations;
|
||||
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Util\Env;
|
||||
use LibreNMS\Util\Git;
|
||||
use LibreNMS\ValidationResult;
|
||||
use LibreNMS\Validator;
|
||||
@@ -60,6 +61,11 @@ class User extends BaseValidation
|
||||
}
|
||||
}
|
||||
|
||||
// skip if docker image
|
||||
if (Env::librenmsDocker()) {
|
||||
return;
|
||||
}
|
||||
|
||||
# if no git, then we probably have different permissions by design
|
||||
if (!Git::repoPresent()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user