chef-cookbooks
chef-cookbooks copied to clipboard
syntax error for sysctl_multi LWRP use
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'}
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