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

Handle case where client is run without sudo

parent ba593c5f
No related branches found
No related tags found
No related merge requests found
Pipeline #3109 passed
......@@ -215,10 +215,13 @@ class Server extends Model
const UUID = "/\s*UUID: (.*)/m";
public function parseUUID(string $string)
public function parseUUID(string $string) : string
{
$matches = array();
preg_match(self::UUID, $string, $matches);
if (! isset($matches[1])) {
return "unknown";
}
return $matches[1];
}
......@@ -294,10 +297,14 @@ class Server extends Model
const REGEX_MANUFACTURER = "/^\s*Manufacturer: (.*)$/m";
public function parseManufacturer($string)
public function parseManufacturer(string $string) : string
{
$matches = [];
preg_match(self::REGEX_MANUFACTURER, $string, $matches);
if (!isset($matches[1])) {
return "unkwnown";
}
return $matches[1];
}
......@@ -312,10 +319,13 @@ class Server extends Model
}
const REGEX_PRODUCT_NAME = "/^\s*Product Name: (.*)$/m";
public function parseProductName($string)
public function parseProductName(string $string) : string
{
$matches = [];
preg_match(self::REGEX_PRODUCT_NAME, $string, $matches);
if (!isset($matches[1])) {
return "unkwnown";
}
return $matches[1];
}
......
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