frontend.db: Pass connection to DatabaseOperations

In Django 1.4, the DatabaseOperations constructor takes
a mandatory connection argument, so let's handle the
TypeError, and make the application compatible with both
Django 1.3 and 1.4.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
frontend.afe.feeds: Update use of deprecated code

In Django 1.2, the access to the feeds object was moved
to from django.contrib.feeds from django.contrib.syndication
and marked it as deprecated. Django 1.4 removed it entirely,
so this change makes the web app actually compatible with
both versions of Django.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
frontend.afe.feeds: Fix coding style

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
apache/django-directives: Update to Django 1.4

Django 1.4 does change the location of the CSS files for
the admin interface, so let's add an extra rule for
that.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
frontend.settings: Add MessageMiddleware among the middleware classes

So we can effectively show up popup messages in the Django
admin view. As this class was introduced in 1.2, this change
should also allow to use Django 1.3 as a supported dep.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
boottool: make it friendlier to packaging

By adding the .py suffix and making it more explicitly a python module
(besides also being a python app/script).

Also, this patch removes the legacy client/boottool.py file, which be
gone a long time ago.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
database: add database migration file that replaces Django fixtures

We used to rely on a Django fixtures to add a single record of initial
data to the afe_acl_groups table. We can simply move that data to the
schema, or, as done here, in a database version migration script.

This fixes issue #503.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: use glob to auto update grubby tarball shipped

So that we don't have to manually update (or forget to do so) when
the mininum required version changes.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
scheduler.drone_manager: Write to base results dir if available

This patch is a solution for bug #502 - drone_utility does not respect
results directory. Drone manager will always use the base autotest
install directory to write results to, making it write in an out of
bounds area for the scheduler:

OSError: [Errno 13] Permission denied:
'/usr/lib/python2.7/site-packages/autotest/results'

I first thought only choosing a different

drone_installation_directory: /usr/lib/python2.7/site-packages/autotest

In /etc/autotest/global_config.ini would help, but I just realized
AUTOTEST_INSTALL_DIR is used for other purposes, such as locating
autoserv, so this change would only cause the code to break further
in the execution path. So if we have a common dir to write results
to in global_config.ini, let's use it instead of
drones.AUTOTEST_INSTALL_DIR.

Changes from v1:

 * Drop redundant 'results' suffix I was adding manually.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
scheduler.monitor_db: Find autotest-remote path accordingly

This is a followup for #502 fix. It turns out that the autotest
scheduler won't be able to find autotest-remote on a system wide
install, therefore, it won't be possible to actually install the
autotest client on test clients. Let's fix it by figuring out
whether we have an autotest-remote installed system wide, if not,
fall back to the usual /autotest/path/server/autoserv.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
scheduler.monitor_db_watcher: Figure out results dir and scheduler path

This is another packaging related fix, we can figure out
autotest-scheduler path with os_dep in case of system wide
install, if not there fall back to the original way of
determining both scheduler and results directory.

It needs some testing to see if it doesn't break stuff I
didn't anticipate.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
scheduler/tko: Add autotest-tko-parse v2

On a system wide install, in order to successfuly parse
autotest server results, the parse utility must be available.

So let's create the new system wide installable autotest-tko-parse,
and adapt the scheduler to call it correctly.

Changes from v1:
 * parse.main() must be called rather than just main()

CC: Cleber Rosa <crosa@redhat.com>
CC: Martin Krizek <mkrizek@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils.compile_gwt_clients: Use system wide GWT dir if available

This is a drop in, more generic replacement of one of the
RPM specific patches.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Add new system wide installable entry points

So autotest-local can effectively run under autotest-remote.
Handle client push in a way that it can also install the
entry points in system wide locations, and code can also
figure out those system wide locations are present.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Fix report of installed packages on recent debian systems

Contributed by user dcliu (email currently unknown)

Symptoms: When you the autotest.client.package.info on the affected
OSes, it will always return package_info['installed'] = True whether or
not the package is actually installed.

Causes: This is a two fold problem. Firstly when dpkg -s does not find a
valid package name it will send it's reply in STDERR rather then STDOUT,
thus autotest never gets the reply.

Secondly the regex pattern does not work for more up to date distros:

testmachine# dpkg -s fds
Package `fds' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.

Adjust the output and the regexp to catch installed packages
more properly.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
install script: work on systems with firewalld

That have deprecated /etc/sysconfig/iptables file.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
apache conf: complete configuration overhaul

This is a fix for the problem described in github issue #575.

Some of the changes included here are:
 * make configuration work both on 2.2 and 2.4 version of httpd
 * be more resilient on afe and tko web interface rewrite rules
   to skip URIs that are dealt by django code
 * use conditionals to configure either mod_python or mod_wsgi
 * clean up of old rewrite rules that accounted for old and broken
   packaging of autotest
 * clean up deprecated and empty files
 * move individual config files to relative paths and make install
   script support that

Signed-off-by: Cleber Rosa <crosa@redhat.com>
server: Backport support for wsgi

This is a backport of commits:

1c25a2387f8a7e1844ce28f315cb04233469979f
ee3cced1afb6bc45216c7038472827ad4033c3f5

To make this version work on newer systems that have no mod_python.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
contrib/install-autotest-server.sh: allow to skip repo update

Signed-off-by: Cleber Rosa <crosa@redhat.com>
install script: java-devel is "provided by" specific packages

Signed-off-by: Cleber Rosa <crosa@redhat.com>