Package buildbot :: Package status :: Package web :: Package hooks :: Module poller
[frames] | no frames]

Source Code for Module buildbot.status.web.hooks.poller

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16  # This change hook allows GitHub or a hand crafted curl inovcation to "knock on 
17  # the door" and trigger a change source to poll. 
18   
19  from buildbot.changes.base import PollingChangeSource 
20   
21   
22 -def getChanges(req, options=None):
23 change_svc = req.site.buildbot_service.master.change_svc 24 poll_all = not "poller" in req.args 25 26 allow_all = True 27 allowed = [] 28 if isinstance(options, dict) and "allowed" in options: 29 allow_all = False 30 allowed = options["allowed"] 31 32 pollers = [] 33 34 for source in change_svc: 35 if not isinstance(source, PollingChangeSource): 36 continue 37 if not hasattr(source, "name"): 38 continue 39 if not poll_all and not source.name in req.args['poller']: 40 continue 41 if not allow_all and not source.name in allowed: 42 continue 43 pollers.append(source) 44 45 if not poll_all: 46 missing = set(req.args['poller']) - set(s.name for s in pollers) 47 if missing: 48 raise ValueError("Could not find pollers: %s" % ",".join(missing)) 49 50 for p in pollers: 51 p.doPoll() 52 53 return [], None
54