Description of problem: Python module bkr.client is lacking support for 'like' operator as described in docs[1][2]. I'd quite need this operator to be supported. [1] http://beaker-project.org/docs/user-guide/job-xml.html#job-xml [2] http://beaker-project.org/schema/beaker-job.rng Version-Release number of selected component (if applicable): beaker-client-0.14.1-1.fc18.noarch How reproducible: 100% Steps to Reproduce: bkr workflow-tomorrow 6.4 x86_64 Server --dryrun --hostrequire 'devicelikeipmi' Actual results: No task selected, just reserving the machine Using distro rhel-6.4 from the command line Traceback (most recent call last): File "/bin/bkr", line 9, in <module> load_entry_point('bkr.client==0.14.1', 'console_scripts', 'bkr')() File "/usr/lib/python2.7/site-packages/bkr/client/main.py", line 50, in main return cmd.run(*cmd_args, **cmd_opts.__dict__) File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tomorrow.py", line 1829, in run cases=[nitrate.TestCase(id) for id in options.cases]) File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tomorrow.py", line 1371, in schedule self.check_environment() File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tomorrow.py", line 749, in check_environment self.create_recipe(distro, variant, arch)) File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tomorrow.py", line 1017, in create_recipe recipe.addBaseRequires(**kwargs) File "/usr/lib/python2.7/site-packages/bkr/client/__init__.py", line 634, in addBaseRequires key, op, value = p2.split(require,3) ValueError: need more than 1 value to unpack Expected results: . . . <hostRequires> <and> <device op="like" value="ipmi"/> </and> </hostRequires> . . . Additional info: The regex p2 obviously does not accept 'like' operator see /usr/lib/python2.7/site-packages/bkr/client/__init__.py: . . . 625 p2 = re.compile(r'([\!=<>]+|>|<)') 626 for keyvalue in keyvalues: 627 key, op, value = p2.split(keyvalue,3) 628 mykeyvalue = self.doc.createElement('key_value') 629 mykeyvalue.setAttribute('key', '%s' % key) 630 mykeyvalue.setAttribute('op', '%s' % op) 631 mykeyvalue.setAttribute('value', '%s' % value) 632 self.addHostRequires(mykeyvalue) 633 for require in requires: 634 key, op, value = p2.split(require,3) 635 myrequire = self.doc.createElement('%s' % key) 636 myrequire.setAttribute('op', '%s' % op) 637 myrequire.setAttribute('value', '%s' % value) 638 self.addHostRequires(myrequire) . . .
(In reply to Miroslav Hradílek from comment #0) > Steps to Reproduce: > bkr workflow-tomorrow 6.4 x86_64 Server --dryrun --hostrequire 'devicelikeipmi' That looks a bit bizarre. We can split on '\s+like\s+' instead. bkr workflow-tomorrow 6.4 x86_64 Server --dryrun --hostrequire 'device like ipmi'
Note that you can already (since 0.17) pass raw XML to --hostrequire: bkr workflow-simple --hostrequire '<hostname op="like" value="%.khw.%"/>' ...
*** Bug 1240974 has been marked as a duplicate of this bug. ***
(In reply to Dan Callaghan from comment #2) > bkr workflow-tomorrow 6.4 x86_64 Server --dryrun --hostrequire 'device like ipmi' Actually that won't have any useful effect either. The <device/> host filter is special, it does not actually have a value="" attribute, it has separate XML attributes for each attribute of the device, so you would use it like this: <device op="like" description="%IPMI%"/> There's no way to represent that indirectly using --hostrequire, you can only pass the raw XML: --hostrequire '<device op="like" description="%IPMI%"/>'
A better example (from bug 1240974) would be: --hostrequire 'hostname like %.khw.%' which will become: <hostname op="like" value="%.khw.%"/>
http://gerrit.beaker-project.org/4362
This bug fix is included in beaker-client-21.1-0.git.3.58733b1 which is currently available for testing here: https://beaker-project.org/nightlies/release-21/
Beaker 21.1 has been released.