[chef] How to join array in ruby dsl


Chronological Thread 
  • From: David Montgomery < >
  • To:
  • Subject: [chef] How to join array in ruby dsl
  • Date: Tue, 13 May 2014 14:10:10 +0800

Wowee.,,how do I join an array in template?


In the recipe:

hbase_host = ["127.0.0.1"]
template "/var/titan-#{feature}-#{version}/conf/titan-#{feature}.properties" do
  path "/var/titan-#{feature}-#{version}/conf/titan-#{feature}.properties"
  source "titan-hbase-#{feature}.properties.erb"
  owner "root"
  group "root"
  mode "0755"
  variables({
    :version => "#{version}", :hbase_host => hbase_host, :elasticsearch_host => "#{elasticsearch_host}", :elasticsearch_clustername => "#{elasticsearch_clustername}"
  })
  #notifies :restart, resources(:service => "supervisord")
end

In the template:

storage.hostname=< (",")%>


My sooooo lovely error....

Running handlers:
[2014-05-13T14:05:51+08:00] ERROR: Running exception handlers
Running handlers complete

[2014-05-13T14:05:51+08:00] ERROR: Exception handlers complete
[2014-05-13T14:05:51+08:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 1 resources updated in 9.574802321 seconds
[2014-05-13T14:05:51+08:00] ERROR:

Chef::Mixin::Template::TemplateError (undefined method `join' for "[\"127.0.0.1\"]":String) on line #96:

 94:             <properties>
 95:                 <storage.backend>hbase</storage.backend>
 96:                 <storage.hostname>< (",")%></storage.hostname>
 97:                 <storage.index.search.backend>elasticsearch</storage.index.search.backend>
 98:                

Thanks



Archive powered by MHonArc 2.6.16.

§