summaryrefslogtreecommitdiffstats
path: root/server/api/registration.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/api/registration.js')
-rw-r--r--server/api/registration.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index ee1f15b..4897bb5 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -12,7 +12,8 @@ const config = require(path.join(__appdir, 'config', 'config'))
const url = config.https.host // + ':' + config.https.port
const log = require(path.join(__appdir, 'lib', 'log'))
const HttpResponse = require(path.join(__appdir, 'lib', 'httpresponse'))
-// const pci = require(path.join(__appdir, 'lib', 'pci')) // This is needed for parsing vendor/product codes (not required for now)
+// This is needed for parsing vendor/product codes
+const pci = require(path.join(__appdir, 'lib', 'pci'))
// Permission check middleware
router.all(['', '/hooks', '/:y', '/hooks/:x'], async (req, res, next) => {
@@ -338,7 +339,7 @@ noAuthRouter.postAsync('/clients/:uuid', async (req, res) => {
let client = {}
if (req.body.version && req.body.version >= 2) {
/* New hardware collection script */
- client = parseHardwareInformation(req.body)
+ client = await parseHardwareInformation(req.body)
} else {
/* OLD SCRIPT */
client = req.body.client
@@ -491,7 +492,7 @@ function getRecursiveParents (groupIds) {
/*
* New mehthod for preparing the new json formatted hw information
*/
-function parseHardwareInformation (data) {
+async function parseHardwareInformation (data) {
let client = {
'parents': [], // TODO:
'type': '', // SERVER OR CLIENT
@@ -569,7 +570,7 @@ function parseHardwareInformation (data) {
let drive = {
'model': '',
'family': '', // NEW
- 'firmware': '', // NEW maybe save in desc?
+ 'firmware': '',
'serial': '', // TODO: Update this to serialnumber to unify (also need to be changed in the idoit backend then)
'capacity': '',
'unit': '',
@@ -623,6 +624,16 @@ function parseHardwareInformation (data) {
}
/* lspci */
+ for (let obj of data.lspci) {
+ /* GPU */
+ if (obj.class === '0300') {
+ const parsedPci = await pci.parseIds(obj.vendor, obj.device)
+ client.gpus.push({
+ 'manufacturer': parsedPci.vendor.name,
+ 'model': parsedPci.vendor.device.name
+ })
+ }
+ }
/* ip */
for (let ip of data.ip) {