[chef] Re: more of a ruby problem


Chronological Thread 
  • From: Kannan Manickam < >
  • To:
  • Subject: [chef] Re: more of a ruby problem
  • Date: Tue, 29 Oct 2013 22:58:04 -0700

Manoj,

You need to provide more debugging information such as the output and the file contents etc.

On Oct 29, 2013, at 10:51 PM, Manoj Thakkar < "> > wrote:

Hi All,

i have written this code but it never goes in if condition , i ma not sure why , 
if i replace the host with the real value of the hostname -s it does work , i am not sure what the issue is ,
might be a syntax error but Ruby does not complain about it , it silently ignores the if condition

please advise.


host=`hostname -s`

puts " hostname is #{host}"


File.open("/local_app/account-rest.properties", "r").each_line do |line|
  puts line
  puts host
   line.chomp
if line.include? "host"

puts " found host #{line}"

value = line.split(":").last
puts " found account value  #{value}"
puts value

end
end




Archive powered by MHonArc 2.6.16.

§