Skip to content

Commit

Permalink
attempt to fix ping
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfleischer committed Nov 26, 2023
1 parent 7c137a5 commit c4d3de4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cloudmesh/common/Host.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from cloudmesh.common.parameter import Parameter
from cloudmesh.common.util import path_expand
from cloudmesh.common.util import readfile
from cloudmesh.common.systeminfo import os_is_windows
from pprint import pprint
from cloudmesh.common.Printer import Printer

Expand Down Expand Up @@ -325,8 +326,15 @@ def _ping(args):
"""
ip = args['ip']
count = str(args['count'])
count_flag = '-n' if platform == 'windows' else '-c'
command = ['ping', count_flag, count, ip]

count_flag = '-n' if os_is_windows() else '-c'
if os_is_windows():
# adding ipv4 enforce for windows
# for some reason -4 is required or hosts
# fail. we need ipv4
command = ['ping', '-4', ip, count_flag, count]
else:
command = ['ping', count_flag, count, ip]
result = subprocess.run(command, capture_output=True)
print(result)
print('THAT WAS RESULT!!!')
Expand Down

0 comments on commit c4d3de4

Please sign in to comment.