Comments (12)
This is with chef-zero 1.5.1 on ruby 1.9.3-p429 - sorry for not mentioning that.
from chef-zero.
On the other hand, this works:
$ knife search users 'groups:sysadmin NOT action:remove'
1 items found
chef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash
So perhaps it is choking on the AND somehow? This same query against Hosted Chef or an open source Chef 11 server works fine, although http://docs.opscode.com/essentials_search.html does not mention the AND NOT syntax.
from chef-zero.
@jkeiser is this test in pedant? If not, maybe it should be added to prevent a regression. I confirm what @markcornick is reporting.
from chef-zero.
@markcornick i ran into this also I have a PR open for the users cookbook: sous-chefs/users#27
from chef-zero.
It's worth pointing out that "groups:sysadmin NOT action:remove" is actually equivalent "groups:sysadmin OR NOT action:remove" -- not AND. This is from a reading of the chef-zero code, which was based on a reading of the lucene spec.
Can you check whether "groups:sysadmin OR NOT action:remove" works? That might give us a tiny bit more data.
We need a lot more search query tests in pedant--there are very few.
This is on my radar, but this vacation is turning out to be an extremely busy one.
from chef-zero.
That's good to know about what x:y NOT z:w expands to - in the case of this cookbook, AND NOT is the desired behavior, not OR NOT.
Anyway, OR NOT works for this query with the above data:
$ knife search users 'groups:sysadmin OR NOT action:remove' -c knife.rb
1 items found
chef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash
from chef-zero.
Confirmed. It looks like this is a precedence error: NOT is binding tighter than :. I'll work up a fix for this (and for the fact that subqueries aren't presently working) ASAP. Might not be till later though.
from chef-zero.
Fixed with a9f0654 ... I think.
I tried a few combinations, but could use some inventive querying--I have to go look at houses tonight and don't have time to write pedant tests ATM. Can someone install latest master and tell me if things are working in general for you? Anything particularly involving a:b in various combinations.
from chef-zero.
If you guys confirm it's working ok in general, I'll button up a release when I get back.
from chef-zero.
I've tried this and am getting the expected results for groups:sysadmin AND NOT action:remove
and groups:sysadmin OR NOT action:remove
using data bag items that would match or not match groups:sysadmin
and action:remove
individually. This looks like the correct fix to me. Thanks for taking vacation time to fix it!
$ cat knife.rb
node_name "markcornick"
client_key "/Users/mcornick/.chef/markcornick.pem"
chef_server_url "http://127.0.0.1:8889"
$ cat mark.json
{
"groups": [ "sysadmin" ],
"comment": "Mark Cornick",
"id": "mark",
"shell": "/bin/bash"
}
$ knife data bag create users -c knife.rb
Created data_bag[users]
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin AND NOT action:remove' -c knife.rb
1 items found
chef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash
$ vi mark.json # add "action": "remove"
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin AND NOT action:remove' -c knife.rb
0 items found
$ vi mark.json # remove "action": "remove", change "sysadmin" to "user"
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin AND NOT action:remove' -c knife.rb
1 items found
chef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash
$ knife search users 'groups:sysadmin OR NOT action:remove' -c knife.rb
1 items found
chef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash
$ vi mark.json # add "action": "remove" again
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin OR NOT action:remove' -c knife.rb
0 items found
from chef-zero.
Awesome I will close my users pull request since this is supported now.
On Jun 26, 2013 5:27 PM, "Mark Cornick" [email protected] wrote:
I've tried this and am getting the expected results for groups:sysadmin
AND NOT action:remove and groups:sysadmin OR NOT action:remove using data
bag items that would match or not match groups:sysadmin and action:removeindividually. This looks like the correct fix to me. Thanks for taking
vacation time to fix it!$ cat knife.rb
node_name "markcornick"
client_key "/Users/mcornick/.chef/markcornick.pem"
chef_server_url "http://127.0.0.1:8889"
$ cat mark.json
{
"groups": [ "sysadmin" ],
"comment": "Mark Cornick",
"id": "mark",
"shell": "/bin/bash"
}
$ knife data bag create users -c knife.rb
Created data_bag[users]
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin AND NOT action:remove' -c knife.rb
1 items foundchef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash$ vi mark.json # add "action": "remove"
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin AND NOT action:remove' -c knife.rb
0 items found$ vi mark.json # remove "action": "remove", change "sysadmin" to "user"
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin AND NOT action:remove' -c knife.rb
1 items foundchef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash$ knife search users 'groups:sysadmin OR NOT action:remove' -c knife.rb
1 items foundchef_type: data_bag_item
comment: Mark Cornick
data_bag: users
groups: sysadmin
id: mark
shell: /bin/bash$ vi mark.json # add "action": "remove" again
$ knife data bag from file users mark.json -c knife.rb
Updated data_bag_item[users::mark]
$ knife search users 'groups:sysadmin OR NOT action:remove' -c knife.rb
0 items found—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-20089863
.
from chef-zero.
Released in 1.5.2! Thanks tons! I need to figure out a way to track missing pedant tests so I can make those when I return.
from chef-zero.
Related Issues (20)
- kitchen and chef-zero 404ing on data bag HOT 3
- check if a data_bag exists HOT 1
- chef-zero should make data available on save HOT 4
- Exception when file has #2 at the end of name HOT 1
- Chef zero outputs too much information for info log level HOT 3
- Chef encountered an error attempting to load the node data HOT 2
- Should do a release HOT 7
- Uploading cookbooks to chef-zero using berks often crashes when Request timeout is 300 HOT 3
- Improper require of Hashie causing error (NameError: uninitialized constant Hashie::Extensions::Array) HOT 5
- Unable to connect to chef-zero HOT 1
- Chef 13 vs Chef 12 ip address resolution HOT 1
- Completely arbitrary ruby version requirement HOT 2
- Need a mode of operation where chef-zero runs in-memory but populates from the disk cache
- Do not format the node definition JSON file after converging HOT 1
- Could chef-zero please support fetching inspec profiles?
- Re-raising exception: URI::InvalidURIError - bad URI(is not URI?)
- missing webrick makes chef-zero fail
- Add unique email contraint while creating user
- Configuring the chef-zero-automate reporter for the compliance phase 404s in TK against chef-zero
- Policy Groups in the policy file details (chef-zero) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chef-zero.