Hello,
I created a plugin that retrieves info about apt updates.
Plugin is installed on the server (the section has been added in GUI, the database has been created etc).
Client-side, I edited modules.conf and added the pm file..
Running ocsinventory-agent returns "error cannot establish communication : 500 Internal Server Error".
With the --debug flag, I see the relevant XML section added to the final XML.
<APT>
<LAST_APT_UPDATE>1970-01-01 01:00:00</LAST_APT_UPDATE>
<PENDING_SECURITY_UPDATES>0</PENDING_SECURITY_UPDATES>
<PENDING_UPDATES>9</PENDING_UPDATES>
<REBOOT_REQUIRED>0</REBOOT_REQUIRED>
</APT>
The error is not present on a client that does not have the plugin.
I suppose there is an error while inserting data in the database (maybe an error in Map.pm ?), but I don't know how to get logs / increase verbosity.
# extract of install.php
function extension_install_apt()
{
$commonObject = new ExtensionCommon();
$commonObject -> sqlQuery(
"CREATE TABLE IF NOT EXISTS `apt` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`HARDWARE_ID` INT(11) NOT NULL,
`LAST_APT_UPDATE` VARCHAR(255) DEFAULT NULL,
`PENDING_UPDATES` INT(11) DEFAULT NULL,
`PENDING_SECURITY_UPDATES` INT(11) DEFAULT NULL,
`REBOOT_REQUIRED` BOOLEAN DEFAULT NULL,
PRIMARY KEY (`ID`,`HARDWARE_ID`)
) ENGINE=INNODB ;"
);
}
# extract of Map.pm
$DATA_MAP{apt} = {
mask => 0,
multi => 1,
auto => 1,
delOnReplace => 1,
sortBy => 'LAST_APT_UPDATE',
writeDiff => 0,
cache => 0,
fields => {
LAST_APT_UPDATE => {},
PENDING_UPDATES => {},
PENDING_SECURITY_UPDATES => {},
REBOOT_REQUIRED => {}
}
};
1;
I use a docker container by the way (version 2.12).
Thank you,