Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

zjherner
Copy link
Contributor

Creates a Windows specific ping command and outputs to NUL. Otherwise defaults to a Linux style ping.

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")
Copy link
Member

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?

Copy link
Contributor Author

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.

@ohadlevy
Copy link
Member

[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
Copy link
Member

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 :)

@lzap
Copy link
Member

lzap commented Jan 2, 2015

Please fix the indentation. [test]

@theforeman-bot
Copy link
Member

There were the following issues with the commit message:

  • 5b2600f must be in the format Fixes/refs #redmine_number - brief description.

Guidelines are available on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@theforeman-bot
Copy link
Member

There were the following issues with the commit message:

  • 73590fa must be in the format Fixes/refs #redmine_number - brief description.

Guidelines are available on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@zjherner zjherner force-pushed the develop branch 2 times, most recently from 73590fa to 203f53d Compare January 3, 2015 06:47
@theforeman-bot
Copy link
Member

There were the following issues with the commit message:

  • 203f53d must be in the format Fixes/refs #redmine_number - brief description.

Guidelines are available on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@lzap
Copy link
Member

lzap commented Jan 5, 2015

Also squash both commits into one in the proper format please ^^

@dmitri-d
Copy link
Member

dmitri-d commented Jan 6, 2015

[test]

@lzap
Copy link
Member

lzap commented Jan 7, 2015

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?

@dmitri-d
Copy link
Member

dmitri-d commented Jan 8, 2015

no windows here either; I'm ok with merging this as is.

@dmitri-d
Copy link
Member

merged in at a3783af. Thanks, @zjherner!

@dmitri-d dmitri-d closed this Jan 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants