airbnb / smartstack-cookbook

The chef recipes for running and testing Airbnb's SmartStack
MIT License
245 stars 45 forks source link

Attribute deep_to_hash is not defined! #7

Closed qasimkhan closed 10 years ago

qasimkhan commented 10 years ago

Hey, I am getting error while running nerve using chef-solo 10.18.2, any idea how can I fix it?

/var/chef/cookbooks/smartstack/recipes/nerve.rb:

 66:  # we do this in the recipe to avoid wierdness with attribute load order
 67:  node.nerve.enabled_services.each do |service_name|
 68:    unless node.smartstack.services.include? service_name
 69:      Chef::Log.warn "[nerve] skipping non-existent service #{service_name}"
 70:      next
 71:    end
 72:  
 73>>   service = node.smartstack.services[service_name].deep_to_hash
 74:  
 75:    unless service.include? 'nerve'
 76:      Chef::Log.warn "[nerve] skipping unconfigured service #{service_name}"
 77:      next
 78:    end
 79:  
 80:    check = service['nerve']
 81:    check['zk_hosts'] = node.zookeeper.smartstack_cluster
 82:    check['zk_path'] = service['zk_path']

[2013-11-24T06:18:57-08:00] ERROR: Running exception handlers
[2013-11-24T06:18:57-08:00] ERROR: Exception handlers complete
[2013-11-24T06:18:57-08:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2013-11-24T06:18:57-08:00] FATAL: ArgumentError: Attribute deep_to_hash is not defined!
igor47 commented 10 years ago

we've only tested this cookbook with chef 11; between chef 10 and chef 11, the semantics of 'to_hash' changed, so we had to override the ImmutableMash object in a library (see the libraries dir and this ticket i have with opscode).

you could fix this by using chef11, or by using alias_method on the relevant object in chef10 to alias to_hash to deep_to_hash in a library.

qasimkhan commented 10 years ago

cool, alias_method worked thanks!