Open mipearson opened 12 years ago
You assumption is correct, though this cookbook's case is a bit confusing.
There are a couple of cookbooks that use node.save
, at which point the current node attributes (well, everything) is saved. That only works with a Chef Server. For obvious reasons, Chef Solo cannot save the new info anywhere, so LittleChef by design cannot support that. It could be argued that it is a Chef anti-patern...
What I don't quite understand is why it is a problem in the ufw cookbook, because they don't call node.save
in any of the recipes. Reassigning attribute values mid-cookbook should only affect the current run as long as they are not saved.
In any case I marked this issue as "enhancement". We can add a list of cookbooks that use node.save
to the documentation so that users are aware of which cookbooks can break when using Chef Solo. A preliminary one:
$ grep -r "node.save" opscode-cookbooks ./wordpress/recipes/default.rb: node.save ./drbd/recipes/default.rb:node.save unless Chef::Config[:solo] ./database/recipes/master.rb: node.save ./zenoss/recipes/server.rb: node.save ./aws/providers/ebs_volume.rb: node.save unless Chef::Config[:solo] ./rsyslog/recipes/server.rb:node.save unless Chef::Config[:solo] ./ossec/recipes/server.rb:node.save ./ossec/recipes/client.rb:node.save ./sql_server/recipes/server.rb:node.save unless Chef::Config[:solo] ./postgresql/recipes/server.rb:node.save unless Chef::Config[:solo] ./mysql/recipes/server.rb
I'm unsure whether this is a 'bug' or my misunderstanding of how littlechef works.
I'm using the 'ufw' cookbook to manage firewall rules on a machine I'm provisioning with littlechef.
The cookbook's recipe contains this stanza:
The problem I have is the firewall 'state' is never saved to the my node's .json, and therefore the firewall is reset every time this recipe is run.
Should the state be saved? If so, when/where in littlechef does this happen?
I'm assuming this cookbook works as advertised when run with knife/chef server.