----- Original Message -----
This replaces the method previously used in
lib/autotest/site_packages.py. To
avoid non-standard file permissions for tests in
/usr/share/autotest/client/site_tests, this patch creates
site_autotest.py to
perform additional steps when preparing an autotest client for jobs.
In
site_autotest.py, we extend the existing BaseAutotest._install()
method to
perform several tasks prior to the standard autotest client
preparation. Those
tasks include:
* Optionally install additional yum repositories (based on optional
global_config.ini option)
* Install, or upgrade, autoqa
* Copy all files in /etc/autoqa to the client
This patch also updates autoqa.spec and Makefile to include the new
file.
Outstanding, you win the 'Patch Of The Week' prize! :-) This is really
great, it's much better hack than mine was.
I have tested a little and found out following:
1. rsync must be installed on both server and the client in order
to work, otherwise it falls back to scp. Maybe we could add rsync
as autotest dependency?
2. In order for scp to work, openssh-clients must be installed
on both server and the client. (And of course also openssh-server
on the client).
3. There are some differences how scp and rsync handle destination
directories when they exist/don't exist. The only reliable way when
the transfer worked well for both scp and rsync is to delete and
re-create the destination directory prior to the transfer. This is
probably a bug in autotest, it should handle it internally.
This is my current implementation:
class SiteAutotest(BaseAutotest):
def _install(self, host=None, autodir=None, use_autoserv=True,
use_packaging=True):
# NOTE: Due to inconsistent rsync/scp behavior inside autotest, all
# the transferred directories must end with a slash and must be removed
# and re-created at the destination machine prior to the transfer
# copy autoqa config files
logging.debug("Copying autoqa configuration files")
dir_ = '/etc/autoqa/'
host.run('rm -rf %s; mkdir -p %s' % (dir_, dir_))
host.send_file(dir_, dir_)
# copy autoqa library
logging.debug("Copying autoqa library")
dir_ = '/usr/lib/python2.7/site-packages/autoqa/'
host.run('rm -rf %s; mkdir -p %s' % (dir_, dir_))
host.send_file(dir_, dir_)
logging.info("Installation of autoqa completed")
# Finally, continue installation by calling our parent
super(SiteAutotest, self)._install(host, autodir, use_autoserv, use_packaging)
You surely noticed that I don't install autoqa package anymore.
That's right, I believe we don't want to install that package.
Automatic installation has this drawbacks:
I. For the production server: When we release a new autoqa release,
all the clients will be immediately updated to this new version,
before we have even updated the production server. That can cause
quite some problems.
II. For the staging server: We couldn't operate a staging server like
this. We need to have unreleased code deployed to the clients, not
the latest release.
Therefore I believe we need to find a way to ensure that autoqa versions
on the server and on the client always match. Easiest solution is simply
to copy the config files and the autoqa library, as I have done in the
code above. But there are a few issues to solve:
a) The destination directory of autoqa library depends on the
python version used. We can't hardcode it. Maybe we can transfer the
library source code and do 'python setup.py install'?
b) The autoqa package dependencies are not installed that way.
We need to find a way to ensure all the dependencies are installed.
Any ideas?