Trees | Indices | Help |
|
---|
|
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 import stat 17 from buildbot.process.buildstep import BuildStep, LoggedRemoteCommand 18 from buildbot.process.buildstep import SUCCESS, FAILURE 19 from buildbot.interfaces import BuildSlaveTooOldError 2022 """ 23 Sets properties from envirionment variables on the slave. 24 25 Note this is transfered when the slave first connects 26 """ 27 name='SetPropertiesFromEnv' 28 description='Setting' 29 descriptionDone='Set' 304832 BuildStep.__init__(self, **kwargs) 33 self.addFactoryArguments(variables = variables, 34 source = source) 35 self.variables = variables 36 self.source = source3739 properties = self.build.getProperties() 40 environ = self.buildslave.slave_environ 41 if isinstance(self.variables, str): 42 self.variables = [self.variables] 43 for variable in self.variables: 44 value = environ.get(variable, None) 45 if value: 46 properties.setProperty(variable, value, self.source, runtime=True) 47 self.finished(SUCCESS)50 """ 51 Check for the existence of a file on the slave. 52 """ 53 name='FileExists' 54 description='Checking' 55 descriptionDone='Checked' 56 57 haltOnFailure = True 58 flunkOnFailure = True 59 60 658767 slavever = self.slaveVersion('stat') 68 if not slavever: 69 raise BuildSlaveTooOldError("slave is too old, does not know " 70 "about stat") 71 cmd = LoggedRemoteCommand('stat', {'file': self.file }) 72 d = self.runCommand(cmd) 73 d.addCallback(lambda res: self.commandComplete(cmd)) 74 d.addErrback(self.failed)7577 if cmd.rc != 0: 78 self.step_status.setText(["File not found."]) 79 self.finished(FAILURE) 80 s = cmd.updates["stat"][-1] 81 if stat.S_ISREG(s[stat.ST_MODE]): 82 self.step_status.setText(["File found."]) 83 self.finished(SUCCESS) 84 else: 85 self.step_status.setText(["Not a file."]) 86 self.finished(FAILURE)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Dec 19 18:26:51 2010 | http://epydoc.sourceforge.net |