Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume a default query key when none provided in knife zero chef_client QUERY #33

Open
patcon opened this issue Jun 10, 2015 · 7 comments

Comments

@patcon
Copy link
Contributor

patcon commented Jun 10, 2015

It seems that even when there's a node/example.com.json, knife zero chef_client example.com doesn't work, and instead, we must use knife zero chef_client name:example.com

Would be great if knife-zero assumed a default key, either name or fqdn (I prefer "name", as it should intuitiveless always match the json filename in nodes/. Yes, in the current knife-zero this is also the fqdn, but this need not necessarily be the case in the future)

@sawanoboly
Copy link
Member

hmm... QUERY syntax based on knife search, ssh. It's usage of chef-server/client environment.

https://docs.chef.io/knife_ssh.html
https://docs.chef.io/knife_search.html

If I implement specific usage to knife-zero, then it's getting harder to follow chef-core updates ( and the edge of chef often cases regression ...).

But, I seem to better way to use name or fqdn by default. In that case, there is a need to be careful not to use as a regular expression.

@patcon
Copy link
Contributor Author

patcon commented Jun 12, 2015

You're right about it diverging from chef-core. Perhaps it would be welcome there. Created a ticket here for discussion: chef/chef#3526

@sawanoboly
Copy link
Member

Thank you for create issue to core 😃

@patcon
Copy link
Contributor Author

patcon commented Jun 13, 2015

bwaha. the label.

@patcon
Copy link
Contributor Author

patcon commented Jun 15, 2015

fyi this would work for knife zero commands. Feel free to offer feedback:
chef/chef#3536

@sawanoboly
Copy link
Member

@patcon great!

I've add below to Gemfile and tested it.

gem 'chef', github: 'patcon/chef', ref: '3526-fuzz-ssh-query'

There are node which is named knife-zero02. It have IP 133.242.xxx.xxx.

$ bundle exec knife node show knife-zero02
Node Name:   knife-zero02
Environment: _default
FQDN:        
IP:          133.242.xxx.xxx
Run List:    
Roles:       
Recipes:     
Platform:    ubuntu 14.04
Tags:        

In this case, I should pass an ipaddress to fuzzy_query.

$ bundle exec knife zero converge 133.242.xxx.xxx -a ipaddress
133.242.xxx.xxx sudo: unable to resolve host knife-zero02
133.242.xxx.xxx Starting Chef Client, version 12.3.0
133.242.xxx.xxx resolving cookbooks for run list: []
133.242.xxx.xxx Synchronizing Cookbooks:
133.242.xxx.xxx Compiling Cookbooks...
133.242.xxx.xxx [2015-06-16T15:01:09+09:00] WARN: Node knife-zero02 has an empty run list.
133.242.xxx.xxx Converging 0 resources
133.242.xxx.xxx [2015-06-16T15:01:09+09:00] WARN: Could not find whitelist attribute fqdn/.
133.242.xxx.xxx [2015-06-16T15:01:09+09:00] WARN: Could not find whitelist attribute cloud.
133.242.xxx.xxx 
133.242.xxx.xxx Running handlers:
133.242.xxx.xxx Running handlers complete
133.242.xxx.xxx Chef Client finished, 0/0 resources updated in 1.760414153 seconds

How about include name to fuzzy target?

$ bundle exec knife zero converge knife-zero02 -a ipaddress
FATAL: No nodes returned from search!

@patcon
Copy link
Contributor Author

patcon commented Jun 16, 2015

I'm down, but it sounds like Lamont thinks this logic should match the search logic, so maybe mention the idea in the chef issue?

Also, I'll make sure to leave it around this time, but I'd recommend against using my feature branches on your master, as my habit is to delete them after merge, and sometimes they break :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants