[Buildbot-devel] multiple params through WithProperties

Axel Hecht l10n.moz at googlemail.com
Sun May 30 16:32:58 UTC 2010


A few comments:

I don't know why we're restricting the value at all here.

If you want to allow richer values, I'd suggest parsing the value as json,
and fallback to using the value as string if that fails.

Properties.render should work fine with lists and dicts, which is what json
gives you :-)

If you want to make one string turn into multiple arguments, maybe just pass
in your command as a single string, with your optional args included, and
not as a list. Then that should just work.

Axel

2010/5/29 Mike Winter <miwinter at cisco.com>

> 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.
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20100530/fc19e919/attachment.html>


More information about the devel mailing list