matschaffer / knife-solo

DEPRECATED: Please consider using https://knife-zero.github.io/, ansible, or visit https://www.chef.io/ for other ideas
MIT License
786 stars 213 forks source link

Environment attribute differs from chef-server #464

Closed rmoriz closed 8 years ago

rmoriz commented 8 years ago

Looks like chef-server setups use 'chef_environment' as key in the node object, while knife-solo uses just environment

https://github.com/matschaffer/knife-solo/blob/master/lib/knife-solo/node_config_command.rb#L62-L65

vs.

https://docs.chef.io/environments.html

matschaffer commented 8 years ago

That ultimately ends up here which I believe is correct for chef-solo.

Is there something you're trying to do with environments that isn't working as expected?

matschaffer commented 8 years ago

Might be worth noting that knife-solo's node files are used as an argument to chef-solo's --json-attributes option where the expected format is a bit different than what you'd get back from a knife node show -F json against chef server.

rmoriz commented 8 years ago

I tried to put a node into an environment after provisioning by adding an chef_environment attribute in the json file which was not picked up. After changing the key to environment it worked.

matschaffer commented 8 years ago

Okay, that is expected behavior. If you find that we can use chef_environment for consistency, I'm happy to change it. But I seem to recall chef won't let you do that so closing for now.