chef-cookbooks icon indicating copy to clipboard operation
chef-cookbooks copied to clipboard

syntax error for sysctl_multi LWRP use

Open donnielee opened this issue 7 years ago • 1 comments

When I created a parameter.rb under recipes directory and uploaded to the Chef automate, knife displayed below syntax error message. Would you help me what did I wrong?

#cat ~/sysctl/recipes/parameter.rb include_recipe 'sysctl::default' sysctl_multi 'ip config' do instructions { 'net.ipv4.ip_forward' => '1', 'net.ipv6.conf.all.forwarding' => '1', 'net.ipv4.tcp_syncookies' => '1'} end

1103143ui-MacBook-Pro:chef-repo a1103143$ knife cookbook upload sysctl Uploading sysctl [0.1.7] FATAL: Cookbook file recipes/parameter.rb has a ruby syntax error: FATAL: /Users/a1103143/chef-repo/cookbooks/sysctl/recipes/parameter.rb:22: syntax error, unexpected =>, expecting '}' FATAL: 'net.ipv4.ip_forward' =>'1', FATAL: ^ FATAL: /Users/a1103143/chef-repo/cookbooks/sysctl/recipes/parameter.rb:22: syntax error, unexpected ',', expecting '}' FATAL: /Users/a1103143/chef-repo/cookbooks/sysctl/recipes/parameter.rb:23: syntax error, unexpected =>, expecting '}' FATAL: 'net.ipv6.conf.all.forwarding' =>'1', FATAL: ^ FATAL: /Users/a1103143/chef-repo/cookbooks/sysctl/recipes/parameter.rb:23: syntax error, unexpected ',', expecting '}' FATAL: /Users/a1103143/chef-repo/cookbooks/sysctl/recipes/parameter.rb:24: syntax error, unexpected =>, expecting '}' FATAL: 'net.ipv4.tcp_syncookies' =>'1'}

donnielee avatar Mar 09 '17 06:03 donnielee

I made it with my colleague Jaebok Park's help.

Just include () like below. #cat ~/sysctl/recipes/parameter.rb include_recipe 'sysctl::default' sysctl_multi 'ip config' do instructions ({ 'net.ipv4.ip_forward' => '1', 'net.ipv6.conf.all.forwarding' => '1', 'net.ipv4.tcp_syncookies' => '1'}) end

donnielee avatar Mar 14 '17 01:03 donnielee