Cookbook fails when 'bootstrap true' added to config
simoninkin opened this issue · comments
Cookbook version
5.0.1
Platform Details
DigitalOcean
Steps to Reproduce:
Put the 'bootstrap true' in default['chef-server']['configuration'] and run the cookbook
For example:
default['chef-server']['configuration'] = <<-EOS bootstrap true ip_version "ipv4" notification_email "dev@company.com" nginx['cache_max_size'] = "3500m" EOS
Actual Result:
The cookbook fails to start with an error:
`
================================================================================
Recipe Compile Error in /var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `[]' for true:TrueClass
Cookbook Trace:
---------------
/var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/oc_id.rb:156:in `from_file'
/var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/default.rb:148:in `block in from_file'
/var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/default.rb:131:in `each'
/var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/default.rb:131:in `from_file'
Relevant File Content:
----------------------
/var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/oc_id.rb:
149: only_if { is_data_master? }
150: end
151:
152: component_runit_service "oc_id" do
153: package 'private_chef'
154: end
155:
156>> if node['private_chef']['bootstrap']['enable']
157: execute "/opt/opscode/bin/private-chef-ctl start oc_id" do
158: retries 20
159: end
160: end
161:
162: # Take the existing oc_id.applications (with only a redirect_uri), ensure they
163: # exist in the database, and dump their data to /etc/opscode/oc-id-applications.
164: node['private_chef']['oc_id']['applications'].each do |name, app|
165: oc_id_application name do
Platform:
---------
x86_64-linux
[2017-03-08T15:51:45+00:00] ERROR: Running exception handlers
[2017-03-08T15:51:45+00:00] ERROR: Exception handlers complete
[2017-03-08T15:51:45+00:00] FATAL: Stacktrace dumped to /var/opt/opscode/local-mode-cache/chef-stacktrace.out
[2017-03-08T15:51:45+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-03-08T15:51:45+00:00] FATAL: NoMethodError: undefined method `[]' for true:TrueClass
STDERR:
---- End output of chef-server-ctl reconfigure ----
Ran chef-server-ctl reconfigure returned 1
[2017-03-08T15:51:45+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)`
I've been trying to get this working and it only works without this option set in the config.
There is a note on the readme regarding the attribute, 'This must include newlines for each of the configuration items.' so adding some \n
or inserting the line breaks should resolve this.
Hi, sorry, couldn't get back to this earlier.
The new line chars are meant for the .json config definition, I am using the <<-EOS method
Perhaps it would've helped, if I included the config:
default['chef-server'][:configuration] = <<-EOS
bootstrap true
ip_version "ipv4"
notification_email "dev@company.com"
nginx['cache_max_size'] = "3500m"
EOS
Just to be sure, I've tested the following as well and got the same result:
default['chef-server'][:configuration] = "bootstrap true\nip_version \"ipv4\"\nnotification_email \"dev@company.com\"\nnginx['cache_max_size'] = \"3500m\"\n"
If I exclude the 'bootsrap true' flag from the conf, the cookbook works.