client.shared.backports: Introduce json module from 2.7

In order to make the autotest client run safely on
python 2.4 systems, introduce the json module from
python 2.7. It's a safer choice than using simpler
approaches to dumping and restoring a json file.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
autotest.client.shared.backports.json.encoder: Silence pylint complaints

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client.shared: Introduce jsontemplate

Our plan is to create a machine consumable file with
relevant summary data of an autotest client job. JSON
is the format of choice for many applications, due to
its simplicity and human readability.

jsontemplate is a simple templating engine that can
help render a nicely, human readable report of the
job data by using the JSON file. Its author, Andy
Chu, graciously agreed with double licensing this
file under both the Apache license version 2 (original
license) and the GPL version 2 (autotest's license).
The reason why it has to be done is that both licenses
have incompatibilities.

CC: Andy Chu <andychup@gmail.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client.shared: Introduce the templates subdir

Our client/tools/html_report.py script gets the job
done, but it is fairly brittle, assembling HTML line
by line. In order to move away from this model, ship
template and auxiliary css and javascript files, that
will be used to assemble the report, more elegantly.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client.shared.base_job: Expose the job status mapping

In order to avoid having multiple, possibly incompatible
job status mapping dicts, expose the mapping present on
base_job. This mapping converts from autotest status
codes to a boolean of whether the operation passed or
not.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client.shared: Introduce a reporting library

Introduce a library specialized in client job reporting
that can:

 * Parse the autotest job 'status' file, using the infra
structure present on client.shared.base_job and create
a json data structure that will be dumped at the same
level of the status file
 * Generate and write an HTML report, pretty similar in
design and structure to the one currently produced by
client/tools/html_report.py.

It sports a more structured and clean approach at
creating these reports, which will help the maintainability
of the code base, and it also opens possibilities, such
as also creating HTML scheduler emails, as well as
output to other formats.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client.job: Use the new report library

Replace the HTML report generation stage with the new
report library API.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Delete client/tools/html_report.py

Remove this implementation of HTML reports creation, as
it's been replaced by client.shared.report interfaces.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
global_config.ini: Create email and notification sections

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Update client.shared.mail

In the hopes of unifying 3 different wrappers to the
standard email library, that do slightly different
things, update the already existing client.shared.mail
library to include:

* An API to send emails
* A class that takes care of sending emails, based
  on settings defined in global_config.ini.

This aims to replace:

* client.shared.base_utils.send_email
* scheduler.email_manager

The API was re-designed, and support of HTML email was
added.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Change server.frontend to use the new mail API

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Remove client.shared.base_utils.send_email API

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
scheduler: Replace email_manager module with mail

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
scheduler.scheduler_models: Change failed/aborted job notification

In order to not spam the job report mailing lists, when
a job failed or aborted, send an email to the autotest
grid admin with the status instead. This way, the grid
admin can take action and eventually fix the problems.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
global_config.ini: Remove unused settings

Now that all reporting code is using the new sections,
EMAIL and NOTIFICATION, we can get rid of the keys
in the other sections.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client.shared.mail: Pass cc_addresses in not. man. object

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>