The Exemption_Notifier command line interface (CLI)
The Exemption Notifier is a CLI tool that sends e-mail alerts when a TIssue exemption for a particular system is about to expire.
This tool uses the following packages and API:
- the py_cmd_util parsing tools package is used (see http://tissue.fnal.gov/py_cmd_util/pyCmd.html)
to process command line options;
- the tissue API is used to extract information about a tissue exemptions from TIssue;
- the tissue MISCOMP API is used to query the Oracle Fermilab MISCOMP database regarding e-mail addressee;
- the NIMI logger package is used to keep the output information from wrapped shell script
in rotational log-files with time and date.
The list of components:
- The wrapper shell script which was design to use with crontab or other job schedulers to verify expiration date of all Tissue exemption;
- The emxeption Notifier - python code which designed to select Tissue exemptions based on the command line (CLI) options and send the e-mail notification about expiration date of particular exemption;
- The email template file ;
- The exemption type aliases file;
- The test suite shell script with test email template for testing all options according to requirement specification;
- The Logger - python code which support rotational log files with time and date.
CLI options and arguments description:
Exemption Notifier accepts a variety of command line options and arguments to indicate how the tool
should operate. Incorrect use of command line arguments will be identified and processed by the py cmd_util package.
The CLI commands are separated into three categories: Exemption filters, Flags and Definitions. Any number of
Exemption filter’s arguments can be selected by the user and the combination of them will be considered as logical AND.
1 Exemption filters:
--exmp_id = is an optional argument that limits processing to particular exemptions id’s.
The default value is to process all exemption id’s. If this argument is present, then only exemptions of the supplied id
will be considered. The argument can be a list to allow for multiple id’s.
--exmp_type= is an optional argument that limits processing of exemption types. The default value is to process
all exemption types. If this argument is present, then only exemptions of the supplied type will be considered.
The code must allow for both a short and long name for exemption types which are defined in special file :” exemption_types_aliases”
The short name will be one character, the long name will essentially be the name of the exemption.
--system_name= is an optional argument that limits processing to particular systems. The default
value is to process all systems. If this argument is present, then only exemptions of the supplied system will be considered.
The argument can be a list (formatted as a python list) to allow for multiple systems.
--exmp_behavior= is an optional argument that limits processing to exemptions of a particular behavior.
The default value is to process exemptions regardless of the defined behavior. If this argument is supplied,
then only exemptions that match this behavior will be considered for processing.
-d : is an optional flag that allows to print additional and useful debugging information to the output stream.
-v : is optional flag that allows to print information about each exemption with an indication as
to whether or not a notification would have been sent. Can be used for exemption inventory with
specific exemption selection by CLI options.
-n : is an optional flag that will suppress sending email. This flag, and the two arguments: --email_to and --email_cc,
are restricted to use in the same command (mutually exclusive).
--template= is a required argument which specifies location and file name of e-mail message.
It can be defined by an environment variable “EMAIL_TEMPLATE”. The template allows for tokenized three
parameters: exemption id, system name and expiration date. The location of the email template can be
specified by either an environment variable or a command line option. If a command line option is supplied,
it takes precedence over the environment variable.
--exp_in_days= <OR> --exp_in_weeks= are two allowed arguments which define when an exemption is about to expire.
These arguments are given in days or weeks. Only ONE of these arguments is required to be in the command line.
--log_file= is an optional argument that specifies the path where the log-file should be located and file
name of the log-file. The default is “./log/Exemption_Notifier.log”
--email_to= is the optional argument that directs where the email is sent to.
The default is to send the email to the primary system administrator or system owner as defined in MISCOMP.
--email_cc= is the optional argument that directs where the copy of e-mail is sent to.
The default is no copy e-mail.