Cope with unknown trees.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 8 Dec 2010 17:17:08 +0000 (18:17 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 8 Dec 2010 17:17:08 +0000 (18:17 +0100)
buildfarm/web/__init__.py

index da42569..49aa6e5 100755 (executable)
@@ -371,6 +371,11 @@ class BuildFarmPage(object):
             return "<span class='old'>%s</span>" % util.dhm_time(age)
         return util.dhm_time(age)
 
+    def tree_link(self, myself, treename):
+        try:
+            return tree_link(myself, self.buildfarm.trees[treename])
+        except KeyError:
+            return treename
 
     def render(self, output_type):
         raise NotImplementedError(self.render)
@@ -446,7 +451,7 @@ class ViewBuildPage(BuildFarmPage):
                 (myself, build.host, build.tree, build.compiler, build.host, self.buildfarm.hostdb[build.host].platform.encode("utf-8"))
         if uname is not None:
             yield "<tr><td>Uname:</td><td>%s</td></tr>\n" % uname
-        yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % tree_link(myself, self.buildfarm.trees[build.tree])
+        yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % self.tree_link(myself, build.tree)
         yield "<tr><td>Build Revision:</td><td>%s</td></tr>\n" % revision_link(myself, build.revision, build.tree)
         yield "<tr><td>Build age:</td><td><div class='age'>%s</div></td></tr>\n" % self.red_age(build.age)
         yield "<tr><td>Status:</td><td>%s</td></tr>\n" % build_link(myself, build)
@@ -598,7 +603,7 @@ class ViewHostPage(BuildFarmPage):
     def _render_build_html(self, myself, build):
         warnings = build.err_count()
         yield "<tr>"
-        yield "<td><span class='tree'>" + tree_link(myself, self.buildfarm.trees[build.tree]) +"</span>/" + build.compiler + "</td>"
+        yield "<td><span class='tree'>" + self.tree_link(myself, build.tree) +"</span>/" + build.compiler + "</td>"
         yield "<td>" + revision_link(myself, build.revision, build.tree) + "</td>"
         yield "<td><div class='age'>" + self.red_age(build.age) + "</div></td>"
         yield "<td><div class='status'>%s</div></td>" % build_link(myself, build)
@@ -725,7 +730,7 @@ class ViewSummaryPage(BuildFarmPage):
 
         for tree in sorted(self.buildfarm.trees.keys()):
             yield "<tr>"
-            yield "<td>%s</td>" % tree_link(myself, self.buildfarm.trees[tree])
+            yield "<td>%s</td>" % self.tree_link(myself, tree)
             yield "<td>%s</td>" % host_count[tree]
             yield "<td>%s</td>" % broken_count[tree]
             if panic_count[tree]: