aboutsummaryrefslogtreecommitdiff
path: root/ec2
diff options
context:
space:
mode:
authorJeremy Derr <jcderr@radius.com>2015-11-26 19:25:13 -0800
committerReynold Xin <rxin@databricks.com>2015-11-26 19:25:13 -0800
commit5eaed4e45c6c57e995ac7438016fad545716e596 (patch)
tree4afa251cb1a4c68c42ef183bbfbb9a38d50244b0 /ec2
parent4d4cbc034bef559f47f8b74cecd8196dc8a85348 (diff)
downloadspark-5eaed4e45c6c57e995ac7438016fad545716e596.tar.gz
spark-5eaed4e45c6c57e995ac7438016fad545716e596.tar.bz2
spark-5eaed4e45c6c57e995ac7438016fad545716e596.zip
[SPARK-11991] fixes
If `--private-ips` is required but not provided, spark_ec2.py may behave inappropriately, including attempting to ssh to localhost in attempts to verify ssh connectivity to the cluster. This fixes that behavior by raising a `UsageError` exception if `get_dns_name` is unable to determine a hostname as a result. Author: Jeremy Derr <jcderr@radius.com> Closes #9975 from jcderr/SPARK-11991/ec_spark.py_hostname_check.
Diffstat (limited to 'ec2')
-rwxr-xr-xec2/spark_ec2.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index 9fd652a3df..84a950c9f6 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -1242,6 +1242,10 @@ def get_ip_address(instance, private_ips=False):
def get_dns_name(instance, private_ips=False):
dns = instance.public_dns_name if not private_ips else \
instance.private_ip_address
+ if not dns:
+ raise UsageError("Failed to determine hostname of {0}.\n"
+ "Please check that you provided --private-ips if "
+ "necessary".format(instance))
return dns