Tartarus supplier reports
The primary function of the Tartarus supplier reports is to automatically determine the MAC addresses of PCs purchased from the
SelectPC supplier (currently Hewlett Packard). This allows us to set the
dhclient.mac
value in a machine's LCFG profile without first powering the machine on.
Incoming mail handling
A report has been created on the HP order management portal which periodically (currently weekly) returns information on
SelectPCs (eg. purchase order, serial number, mac address) by email to
tartarus-supplier@inf.ed.ac.uk
. This email address is an alias which is configured to forward the email to a CGI script on the Tartarus server by means of a kerberos authenticated HTTP POST. The
/disk/mailraid/scripts/krbcurl
script is used to perform this HTTP POST.
Reception at Tartarus server
The CGI script
/cgi-bin/krbsecured/submitsupplierreport
in the Tartarus web root (
/usr/lib/tartarus/web
) accepts the incoming HTTP POST. This script stashes the incoming email in a sub-directory of
/var/tartarus/supplierreports
- which sub-directory depends on the source email address. The file
/etc/tartarus/supplierreports
defines the mapping between source mail addresses and stash sub-directory. The email is saved in a file with a filename of the date the email was sent.
Processing of incoming supplier reports
The script
/usr/lib/tartarus/bin/loadsupplierreport
is called by cron on a daily basis. It checks one or more of the sub-directories
/var/tartarus/supplierreports
for new incoming mail files, processes those files, loads any data into the
supplier_report
table and renames the processed files with a '.seen' suffix. As the format of the supplier report mail will differ depending on the mail source, each sub-directory is handled by a different Perl module in
/usr/share/perl5/vendor_perl/Tartarus/LoadSupplierReport
.
For example, the current HP Select PC reports are sent by
HP OrderStatus <do-not-reply-orderstatus@hp.com>
, stashed into
/var/tartarus/supplierreports/hp19
and processed by
/usr/share/perl5/vendor_perl/Tartarus/LoadSupplierport/hp19.pm
--
AlastairScobie - 20 Sep 2019