On 10/04/2013 09:21 PM, Kendall Gifford
wrote:
" type="cite">I don't know why. But () don't help for me. As in the recipe code and erb template code including. " type="cite">I cannot find via google /m, May be /m has a literal name for googling ? " type="cite">I've tested out this example. All it's okey in irb. I don't get strange behaviour in IRB never. But chef runtime is something else. " type="cite">I am mistake when copy-past a template example: LoadModule passenger_module <%= /buildout/apache2/mod_passenger.so">"/usr/local/rvm/gems/#{node['redmine']['rubyversion']}/gems/ /buildout/apache2/mod_passenger.so" %> I remake a template with a local var, that sending to a template from recipe code: configfile = "#{node['redmine']['datafs']}/config/mods-available/passenger.load" template configfile do source "passenger.load.erb" mode 0400 variables ({ :pasver => pasver }) notifies :restart, resources(:service=>"apache2") end I add "variables ({ ... })". This is because you suggestions isn't worked out for me at all. I don't understand why. But if I use /m modifier then in the my old template code there is no value for pasver variable, and template generates all without pasver value: LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-/buildout/apache2/mod_passenger.so May be this is an ruby object scope area ? Now I use pasver variable generation in the recipe code: pasver = `/usr/local/rvm/bin/gem list | grep passenger`.sub /.*\((.*)\).*/m, '\1' And after I transfer it to the erb's. So I using this generated var in recipe - and all it's okey: pasver = `/usr/local/rvm/bin/gem list | grep passenger`.sub /.*\((.*)\).*/m, '\1' if ! ::File.exists?("/usr/local/rvm/gems/#{node['redmine']['rubyversion']}/gems/passenger-#{pasver}/buildout/apache2/mod_passenger.so") then bash "build_and_install_passenger_module_for_apache" do user "root" code <<-EOH source /etc/profile.d/rvm.sh /usr/local/rvm/gems/#{node['redmine']['rubyversion']}/bin/passenger-install-apache2-module -a EOH not_if ::File.exists?("/usr/local/rvm/gems/#{node['redmine']['rubyversion']}/gems/passenger-#{pasver}/buildout/apache2/mod_passenger.so") end Strange behaviour happens. " type="cite"> -- Best regards, CVision Lab System Administrator Vladmir Skubriev |
Archive powered by MHonArc 2.6.16.