I'm trying to understand why the output of
knife node list
vs
knife exec -E 'nodes.all.each {|n| puts "#{n.name}"}'
Don't give me the same node names. I would expect the above commands to show me the same names but at the moment there are discrepancies, seems like any new node isn't picked up in the second command (knife exec..)
Any idea what might cause this and how to debug it?
Looking at the code for
knife node list, it looks like this command will not output all of the nodes if you have an environment listed in your knife.rb file. It looks like runningknife node execreturns the raw node object.See the code here for
knife node list: https://github.com/chef/chef/blob/f53ad6511b7fcc40576f05688dc17b11ad58e089/knife/lib/chef/knife/node_list.rb#L37-L40See code here for the
nodesobject: https://github.com/chef/chef/blob/f53ad6511b7fcc40576f05688dc17b11ad58e089/lib/chef/shell/ext.rb#L461-L463