Chef::Mixin::Template::TemplateError(无法将 Symbol 转换为 Integer)
Chef::Mixin::Template::TemplateError (can't convert Symbol into Integer)
我正在尝试使用属性文件中的以下设置属性值到 comapany_name.properties.erb 文件。
但是没有传递值。
webapp/attributes/default.rb 文件
default['webapp']['company_name']['task_server'] = "false"
default['webapp']['company_name']['task_url'] = "localhost:8080"
default['webapp']['company_name']['task_queue'] = "simple"
webapp/templates/default/company_name.properties.erb 文件
# Tasks
task.server= <%=node [:webapp][:company_name1][:task_server]%>
task.url= <%=node [:webapp][:company_name1][:task_url]%>
task.queue.type= <%= node [:webapp][:company_name1][:task_queue]%>
执行chef-client,出现如下错误:
Running handlers:
[2015-01-22T05:31:51+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-01-22T05:31:51+00:00] ERROR: Exception handlers complete
[2015-01-22T05:31:51+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 8 resources updated in 9.220599177 seconds
[2015-01-22T05:31:51+00:00] ERROR:
Chef::Mixin::Template::TemplateError (can't convert Symbol into Integer) on line #20:
18:
19: # Tasks
20: task.server= <%= node [:webapp][:company_name1][:task_server]%>
21: task.url= <%= node [:webapp][:company_name1][:task_url]%>
22: task.queue.type= <%= node [:webapp][:company_name1][:task_queue]%>
(erubis):21:in `[]'
(erubis):21:in `block in evaluate'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `evaluate'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/mixin/template.rb:126:in `_render_template'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/mixin/template.rb:112:in `render_template'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/template/content.rb:43:in `file_for_provider'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/file_content_management/content_base.rb:40:in `tempfile'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:411:in `tempfile'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:350:in `do_contents_changes'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:121:in `action_create'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:131:in `action_create_if_missing'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider.rb:121:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource.rb:648:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:49:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:81:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:81:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection.rb:96:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:80:in `converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:345:in `converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:431:in `do_run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:213:in `block in run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:207:in `fork'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:207:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application.rb:236:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application/client.rb:338:in `block in run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application/client.rb:327:in `loop'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application/client.rb:327:in `run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application.rb:55:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/bin/chef-client:26:in `<top (required)>'
/bin/chef-client:23:in `load'
/bin/chef-client:23:in `<main>'
[2015-01-22T05:31:51+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
您不能在 node
和 []
通话之间进行 space。那应该是 node[:webapp][:company_name1][:task_server]
,
我正在尝试使用属性文件中的以下设置属性值到 comapany_name.properties.erb 文件。
但是没有传递值。
webapp/attributes/default.rb 文件
default['webapp']['company_name']['task_server'] = "false"
default['webapp']['company_name']['task_url'] = "localhost:8080"
default['webapp']['company_name']['task_queue'] = "simple"
webapp/templates/default/company_name.properties.erb 文件
# Tasks
task.server= <%=node [:webapp][:company_name1][:task_server]%>
task.url= <%=node [:webapp][:company_name1][:task_url]%>
task.queue.type= <%= node [:webapp][:company_name1][:task_queue]%>
执行chef-client,出现如下错误:
Running handlers:
[2015-01-22T05:31:51+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-01-22T05:31:51+00:00] ERROR: Exception handlers complete
[2015-01-22T05:31:51+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 8 resources updated in 9.220599177 seconds
[2015-01-22T05:31:51+00:00] ERROR:
Chef::Mixin::Template::TemplateError (can't convert Symbol into Integer) on line #20:
18:
19: # Tasks
20: task.server= <%= node [:webapp][:company_name1][:task_server]%>
21: task.url= <%= node [:webapp][:company_name1][:task_url]%>
22: task.queue.type= <%= node [:webapp][:company_name1][:task_queue]%>
(erubis):21:in `[]'
(erubis):21:in `block in evaluate'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `evaluate'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/mixin/template.rb:126:in `_render_template'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/mixin/template.rb:112:in `render_template'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/template/content.rb:43:in `file_for_provider'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/file_content_management/content_base.rb:40:in `tempfile'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:411:in `tempfile'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:350:in `do_contents_changes'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:121:in `action_create'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider/file.rb:131:in `action_create_if_missing'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/provider.rb:121:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource.rb:648:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:49:in `run_action'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:81:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:81:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/resource_collection.rb:96:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/runner.rb:80:in `converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:345:in `converge'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:431:in `do_run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:213:in `block in run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:207:in `fork'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/client.rb:207:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application.rb:236:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application/client.rb:338:in `block in run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application/client.rb:327:in `loop'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application/client.rb:327:in `run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/lib/chef/application.rb:55:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.4/bin/chef-client:26:in `<top (required)>'
/bin/chef-client:23:in `load'
/bin/chef-client:23:in `<main>'
[2015-01-22T05:31:51+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
您不能在 node
和 []
通话之间进行 space。那应该是 node[:webapp][:company_name1][:task_server]
,