matschaffer/knife-solo

Environment attribute differs from chef-server

Closed this issue · 4 comments

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

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?

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.

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.

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.