Red Hat Bugzilla – Bug 1274128
RFE: provide "unlike" operator
Last modified: 2015-10-27 18:15:00 EDT
We already have <not> which negates anything inside of it, so you can write:
<not><system><model op="like" value="%x3250%"/></system></not>
Can you use that?
Don't know that, and as I tested, it works:
# bkr list-systems --xml-filter='<not><system><model op="like" value="%x3250%"/></system></not>' |grep x3250
So is it supported in bkr.client yet? As 'like' only got in recently in bug 1010355.
bkr client has allowed you to pass any XML to --hostrequire for a long time, so you can use it already:
--hostrequire '<not><system><model op="like" value="%x3250%"/></system></not>'
What you are talking about for bug 1010355 is the shortcut syntax which translates
--hostrequire 'a like b'
into <a op="like" value="b"/>.
I'm not sure what shortcut syntax we could invent for <not/>, maybe a ! prefix or something, but I don't see much point in continuing to invent more and more extra bits of syntax for the --hostrequire option when we already have an entire filtering language in XML already.
BTW the <model/> filter is already inaccessible from the --hostrequire shortcut syntax since it needs to be wrapped in <system/>. I think at this level of complexity you're better off just passing the XML as is rather than having an extra layer of translation.
I originally thought the translation is the only way to get the 'like' or syntax <not/> into the job xml in our CI, turns out we could passing XML directly like you said. I put the xml with <and/>, <not/> into hostrequire list in the JSON file for CI and it also works.
"<and><system><name op='like' value='%ibm%'/></system></and>",
"<not><system><model op='like' value='%x3250%'/></system></not>",
"<not><system><model op='like' value='%x3850%'/></system></not>"
So I think this bug is resolved and could be closed now, thx.
Yes if you have a complicated <hostRequires/> filter the best option is to build it as XML and pass that straight through, then you can make use of the full filtering language.