Skip to content

Commit

Permalink
Move public_html/index.html to templates/root.html on 'upgrade-master' (
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sonestedt committed Dec 25, 2009
1 parent 953105d commit 281a00d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions buildbot/scripts/runner.py
Expand Up @@ -197,6 +197,20 @@ def populate_if_missing(self, target, source, overwrite=False):
print "populating %s" % target
open(target, "wt").write(new_contents)

def move_if_present(self, source, dest):
if os.path.exists(source):
if os.path.exists(dest):
print "Notice: %s now overrides %s" % (dest, source)
print " as the latter is not used by buildbot anymore."
print " Decide which one you want to keep."
else:
try:
print "Notice: Moving %s to %s." % (source, dest)
print " You can (and probably want to) remove it if you haven't modified this file."
os.renames(source, dest)
except Exception, e:
print "Error moving %s to %s: %s" % (source, dest, str(e))

def upgrade_public_html(self, files):
webdir = os.path.join(self.basedir, "public_html")
if not os.path.exists(webdir):
Expand Down Expand Up @@ -298,6 +312,10 @@ def upgradeMaster(config):
m.populate_if_missing(os.path.join(basedir, "master.cfg.sample"),
util.sibpath(__file__, "sample.cfg"),
overwrite=True)
# if index.html exists, use it to override the root page tempalte
m.move_if_present(os.path.join(basedir, "public_html/index.html"),
os.path.join(basedir, "templates/root.html"))

rc = m.check_master_cfg()
if rc:
return rc
Expand Down

0 comments on commit 281a00d

Please sign in to comment.