On Wednesday, October 30, 2013 at 1:16 AM, Manoj Thakkar wrote:
Sorry for asking it , but i am stuck again , looks like i am not able to read the variable i got from ruby_blocki am not sure what's wrong :ruby_block "acc-deploy-host" doblock doChef::Log.info " host name is #{node['hostname']} "host=node['hostname']puts " hostname is #{host}"File.open("/local_app/account-rest.properties", "r").each_line do |line|Chef::Log.info "#{host} Account Rest line: #{line}"if line.include?(host)Chef::Log.info "Found host #{host} in #{line}"deploy = line.split(':').lastdeploy = deploy.gsub(/\n/," ")node.set['account_deploy']=deployChef::Log.info "Found account value #{node['account_deploy']}"endendendnode['account_deploy'].each do |x|puts #xendendAn important thing to keep in mind about Ruby blocks is that it may or may not be executed at a different time than the surrounding code. In this case, Chef holds on to the code you pass into `block do` so it can evaluate it during the converge phase of the chef run. The surrounding code is executed immediately.--Daniel DeLeo
Archive powered by MHonArc 2.6.16.