database migration file: add the required newline on the generated file

At first, I thought it would be better to leave the auto generated file
as is, but since this will become quite verbose on future runs of
check_patch.py, it's better to add it.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
database: increase size of TKO's test attributes value

Turns out that the definition of the test attribute value size set
in the tko models file (frontend/tko/models.py) was a lot smaller
than the size on the SQL schema file:

schema.sql snippet:

   CREATE TABLE `tko_test_attributes` (
      `value` varchar(1024) DEFAULT NULL,

frontent/tko/models.py snippet:

   class TestAttribute(dbmodels.Model, model_logic.ModelExtensions):
       value = dbmodels.CharField(blank=True, max_length=300)

This has been the case since 2009, according to commit f756779f.

So, increase the size so that attributes with larger values do not
get truncated.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
profilers.systemtap : fix import error when using systemtap profiler

Now under profiler/systemtap miss the file __init__.py, so when using
systemtap profiler will report import error like:
    "no module named systemtap"
This patch fix this error, and add some systemtap scripts for qemu test

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
documentation: added client docs structure

Signed-off-by: Cleber Rosa <crosa@redhat.com>
client/shared/distro.py: introduce distro detection API

This new API offers a way to precisely detect not only the vendor
OS, but also specifics such as the version and release of the
currently running distro.

Probes for new distributions are quite simple to create. That and
the basic usage of the API is properly documented.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
client/shared/software_manager.py: use distro detection API

Signed-off-by: Cleber Rosa <crosa@redhat.com>
client/shared/distro.py: add Probe based on Python's Standard Library

Ross Brattain pointed us to the platform.dist() function on Python's
Standard Library. We realized it's valuable to use it in addition
to our custom Probes.

So this introduces a Probe that relies on platform.dist(), that will
have its result used if no other (more specific) Probe exists.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
AsyncJob: implement support for stdin as string

AsyncJob did not support filling the stdin pipe with a string input.
Resolve this by creating a new thread function to write stdin_string
in 512 byte chunks to the subprocess stdin PIPE.

Extract the drainer thread to be a protected staticmethod so we can
unittest it.

Refactor the thread functions to eliminate branches and lookups during
the while loop.

Instead of checking for None, check for the actual methods we use.
Only check once if Lock is None, otherwise in the case of None replace
acquire() and lock() with a noop like bool.

v2:
Remove lock from stdin_thread since no other thread will access stdin
Add try/finally to _fd_drainer to release the lock after an exception

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Import mock.py 1.0.1 from http://www.voidspace.org.uk/python/mock/

mock is a library for testing in Python. It allows you to replace parts
of your system under test with mock objects and make assertions about
how they have been used.

mock is now part of the Python standard library, available as
`unittest.mock
<http://docs.python.org/py3k/library/unittest.mock.html#module-unittest.mock>`_
in Python 3.3 onwards.

Licensed under BSD-3-Clause.

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