[Buildbot-commits] buildbot/buildbot interfaces.py,1.27,1.28 scheduler.py,1.1,1.2 master.py,1.75,1.76

Brian Warner warner at users.sourceforge.net
Wed Jul 20 04:21:59 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14016/buildbot

Modified Files:
	interfaces.py scheduler.py master.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-254
Creator:  Brian Warner <warner at lothar.com>

add sanity checks to the config file parser

	* buildbot/master.py (BuildMaster.loadConfig): Add sanity checks
	to make sure that c['sources'], c['schedulers'], and c['status']
	are all lists of the appropriate objects, and that the Schedulers
	all point to real Builders
	* buildbot/test/test_config.py (ConfigTest.testSchedulers): test it


Index: interfaces.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/interfaces.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- interfaces.py	19 Jul 2005 23:11:59 -0000	1.27
+++ interfaces.py	20 Jul 2005 04:21:57 -0000	1.28
@@ -44,6 +44,10 @@
         Each Scheduler will receive this Change. I may decide to start a
         build as a result, or I might choose to ignore it."""
 
+    def listBuilderNames():
+        """Return a list of strings indicating the Builders that this
+        Scheduler might feed."""
+
 class IUpstreamScheduler(Interface):
     """This marks an IScheduler as being eligible for use as the 'upstream='
     argument to a buildbot.scheduler.Dependent instance."""
@@ -53,6 +57,10 @@
         successful buildset. The target will be called with a single
         argument: the SourceStamp used by the successful builds."""
 
+    def listBuilderNames():
+        """Return a list of strings indicating the Builders that this
+        Scheduler might feed."""
+
 class ISourceStamp(Interface):
     pass
 

Index: master.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/master.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- master.py	19 Jul 2005 23:23:21 -0000	1.75
+++ master.py	20 Jul 2005 04:21:57 -0000	1.76
@@ -712,6 +712,16 @@
         if config.has_key('interlocks'):
             raise KeyError("c['interlocks'] is no longer accepted")
 
+        assert type(sources) in (list, tuple)
+        for s in sources:
+            assert interfaces.IChangeSource(s)
+        # this assertion catches c['schedulers'] = Scheduler(), since
+        # Schedulers are service.MultiServices and thus iterable.
+        assert type(schedulers) in (list, tuple)
+        for s in schedulers:
+            assert (interfaces.IScheduler(s)
+                    or interfaces.IUpstreamScheduler(s))
+        assert type(status) in (list, tuple)
         for s in status:
             assert interfaces.IStatusReceiver(s)
 
@@ -734,6 +744,10 @@
                                  % (b['name'], b['builddir']))
             dirnames.append(b['builddir'])
 
+        for s in schedulers:
+            for b in s.listBuilderNames():
+                assert b in buildernames
+
         # assert that all locks used by the Builds and their Steps are
         # uniquely named.
         locks = {}
@@ -816,7 +830,7 @@
         
         log.msg("configuration updated")
         self.readConfig = True
-        return defer.DeferredList(dl)
+        return defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1)
 
     def loadConfig_Slaves(self, bots):
         # set up the Checker with the names and passwords of all valid bots
@@ -836,7 +850,7 @@
 
         # all done
         self.bots = bots
-        return defer.DeferredList(dl)
+        return defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1)
 
     def loadConfig_Sources(self, sources):
         log.msg("loadConfig_Sources, change_svc is", self.change_svc,
@@ -847,7 +861,7 @@
               for source in oldsources if source not in sources]
         [self.change_svc.addSource(source)
          for source in sources if source not in self.change_svc]
-        return defer.DeferredList(dl)
+        return defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1)
 
     def loadConfig_Schedulers(self, newschedulers):
         old = [s for s in self.schedulers if s not in newschedulers]
@@ -856,7 +870,7 @@
         [s.setServiceParent(self)
          for s in newschedulers if s not in self.schedulers]
         self.schedulers = newschedulers
-        return defer.DeferredList(dl)
+        return defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1)
 
     def loadConfig_Builders(self, newBuilders):
         dl = []
@@ -916,7 +930,7 @@
         # now that everything is up-to-date, make sure the names are in the
         # desired order
         self.botmaster.builderNames = newNames
-        return defer.DeferredList(dl)
+        return defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1)
 
     def loadConfig_status(self, status):
         dl = []
@@ -935,7 +949,7 @@
                 s.setServiceParent(self)
                 self.statusTargets.append(s)
 
-        return defer.DeferredList(dl)
+        return defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1)
 
 
     def addChange(self, change):

Index: scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scheduler.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- scheduler.py	19 Jul 2005 23:11:59 -0000	1.1
+++ scheduler.py	20 Jul 2005 04:21:57 -0000	1.2
@@ -109,6 +109,9 @@
         self.nextBuildTime = None
         self.timer = None
 
+    def listBuilderNames(self):
+        return self.builderNames
+
     def fileIsImportant(self, change):
         # note that externally-provided fileIsImportant callables are
         # functions, not methods, and will only receive one argument. Or you
@@ -215,6 +218,9 @@
             self.fileIsImportant = fileIsImportant
         self.schedulers = {} # one per branch
 
+    def listBuilderNames(self):
+        return self.builderNames
+
     def addChange(self, change):
         branch = change.branch
         if self.branches and branch not in self.branches:





More information about the Commits mailing list