From b5efe15d67b47c59fb50e77008b6591c37125ca6 Mon Sep 17 00:00:00 2001 From: Taciano Tres Date: Thu, 3 Apr 2014 11:57:42 -0300 Subject: [PATCH] Reordering ping parameters to work with AIX. For GNU/Linux (at least RHEL 6), the ping parameters order doesn't matter. But for AIX I get an error with the original order: $ sudo ping -n 127.0.0.1 -w 3 -c 2 0821-077 ping: illegal packet size. and it works if the parameters order just get rearranged: $ sudo ping -w 3 -c 2 -n 127.0.0.1 PING 127.0.0.1: (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0 ms --- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 0/0/0 ms --- lib/specinfra/command/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/specinfra/command/base.rb b/lib/specinfra/command/base.rb index f86189101..117d73e17 100644 --- a/lib/specinfra/command/base.rb +++ b/lib/specinfra/command/base.rb @@ -39,7 +39,7 @@ def check_routing_table(destination) def check_reachable(host, port, proto, timeout) if port.nil? - "ping -n #{escape(host)} -w #{escape(timeout)} -c 2" + "ping -w #{escape(timeout)} -c 2 -n #{escape(host)}" else "nc -vvvvz#{escape(proto[0].chr)} #{escape(host)} #{escape(port)} -w #{escape(timeout)}" end