Mcollective Ruby Script Somtimes Failed to Return Run Result after Ping Test

asked 2015-03-29 22:41:38 -0600

Kitty Yeung gravatar image

Hello,

I have an application script to first ping test the servers,

client = rpcclient("rpcutil")

client.discover(:nodes => allserverarray)

data = client.ping().map{|r| r.results}

data.each do |each_data|

a = each_data[:sender]

datastring = datastring + " " + a + " "

printf("PASSED ... " + a + "\n")

end

client.disconnect

if the ping test is good, then the script will move forward to run its agent script for puppet apply,

client = rpcclient("agent_name")

      client.agent_name(

        :tags        => tags,

        :option      => options

      ).each do |resp|

        printf("%s", resp[:data][:out/error/status/all])

      end

client.disconnect

agent script to run the puppet agent as follow

/opt/puppet/bin/puppet agent --test --color=false --tags %s --splay --splaylimit 120

However, I found an interesteing issue that when there is ping function before running the agent script, the agent can always run on the target servers, however, the result (e.g. error/out/status) cannot be returned intermittently and it mentioned there is no response from the servers, but actually the scripts run on the target servers with result.

After I removed the ping section, the agent script can always work fine with exepcted result output.

Is there any issues on the ping scripts section that I developed ? Thank you.

edit retag flag offensive close merge delete