client.tools: Fix python 2.4 incompatible constructs

Only later I realized that the recent jenkins integration
scripts were using the python keyword 'with', illegal
in python 2.4. So, in order to keep our 2.4 pylint results
as clean as possible, I replaced the uses of the mentioned
keyword with legal 2.4 code.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client.shared.backports_unittest: Supress pylint E0602

Python 2.4 systems won't have bin, but the unittest takes
this into account on such systems. It is safe to ignore it.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Fixing the remaining pylint errors under python 2.4

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils/unittest_suite.py: Add tests to the REQUIRES_DJANGO list

With recent refactorings, a couple of the unittests started
to require Django. Let's move them accordingly to the right
set.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client/shared/distro_def.py: added new module

This module defines a structure and portable format for storing
relevant information on Linux Distributions.

The main goal is to be able to create a knowledge base of Linux
Distributions, either to be added to an official archive, or
created by local users.

This information will be used by the component isolation feature
to record differences on the systems running tests against the
distro official characteristics.

Changes from v1:
   * whitespace cleanup

Signed-off-by: Cleber Rosa <crosa@redhat.com>
client: autotest distro def utilities

These two scripts allows one to create and view distro definition
files. To create a new distro definition file one must have local
access to the distro installation tree. All package files will be
queried for the needed information.

Once the distro file is created, it can be loaded into any autotest
server.

Changes from v1:
   * replace raising exception by calling sys.exit()

Signed-off-by: Cleber Rosa <crosa@redhat.com>
removed the extra run of syncdb

Signed-off-by: Cleber Rosa <crosa@redhat.com>
frontend: move the model unittest utility module a level up

Because we want to use it also on the TKO models so a common
location makes more sense. Also renamed it stripping the frontend_
name, since the parent module is already named like that.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
frontend: add unittest for TKO models

This first unit test covers the scenario where a single iteration
attribute is added, and thus, passes.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
component isolation: introduce models and database schema

The so called component isolation feature needs to keep track of
more information than we usually do with the AFE/TKO models.

I've decided to loose the afe_ and tko_ suffixes on the database
tables because there's a trend towards uniting the database. Also,
the component isolation deals with some aspects and models on both
AFE and TKO, so it doesn't make sense to pick a side.

If you have a running database, those changes should be applied with:

   $ cd AUTOTEST_ROOT/frontend
   $ ./manage.py migrate afe
   $ ./manage.py migrate tko

If you're creating a database from scratch, no extra step is needed.

This also preloads the database with "unknown" entries.

The unknown distro will be used either when the test does not
register or is able to detect the linux distro it's running on.

The unknown software kind and arch are also used as fallbacks
when not properly recorded.

Changes from v1:
   * add usage info on software kind name field
   * new line clean up on auto generated migration file

Signed-off-by: Cleber Rosa <crosa@redhat.com>
autotest-distro-def-load: add utility scripts

This scripts allows a user to load a distro definition file into
the autotest server database.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
utils/run_pylint.py: update to latest version on virt-test repo

Signed-off-by: Cleber Rosa <crosa@redhat.com>
utils/check_patch.py: update to latest (unified version) from virt-test

This patch brings the unified version of the script to the autotest
repo.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
client.shared.base_job: Add missing status into JOB_STATUSES.

Since some status of job is not included in JOB_STATUSES, we will
get error in generating html report such as:
"Error writing job HTML report: 'END TEST_NA'"

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
client.shared.report: fix the dispatching way of status.

The old code "results_data['status_code'] != 'GOOD'" is
just for test exiting with "GOOD". It can not cover the
other situations such as TEST_NA, FAIL.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
contrib/install-autotest-server.sh: Add makepasswd to Ubuntu/Debian installs

Sometimes this package may not be installed on the distros
mentioned above, and the autotest user creation step might
fail.

CC: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_cgroup: Add refresh function in utils_cgroup.py

Sometimes user use cgconfig file to create cgroups, then
need to refresh cgroups in utils_cgroup.Cgroup class.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
autotest-firewalld-add-service: read firewalld system settings before trying default/fallback settings

Problem: We need to be able to modify firewalld zones on systems that
pre-date the firewall-cmd --permanent option.

In order to do this we must manually read/write the xml in
/etc/firewalld.  The file system layout for firewalld is such that the
default/fallback configuration is stored in /usr/lib/firewalld and the
system configuration is stored in /etc/firewalld/

To accommodate this default/fallback and system settings behaviour when
we add the service to the zone file we must first attempt to read
existing settings from /etc/firewalld/zones, and if no such file exists
in /etc/firewalld/zones, only then will we read the default/fallback
settings in /usr/lib/firewalld/zones.

This patch implements this behavior using a try/open/except function.
We use open() instead of os.access because open is a more exact test of
file readability.  os.access does not attempt access with EUID/EGID or
other effective permissions, whereas open() does.

Lightly tested on Fedora 18.

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
autotest-firewall-add-service: autopep8 and remove unused import

general code cleanups

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
autotest-firewalld-add-service: remove unused variable

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>