report.ini¶
This file contains the configuration of report generated by the lapptrack
script. It use a structure similar to what’s found in Microsoft Windows INI
files, and parse with the configparser module of the Python standard library.
See the ‘Supported INI File Structure’ section to have details about the file
format.
The configuration consists of two main sections and one section per handler (send a mail, write in a file, write in a stream) such as below.
Core Section contains configuration items for the report processor
Attributes Section contains contains named keyword used in the template report
Mail Handler Section contains configuration items to send the activity report in a mail
File Handler Section contains configuration items to write the activity report in a file
Stream Handler Section contains configuration items to write the activity report in a stream
The following items details each sections and the associated options, and give an example.
Example of report.ini
# -----------------------------------------------------------------------------
# This ini file contains the configuration details of the report module.
# Only one report and its ways of publication have to define in this file. If
# you need of several report, you must define several configurations file and
# call `Report.load_config()` method for each of them.
# -----------------------------------------------------------------------------
#
# Core section contains configuration items for the report processor.
# handlers (mandatory): is the list of handlers to publish the report. Each
# handler has to have a corresponding section for its own configuration.
# template (optional): is the full path name of the template file. The Report
# class introduction described the format of the template file. The default
# value is 'summary_tmpl.html'.
[core]
handlers = mailhandler,filehandler
;template = summary_tmpl.html
# Attributes section contains named keyword used in the template report (see
# `template` item in the above section. Theses attributes are used in the header
# and tail sections of the report (see `Title`, `BodyStart`, `BodyEnd`, `Tail`
# sections in the template). The 'summary_tmpl.html' doesn't use any additional
# attribute, so this section is empty if you use the default template.
;[attributes]
;about = "Short text to summarize the report content"
# Handlers section contains configuration details for handlers declared in the
# `core`section (see `handlers`item).
# The following sections give an example for each handler supported by the
# `report` module (send a mail, write in a file, write in a stream). Each
# handler section has to define a `class` item.
# Warning: name section must be lowercase, since the section name is a key in
# core section.
#
# Mail handler.
# class: indicates the handler’s class (as determined in the report module).
# By default, the name of the section is used as the class name.
# host (mandatory): is a string containing the full qualified name of the SMTP
# server host, or a 2-tuple containing the full qualified name of the SMTP
# server and the port number to use.
# credentials (optional): is a 2-tuple containing the username and the password
# to connect to the SMTP server.
# from_address(optional): is a string containing the mail addresses of the
# sender. If not specified, the address is set to the local hostname. (see
# smtplib.SMTP())
# mail_sent (optional): is the full path name of the folder where a copy of the
# mail will be written. An empty string does nothing.
# pending_mail (optional): is the full path name of the folder where a copy of
# the mail will be written until it is sent. It avoid to lost mail if the mail
# server configuration is erroneous or if the mail server doesn't answer. An
# empty string does nothing.
# to_addresses (mandatory): is a string or a list containing the mail addresses
# of the recipient.
# subject (optional): is a string containing the mail subject. An empty string
# does nothing.
[mailhandler]
class = MailHandler
host = smtp.example.com
;host = smtp.example.com, 25
;credentials= username, password
;from_address = lappupdate@example.com
;mail_sent = ./mailstore/sent
;pending_mail = ./mailstore/pending
to_addresses = sysadmin@example.com
;to_addresses = sysadmin@example.com, helpdesk@example.com
;subject = lAppUpdate: New Update(s) Alert
# File handler.
# class: indicates the handler’s class (as determined in the report module).
# By default, the name of the section is used as the class name.
# filename (mandatory): is a string containing the full path name of the
# destination file.
# mode (optional): is a string specifying the mode in which the file is opened.
# (see [`open()`](https://docs.python.org/3/library/functions.html#open)
[filehandler]
class = FileHandler
filename = ./tempstore/report.html
;mode = w
# Stream handler.
# class: indicates the handler’s class (as determined in the report module).
# By default, the name of the section is used as the class name.
# stream (optional): is a string specifying the [standard stream](https://docs.
# python.org/3/library/sys.html#sys.stdout) on which report will be written. By
# default, sys.stdout will be used.
[streamhandler]
class = StreamHandler
;stream = sys.stderr
Core Section¶
The [core] section contains configuration items for the report processor.
|
(mandatory) is the list of handlers to publish the report. Each handler has to have a corresponding section for its own configuration. |
|
(optional) is the full path name of the template file. The
Report Template describes the format
of the template file. The default value is
|
Example of a [core] section
[core]
handlers = mailhandler,filehandler
;template = summary_tmpl.html
Attributes Section¶
The [attributes] section contains named keyword used in the template report
(see template item in the Core Section.
Theses attributes are used in the header and tail sections of the report (see
Title, BodyStart, BodyEnd, Tail sections in the
Report Template). The report_template.html doesn’t
use any additional attribute, so this section is empty if you use the default
templates.
Example of a [attributes] section
;[attributes]
;about = "Short text to summarize the report content"
Mail Handler Section¶
The [mailhandler] section contains configuration items to send the activity
report in a mail.
|
(optional) indicates the handler’s class (as determined in the report module). By default, the name of the section is used as the class name. |
|
(mandatory) is a string containing the full qualified name of the SMTP server host, or a 2-tuple containing the full qualified name of the SMTP server and the port number to use. |
|
(optional) is a 2-tuple containing the username and the password to connect to the SMTP server. |
|
(optional) is a string containing the mail addresses of
the sender. If not specified, the address is set to the
local host name. (see |
|
(optional) is the full path name of the folder where a copy of the mail will be written. An empty string does nothing. |
|
(optional) is the full path name of the folder where a copy of the mail will be written until it is sent. It avoid to lost mail if the mail server configuration is erroneous or if the mail server doesn’t answer. An empty string does nothing. |
|
(mandatory) is a string or a list containing the mail addresses of the recipient. |
|
(optional) is a string containing the mail subject. An empty string does nothing. |
Example of a [mailhandler] section
[mailhandler]
class = MailHandler
host = smtp.example.com
;host = smtp.example.com, 25
;credentials= username, password
;from_address = lappupdate@example.com
;mail_sent = ./mailstore/sent
;pending_mail = ./mailstore/pending
to_addresses = sysadmin@example.com
;to_addresses = sysadmin@example.com, helpdesk@example.com
;subject = lAppUpdate: New Update(s) Alert
File Handler Section¶
The [filehandler] section contains configuration items to write the activity
report in a file
|
(optional) indicates the handler’s class (as determined in the report module). By default, the name of the section is used as the class name. |
|
(mandatory) is a string containing the full path name of the destination file. |
|
(optional) is a string specifying the mode in which the
file is opened. (see |
Example of a [filehandler] section
[filehandler]
class = FileHandler
filename = ./tempstore/report.html
;mode = w
Stream Handler Section¶
The [streamhandler] section contains configuration items to write the
activity report in a stream.
|
(optional) indicates the handler’s class (as determined in the report module). By default, the name of the section is used as the class name. |
|
(optional) is a string specifying the |
Example of a [streamhandler] section
[streamhandler]
class = StreamHandler
;stream = sys.stderr