Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: tools/observatory_tool.py

Issue 2738983002: Sanity check that 'localhost' can be resolved before building Observatory (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/observatory_tool.py
diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
index 8450a07d62ad057fa6d88efcde39609fc21020b5..5936b8220517fe4c9c8da69a42d5724d44b3dec2 100755
--- a/tools/observatory_tool.py
+++ b/tools/observatory_tool.py
@@ -8,6 +8,7 @@ import argparse
import os
import platform
import shutil
+import socket
import subprocess
import sys
import utils
@@ -217,6 +218,13 @@ def ExecuteCommand(options, args):
return -1;
def main():
+ # Sanity check that localhost can be resolved.
+ try:
+ socket.gethostbyname('localhost')
+ except:
+ print("The hostname 'localhost' could not be resolved. Please fix your"
+ "/etc/hosts file and try again")
+ return -1
# Parse the options.
parser = BuildArguments()
(options, args) = parser.parse_known_args()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698