Bug 1274128 - RFE: provide "unlike" operator
Summary: RFE: provide "unlike" operator
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Beaker
Classification: Retired
Component: scheduler
Version: 21
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: beaker-dev-list
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On: 610745 741496
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-22 03:20 UTC by Wayne Sun
Modified: 2015-10-27 22:15 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 610745
Environment:
Last Closed: 2015-10-27 22:15:00 UTC
Embargoed:


Attachments (Terms of Use)

Comment 1 Dan Callaghan 2015-10-23 05:26:48 UTC
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?

Comment 2 Wayne Sun 2015-10-23 06:57:21 UTC
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.

Comment 3 Dan Callaghan 2015-10-26 00:35:38 UTC
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.

Comment 4 Dan Callaghan 2015-10-26 00:37:02 UTC
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.

Comment 5 Wayne Sun 2015-10-27 06:18:38 UTC
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.

e.g.
 "hostrequire": [
                        "arch=X86_64", 
                        "memory>=7000",
                        "<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.

Comment 6 Dan Callaghan 2015-10-27 22:15:00 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.