Package buildbot :: Package clients :: Module usersclient
[frames] | no frames]

Source Code for Module buildbot.clients.usersclient

 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 class is known to contain cruft and will be looked at later, so 
17  # no current implementation utilizes it aside from scripts.runner. 
18   
19  from twisted.spread import pb 
20  from twisted.cred import credentials 
21  from twisted.internet import reactor 
22   
23 -class UsersClient(object):
24 """ 25 Client set up in buildbot.scripts.runner to send `buildbot user` args 26 over a PB connection to perspective_commandline that will execute the 27 args on the database. 28 """ 29
30 - def __init__(self, master, username, password, port):
31 self.host = master 32 self.username = username 33 self.password = password 34 self.port = int(port)
35
36 - def send(self, op, bb_username, bb_password, ids, info):
37 f = pb.PBClientFactory() 38 d = f.login(credentials.UsernamePassword(self.username, self.password)) 39 reactor.connectTCP(self.host, self.port, f) 40 41 def call_commandline(remote): 42 d = remote.callRemote("commandline", op, bb_username, 43 bb_password, ids, info) 44 def returnAndLose(res): 45 remote.broker.transport.loseConnection() 46 return res
47 d.addCallback(returnAndLose) 48 return d
49 d.addCallback(call_commandline) 50 return d 51