-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #8788 - DHCP not detecting pingable addresses on Windows #242
Conversation
system("ping -n 1 -w 1 #{ip} > NUL") | ||
else | ||
# Default to Linux ping options and send to /dev/null | ||
system("ping -c 1 -W 1 #{ip} > /dev/null") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR this used to work on windows, did the syntax changed based on the OS version? e.g. do we need to have another condition based on the windows version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it ever worked on windows. I just checked my 2003 and 2012
servers and the syntax is the same as 2008.
On Wed, Dec 24, 2014 at 1:30 AM, Ohad Levy notifications@github.com wrote:
In modules/dhcp/subnet.rb
#242 (diff)
:@@ -277,7 +277,13 @@ def tcp_pingable? ip
def icmp_pingable? ip # Always shell to ping, instead of using net-ping
system("ping -c 1 -W 1 #{ip} > /dev/null")
if PLATFORM =~ /mingw/
# Windows uses different options for ping and does not have /dev/null
system("ping -n 1 -w 1 #{ip} > NUL")
else
# Default to Linux ping options and send to /dev/null
system("ping -c 1 -W 1 #{ip} > /dev/null")
AFAIR this used to work on windows, did the syntax changed based on the OS
version? e.g. do we need to have another condition based on the windows
version?—
Reply to this email directly or view it on GitHub
https://github.com/theforeman/smart-proxy/pull/242/files#r22247926.
[test] |
else | ||
# Default to Linux ping options and send to /dev/null | ||
system("ping -c 1 -W 1 #{ip} > /dev/null") | ||
end | ||
rescue | ||
# We failed to check this address so we should not use it | ||
true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this working because of this (we return true
in case of error :)
Please fix the indentation. [test] |
There were the following issues with the commit message:
Guidelines are available on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
There were the following issues with the commit message:
Guidelines are available on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
73590fa
to
203f53d
Compare
There were the following issues with the commit message:
Guidelines are available on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
Also squash both commits into one in the proper format please ^^ |
[test] |
Now I haven't tested that on Windows because that would require me to - ehm - find a Windows box. I am fine to merge, harmless. Anyone want to test on Windows? |
no windows here either; I'm ok with merging this as is. |
Creates a Windows specific ping command and outputs to NUL. Otherwise defaults to a Linux style ping.