service: document systemctl pager workaround and arg string format

Make sure the argument list is a list of strings with one argument per
string so we are compatible with Popen and other execv style functions.

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

By introducing a simple standard option parser class that is used
by all scripts that access (or should) the database via the model
interface provided by the frontend module.

Currently only `parse.py` actually uses the options, but
`autotest-db-delete-job` will follow.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko: make `autotest-db-delete-job` use command line arguments

This effectively forces `autotest-db-delete-job` users to enter
tedious command line arguments. But this will go away with the
default behaviour that will be introduced that defaults to reading
database options from the global_config.ini file.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
frontend/optparser.py: use values from global_config.ini by default

This saves users of apps that manipulate the database via the frontend
model interface from always manually entering options.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
frontend/optparser.py: apply given database options transparently

This will do the right thing whenever a user passes a database
related option in the command line. Individual application do not
need to worry about it.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/parse: remove it

There's no point in having `parse` and `autotest-tko-parse`.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko: move old perl scripts to contrib

IMHO these scripts are more suited to live under contrib, since
they're perl based and require things such as ABAT perl modules.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/vertical_text.py: clean up unused modules

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/vertical_text.py: add font path

So that script works on Red Hat/Fedora systems

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko: replace custom debug print routine with logging.*

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/parse.py: add logging configuration

Matching what it's currently set on `autotest-db-delete-job`.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
frontend: introduce utility functions modules

For both AFE and TKO. These are supposed to wrap common used data
manipulation idioms in easier to use functions.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/autotest-db-delete-job: implement job deletion via frontend db functions

The "tko" module, under which this script lives, has a custom database
access layer, under the namespace "tko.db". The most important class
is "db_sql", hereby called "custom TKO db layer".

This replaces the use of the custom TKO db layer wrt the deletion of
the AFE/TKO job entries.

The next step is to replace the customs TKO db layer usage in the
get_tags_* functions, making `autotest-db-delete-job` independent
of the custom TKO db layer.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/autotest-db-delete-job: fix wording

When using tags (and not a numeric range) jobs are selected rather
than found.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/autotest-db-delete-job.py: remove useless code

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/autotest-db-delete-job: re-implement get_tags_by_range

By using the TKO model utility functions.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/autotest-db-delete-job: remove all dependency on legacy db module

The last thing needed here is to hook the database options given on
the command line into the Django database connection configuration.

As it is on this specific commit, the default configuration will be
used (from global_config.ini).

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/parse.py: merge into autotest-tko-parse

There's no point in having two different entry points besides confusing
users.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/autotest-tko-parse: add import plumbing

Necessary for using any Django based code and also the specific
tko models utils module.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko/autotest-tko-parse: replace job idx lookup function

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