Skip to content
Snippets Groups Projects
Commit 58d298aa authored by Tibo's avatar Tibo
Browse files

Handle no update information

parent 59646fdc
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,10 @@ class Updates extends \App\AbstractSensor { ...@@ -33,6 +33,10 @@ class Updates extends \App\AbstractSensor {
} }
$status = $this->parse($record->updates); $status = $this->parse($record->updates);
if ($status == null) {
return self::STATUS_UNKNOWN;
}
if ($status["security"] != 0) { if ($status["security"] != 0) {
return self::STATUS_WARNING; return self::STATUS_WARNING;
} }
...@@ -42,7 +46,10 @@ class Updates extends \App\AbstractSensor { ...@@ -42,7 +46,10 @@ class Updates extends \App\AbstractSensor {
public function parse($string) { public function parse($string) {
$matches = []; $matches = [];
preg_match(self::REGEXP, $string, $matches); if (!preg_match(self::REGEXP, $string, $matches)) {
return null;
}
$result["updates"] = $matches[1]; $result["updates"] = $matches[1];
$result["security"] = $matches[2]; $result["security"] = $matches[2];
return $result; return $result;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment