aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2009-02-24 20:18:35 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2009-02-24 20:18:35 +0530
commitf48ed97e100b4d315f14bf63a3d0fe03dab89f8c (patch)
tree241934a3d920ccd64259c0a1ffb3fc6320eaa23b
parentFix Gentoo Foundation Copyright dates (diff)
downloadautotua-f48ed97e100b4d315f14bf63a3d0fe03dab89f8c.tar.gz
autotua-f48ed97e100b4d315f14bf63a3d0fe03dab89f8c.tar.bz2
autotua-f48ed97e100b4d315f14bf63a3d0fe03dab89f8c.zip
Minor bugfixes in setup-master.py
-rwxr-xr-xmaster/setup-master.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/master/setup-master.py b/master/setup-master.py
index 527656f..8ad26a3 100755
--- a/master/setup-master.py
+++ b/master/setup-master.py
@@ -60,17 +60,23 @@ def save_current_stage():
def next_stage():
global STAGE
- STAGE = STAGES[STAGES.index(STAGE)+1]
+ next_stage_index = STAGES.index(STAGE)+1
+ if next_stage_index < len(STAGES):
+ STAGE = STAGES[next_stage_index]
+ else:
+ all_done()
def resume_last_stage():
global STAGE
stages = None
if STAGE == STAGES[0]:
- STAGE = STAGES[0]
stages = [STAGE]
else:
with open(osp.join(PROJPATH, '.last_stage'), 'r') as last_stage:
STAGE = last_stage.read()
+ # If we're at the last stage
+ if STAGE == STAGES[-1]:
+ all_done()
stages = STAGES[STAGES.index(STAGE):]
# For each stage since last_stage
for stage in stages:
@@ -105,7 +111,9 @@ def install_master():
===================================
Setup done.
Now you need to edit the database settings in %(dest)s/settings.py
-and run `./setup-master.py resume %(dest)s`""" % { 'dest': RELPROJPATH }
+and run `./setup-master.py resume %(dest)s`
+===================================
+""" % { 'dest': RELPROJPATH }
def syncdb_master():
"""Initialize the database"""
@@ -182,6 +190,9 @@ def setup_sample_slave():
setup_environ(settings)
from master import const
from master.models import User, Group, Provider, Arch, Release, Mirror, Job, Slave
+
+ # Need to be in the project dir
+ os.chdir(PROJPATH)
slave = Slave()
slave.name = sample_slave['name']
try:
@@ -204,8 +215,12 @@ def setup_sample_job():
from django.core.management import setup_environ
setup_environ(settings)
from master.models import User, Provider, Release, Job, Slave
+
# Setup the jobtage tree in /var/tmp/autotua/jobtage
sync.Syncer().sync()
+
+ # Need to be in the project dir
+ os.chdir(PROJPATH)
# Get on with the job at hand... ;)
job = Job()
for i in ['name', 'jobtagerev', 'atoms']:
@@ -220,6 +235,10 @@ def setup_sample_job():
job.slaves.add(Slave.objects.get(name=sample_job['slave']))
job.save()
+def all_done():
+ print "All done! Now you can start the master with `python manage.py runserver`"
+ sys.exit()
+
################
## Parse Args ##
################
@@ -260,4 +279,3 @@ sys.path.append(PROJPATH)
####################
atexit.register(save_current_stage)
resume_last_stage()
-print "All done! Now you can start the master with `python manage.py runserver`"