[Buildbot-devel] multiple params through WithProperties
Mike Winter
miwinter at cisco.com
Fri May 28 22:24:49 UTC 2010
Trying some hacks I want to use force-build page to add more than one parameter to a test's cmdline i.e. parms=('-v' '-v' '-t' 'footest'). I trip up on the regex constraints in status/web/base.py:getAndCheckProperties(req) so I removed the regex contraints on the value.
Then I added 2 lines of code to the aforementioned fn:
def getAndCheckProperties(req):
"""
Fetch custom build properties from the HTTP request of a "Force build" or
"Resubmit build" HTML form.
Check the names for valid strings, and return None if a problem is found.
Return a new Properties object containing each property found in req.
"""
properties = Properties()
for i in (1,2,3,4,5):
pname = req.args.get("property%dname" % i, [""])[0]
pvalue = req.args.get("property%dvalue" % i, [""])[0]
if pname and pvalue:
if not re.match(r'^[\w\.\-\/\~:]*$', pname): # or not re.match(r'^[\w\.\-\/\~:]*$', pvalue):
log.msg("bad property name='%s', value='%s'" % (pname, pvalue))
return None
+ if pvalue.startswith('eval'):
+ pvalue=eval(pvalue[4:])
I suspect this will require some special changes to allow string conversion to allow Property.render to recurse into python data-types, but its. I tried ('-v', '-v', '-t', 'footest') with no more luck - this I think gets converted by WithProperties into the same string because Properties.
log:
2010-05-28 13:31:46-0700 [-] <RemoteShellCommand '['./runTests.sh', '', '--report', 'no', '--branch', 'baikal-rib', '--test', 'security/cfgmgr', '--passargs', 'cfgmgr_unit_test.bin', '']'>: RemoteCommand.run [0]2010-05-28 13:31:46-0700 [-] command '['./runTests.sh', '', '--report', 'no', '--branch', 'baikal-rib', '--test', 'security/cfgmgr', '--passargs', 'cfgmgr_unit_test.bin', '']' in dir 'build/test'2010-05-28 13:31:46-0700 [-] LoggedRemoteCommand.start
2010-05-28 13:33:19-0700 [Broker,1,171.70.77.65] <RemoteShellCommand '['./runTests.sh', '', '--report', 'no', '--branch', 'baikal-rib', '--test', 'security/cfgmgr', '--passargs', 'cfgmgr_unit_test.bin', '']'> rc=1
[snip]
2010-05-28 13:33:19-0700 [-] checkForSkipOrRun: step: security_cfgmgr_cfgmgr_scripted_test.bin props: {'ONE_STEP': 'security_cfgmgr_cfgmgr_unit_test.bin', 'buildername': 'baikal-rib', 'buildnumber': 4, 'slavename': 'baikal-rib-aut', 'branch': 'baikal-rib', 'bparm': '-v -v -t CSCsu54970', 'sparm': '-v', 'revision': None}
The interesting thing in the doStepIf param log entry seen at the last above. It shows the exact value intended for the 'illegal' property. So I could hack in that fn if I can append to the command list at that fn.
Perhaps the simplest workaround is to add more property rows to the page and just sequence thru using WithProperties('%(arg0:-)s %(arg1:-)s %(arg2:-)s')
Any reasonable suggestion/idea welcome on how to work on this.
More information about the devel
mailing list