V
Victor Reyes
[Note: parts of this message were removed to make it a legal post.]
Hello team,
I am having an issue with the code below.
Could you please take a quick look at the highlighted and commented code
below and let me know what's wrong?
Thank you
Victor
input.file
group.was=hostname1 hostname.2 hostname.r3
group.web=webserver1 webserver2 webserver3 hostname1 /usr/local/bin/test.sh
web /usr/local/bin/testcmd.sh
#end of input.file
# Program
@myhostname = `hostname` # webserver3
#comment# The intent is to create a arrays "was" and "web" and to assign the
values in the group statement
IO.foreach("inpit.file") do |line|
if line =~ /^#/ || line.chomp.length == 0
next
end # if line
if line.upcase =~ /^GROUP/
grouplit, groupinfo = line.split(".")
groupname, groupentries = groupinfo.split("=")
#{groupname} = groupname.to_a
groupname = groupentries.split
next
end # if GROUP
targetserver, command = line.split(" ")
if targetserver == @myhostname
@runcommand = true
end # if targetserver
#comment# In this case I'm trying to determine if "myhostname" is in the
array "web"
#comment# I've tried a number of ways to get the following to work without
success
if #{targetserver}.*include?* "#{@myhostname <%23%7B@myhostname>}"
####### THIS IS WHERE THE FAILURE IS
@runcommand = true
end # if
end
exit
Hello team,
I am having an issue with the code below.
Could you please take a quick look at the highlighted and commented code
below and let me know what's wrong?
Thank you
Victor
input.file
group.was=hostname1 hostname.2 hostname.r3
group.web=webserver1 webserver2 webserver3 hostname1 /usr/local/bin/test.sh
web /usr/local/bin/testcmd.sh
#end of input.file
# Program
@myhostname = `hostname` # webserver3
#comment# The intent is to create a arrays "was" and "web" and to assign the
values in the group statement
IO.foreach("inpit.file") do |line|
if line =~ /^#/ || line.chomp.length == 0
next
end # if line
if line.upcase =~ /^GROUP/
grouplit, groupinfo = line.split(".")
groupname, groupentries = groupinfo.split("=")
#{groupname} = groupname.to_a
groupname = groupentries.split
next
end # if GROUP
targetserver, command = line.split(" ")
if targetserver == @myhostname
@runcommand = true
end # if targetserver
#comment# In this case I'm trying to determine if "myhostname" is in the
array "web"
#comment# I've tried a number of ways to get the following to work without
success
if #{targetserver}.*include?* "#{@myhostname <%23%7B@myhostname>}"
####### THIS IS WHERE THE FAILURE IS
@runcommand = true
end # if
end
exit