Skip to content
Snippets Groups Projects
Commit 5eaed4e4 authored by Jeremy Derr's avatar Jeremy Derr Committed by Reynold Xin
Browse files

[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.
parent 4d4cbc03
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment