|
@@ -557,15 +557,18 @@ def ffpb_ping(bot, trigger=None, target_name=None):
|
|
|
target = [x for x in node["network"]["addresses"] if not x.lower().startswith("fe80:")][0]
|
|
|
target_alias = node["hostname"]
|
|
|
|
|
|
- print("ping '", target , '"', sep='')
|
|
|
- result = os.system('ping6 -c 2 -W 1 ' + target + ' 2>/dev/null')
|
|
|
+ print("pinging '{0}' at {1} ...".format(target_name, target))
|
|
|
+ result = os.system('ping6 -c 2 -W 1 ' + target + ' >/dev/null')
|
|
|
if result == 0:
|
|
|
+ print("ping to '{0}' succeeded".format(target_name))
|
|
|
if not bot is None: bot.say('Knoten "' + target_alias + '" antwortet \o/')
|
|
|
return True
|
|
|
elif result == 1 or result == 256:
|
|
|
+ print("ping to '{0}' failed".format(target_name))
|
|
|
if not bot is None: bot.say('Keine Antwort von "' + target_alias + '" :-(')
|
|
|
return False
|
|
|
else:
|
|
|
+ print("ping to '{0}' broken: result='{1}'".format(target_name, result))
|
|
|
if not bot is None: bot.say('Uh oh, irgendwas ist kaputt. Chef, ping result = ' + str(result) + ' - darf ich das essen?')
|
|
|
return None
|
|
|
|