Sha256: 1e7744c3f4b19ca18739834fcf5ef2376771ff950ef63d0d2f17749fac154d53

Contents?: true

Size: 988 Bytes

Versions: 5

Compression:

Stored size: 988 Bytes

Contents

# recipe riak::default uses some illegal statements 
# (under Chef 11) which we fix here using dynamic property lookup:
node.set["riak"]["kv"] = Hash.new(node["riak"]["kv"])
node.set["riak"]["kv"]["storage_backend"] = :riak_kv_bitcask_backend
node.set["riak"]["sasl"]["errlog_type"] = :error
class DynamicAttrLookup
  def initialize(node_value)
    @node_value = node_value
  end
  def method_missing(m, *args, &block)
    if @node_value.respond_to?(m)
      @node_value.send(m, *args)
    else
      DynamicAttrLookup.new(@node_value[m])
    end
  end
end
class ::Chef
  class Node
    def riak
      DynamicAttrLookup.new(self["riak"])
    end
    def ip_address
      DynamicAttrLookup.new(self["ip_address"])
    end
    class ImmutableMash
      def delete(arg1)
        super(arg1)
      end
    end
  end
    module DSL
      module Recipe
        def default
          puts "Called default!! #{node.set}"
          DynamicAttrLookup.new(node.set)
        end
      end
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cloud-toaster-1.1.6 chef/cookbooks/toaster/recipes/pre__riak__default.rb
cloud-toaster-1.1.5 chef/cookbooks/toaster/recipes/pre__riak__default.rb
cloud-toaster-1.1.4 chef/cookbooks/toaster/recipes/pre__riak__default.rb
cloud-toaster-1.1.3 chef/cookbooks/toaster/recipes/pre__riak__default.rb
cloud-toaster-1.1.2 chef/cookbooks/toaster/recipes/pre__riak__default.rb