Skip to content

Commit aac15c2

Browse files
committed
Added initial OPERATINGSYSTEM stuff
1 parent 37d9f2d commit aac15c2

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

inventoryformat/InventoryFormat.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ InventoryFormat::Build(bool noSoftware)
9292
fContent->LinkEndChild(versionClient);
9393
_AddAccountInfo();
9494
_AddBIOSInfo();
95+
_AddOperatingSystemInfo();
9596
_AddCPUsInfo();
9697
_AddStoragesInfo();
9798
_AddDrivesInfo();
@@ -445,6 +446,54 @@ InventoryFormat::_AddBIOSInfo()
445446
}
446447

447448

449+
void
450+
InventoryFormat::_AddOperatingSystemInfo()
451+
{
452+
tinyxml2::XMLElement* os = fDocument->NewElement("OPERATINGSYSTEM");
453+
fContent->LinkEndChild(os);
454+
455+
tinyxml2::XMLElement* arch = fDocument->NewElement("ARCH");
456+
arch->LinkEndChild(fDocument->NewText(gComponents["OS"].fields["architecture"].c_str()));
457+
os->LinkEndChild(arch);
458+
459+
tinyxml2::XMLElement* name = fDocument->NewElement("NAME");
460+
name->LinkEndChild(fDocument->NewText(gComponents["OS"].fields["description"].c_str()));
461+
os->LinkEndChild(name);
462+
463+
tinyxml2::XMLElement* kernelName = fDocument->NewElement("KERNEL_NAME");
464+
kernelName->LinkEndChild(fDocument->NewText(gComponents["OS"].fields["kernelname"].c_str()));
465+
os->LinkEndChild(kernelName);
466+
467+
tinyxml2::XMLElement* kernelVersion = fDocument->NewElement("KERNEL_VERSION");
468+
kernelVersion->LinkEndChild(fDocument->NewText(gComponents["OS"].fields["release"].c_str()));
469+
os->LinkEndChild(kernelVersion);
470+
471+
tinyxml2::XMLElement* dnsDomain = fDocument->NewElement("DNS_DOMAIN");
472+
dnsDomain->LinkEndChild(fDocument->NewText(gComponents["OS"].fields["domainname"].c_str()));
473+
os->LinkEndChild(dnsDomain);
474+
475+
tinyxml2::XMLElement* fqdn = fDocument->NewElement("FQDN");
476+
std::string fqdnString;
477+
fqdnString.append(gComponents["OS"].fields["hostname"]).append(gComponents["OS"].fields["domainname"]);
478+
fqdn->LinkEndChild(fDocument->NewText(fqdnString.c_str()));
479+
os->LinkEndChild(fqdn);
480+
481+
#if 0
482+
// TODO: Impelement these
483+
<BOOT_TIME>2024-03-26 07:58:04</BOOT_TIME>
484+
<FULL_NAME>
485+
<HOSTID>
486+
<INSTALL_DATE>
487+
<NAME>
488+
<SSH_KEY>
489+
<TIMEZONE>
490+
<NAME>Europe/Rome</NAME>
491+
<OFFSET>+0100</OFFSET>
492+
</TIMEZONE>
493+
#endif
494+
}
495+
496+
448497
void
449498
InventoryFormat::_AddCPUsInfo()
450499
{

inventoryformat/InventoryFormat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class InventoryFormat {
3939

4040
void _AddAccountInfo();
4141
void _AddBIOSInfo();
42+
void _AddOperatingSystemInfo();
4243
void _AddCPUsInfo();
4344
void _AddStoragesInfo();
4445
void _AddMemoriesInfo();

0 commit comments

Comments
 (0)