Project native FreeBSD packages, interfaces, hardware and login observations
This commit is contained in:
@@ -14,7 +14,15 @@ function values(value: unknown) {
|
||||
return Array.isArray(value) ? value.flatMap(value => text(value) ?? []) : [];
|
||||
}
|
||||
|
||||
function observation(device: RecordValue, name: string) {
|
||||
function observation(device: RecordValue, name: string): RecordValue | undefined {
|
||||
if (device.source_id === 'opnsense.base') {
|
||||
const inv = object(device.inventory);
|
||||
if (name === 'hardware' || name === 'os') return { data: inv.hardware };
|
||||
const report = object(inv[name]);
|
||||
if (report.status === 'ok' || report.status === 'partial')
|
||||
return { data: report.entries, truncated: report.status === 'partial' };
|
||||
return undefined;
|
||||
}
|
||||
const observations = object(device.inventory).observations;
|
||||
return Array.isArray(observations) ? observations.map(object).find(item =>
|
||||
item.quality === 'valid' && (item.scope === 'linux.' + name || item.scope === 'windows.' + name)
|
||||
|
||||
Reference in New Issue
Block a user