diff options
author | 2008-09-03 17:25:32 +0530 | |
---|---|---|
committer | 2008-09-03 17:25:32 +0530 | |
commit | 7a2363417c175f6b10e6e42852df85f115382daa (patch) | |
tree | 82243e04d83fbd85fb96d8dbef16029054114e36 | |
parent | Add a README for the master (diff) | |
download | autotua-7a2363417c175f6b10e6e42852df85f115382daa.tar.gz autotua-7a2363417c175f6b10e6e42852df85f115382daa.tar.bz2 autotua-7a2363417c175f6b10e6e42852df85f115382daa.zip |
Bugfixes to master server.
- Allow the master to run with a non-installed autotua-slave by not
failing if /etc/autotua/slave.cfg doesn't exist
- Use os.makedirs instead of os.mkdir in config.py for creating the
autotua dirs
- The user needs to manually enter the URL to the master server
(temporary change)
-rw-r--r-- | slave/README | 2 | ||||
-rw-r--r-- | slave/autotua/config.py | 38 | ||||
-rw-r--r-- | slave/config/slave.cfg | 3 |
3 files changed, 24 insertions, 19 deletions
diff --git a/slave/README b/slave/README index 0262e80..482c9d7 100644 --- a/slave/README +++ b/slave/README @@ -1,5 +1,5 @@ - Execute modules to test them - Ex: `PYTHONPATH=. python autotua/__init__.py` + * Ex: `PYTHONPATH=. python autotua/__init__.py` to run a sample job - Everything should preferably be run as root. Although, if you're not using a chroot, you can get away with an unprivileged user. - Need *atleast* Python 2.5 diff --git a/slave/autotua/config.py b/slave/autotua/config.py index 63a5209..8b1bdb0 100644 --- a/slave/autotua/config.py +++ b/slave/autotua/config.py @@ -19,7 +19,7 @@ IGNORE_PROXY = False LOGFILE = '/var/log/autotua/slave.log' TMPDIR = '/var/tmp/autotua' -AUTOTUA_MASTER = 'http://www.autotua.org:8000' +AUTOTUA_MASTER = '' JOBTAGE_URI = 'git://git.overlays.gentoo.org/proj/jobtage.git' # Bind mounted inside the chroots for use if defined @@ -27,20 +27,24 @@ PORTAGE_DIR = '/usr/portage' DISTFILES_DIR = '/usr/portage/distfiles' # Read settings from slave.cfg which override the above -options = locals().copy() -cfg = ConfigParser.ConfigParser() -cfg.readfp(open('%s/slave.cfg' % const.CONFIG_PATH)) -for option, value in options.iteritems(): - if not isinstance(value, (str, int, bool)): - continue - if cfg.has_option('global', option.lower()): - if isinstance(value, str): - if not option.startswith('__'): - exec('%s = %s' % (option, cfg.get('global', option.lower()))) - elif isinstance(value, bool): - exec('%s = %s' % (option, cfg.getboolean('global', option.lower()))) - elif isinstance(value, int): - exec('%s = %s' % (option, cfg.getint('global', option.lower()))) +if os.path.exists('%s/slave.cfg' % const.CONFIG_PATH): + options = locals().copy() + cfg = ConfigParser.ConfigParser() + cfg.readfp(open('%s/slave.cfg' % const.CONFIG_PATH)) + for option, value in options.iteritems(): + if not isinstance(value, (str, int, bool)): + continue + if cfg.has_option('global', option.lower()): + if isinstance(value, str): + if not option.startswith('__'): + exec('%s = %s' % (option, cfg.get('global', option.lower()))) + elif isinstance(value, bool): + exec('%s = %s' % (option, cfg.getboolean('global', option.lower()))) + elif isinstance(value, int): + exec('%s = %s' % (option, cfg.getint('global', option.lower()))) + +if not AUTOTUA_MASTER: + raise Exception('You need to set the autotua_master variable in slave.cfg (or AUTOTUA_MASTER in config.py)') # Import all the constants now from const import * @@ -65,7 +69,7 @@ if not IGNORE_PROXY and os.environ.has_key('http_proxy'): # Create autotua directories if they don't exist if not os.path.isdir(os.path.dirname(LOGFILE)): - os.mkdir(os.path.dirname(LOGFILE)) + os.makedirs(os.path.dirname(LOGFILE)) for dir in [TMPDIR, TARBALL_DIR, STAGE_DIR, JOBFILE_DIR, CHROOT_DIR, SAVED_CHROOT_DIR, WORKDIR, JOBTAGE_DIR]: if not os.path.isdir(dir): - os.mkdir(dir) + os.makedirs(dir) diff --git a/slave/config/slave.cfg b/slave/config/slave.cfg index ca17132..dda3226 100644 --- a/slave/config/slave.cfg +++ b/slave/config/slave.cfg @@ -8,7 +8,8 @@ verbose = True ;ignore_proxy = False ;logfile = '/var/log/autotua/slave.log' ;tmpdir = '/var/tmp/autotua' -;autotua_master = 'http://www.autotua.org:8000' +# You need to set this if you're running a local AutotuA master +;autotua_master = '' ;jobtage_uri = 'git://git.overlays.gentoo.org/proj/jobtage.git' ;portage_dir = '/usr/portage' ;distfiles_dir = '/usr/portage/distfiles' |