Skip to content

Instantly share code, notes, and snippets.

@jordandm
Created April 5, 2012 01:18
Show Gist options
  • Select an option

  • Save jordandm/2307145 to your computer and use it in GitHub Desktop.

Select an option

Save jordandm/2307145 to your computer and use it in GitHub Desktop.
hef::Mixin::Template::TemplateError: undefined method `each' for "65536":String
The recipe:
# Cookbook Name:: worker
# Recipe:: instance-tuning
#
# Copyright 2012, Numenta, Inc.
#
# All rights reserved - Do Not Redistribute
#
limits = data_bag_item('limits', 'worker')
template '/etc/security/limits.conf' do
source 'limits.conf.erb'
owner 'root'
group 'root'
mode '0644'
variables(
:domains => limits['domains']
)
action :create
end
The Databag:
{
"id": "worker" ,
"domains" : {
"ec2-user": {
"nofile": {
"soft": "131072",
"hard": "131072"
},
"nproc": {
"soft": "65536",
"hard": "65536"
}
}
}
}
The Template:
#<domain> <type> <item> <value>
#
#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
<% @domains.each do |domain, items| %>
<% items.each do |item, types | %>
<% types.each do |type, values| %>
<% values.each do |value| %>
<%= "#{domain}".ljust(16) %> <%= "#{type}".ljust(8) %><%= "#{item}".ljust(16) %><%= "#{value}" %>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
# End of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment