Skip to content

Commit

Permalink
Fix get_hostname for windows ec2 instances
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaj committed Apr 28, 2016
1 parent 153cb10 commit d9663d4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,11 @@ def _get_hostname_unix():
if unix_hostname and is_valid_hostname(unix_hostname):
hostname = unix_hostname

# if we have an ec2 default hostname, see if there's an instance-id available
if (Platform.is_ecs_instance()) or (hostname is not None and True in [hostname.lower().startswith(p) for p in [u'ip-', u'domu']]):
# if the host is an ECS worker, or has an EC2 hostname, or no hostname but it's a windows machine
# try and find a EC2 instance ID
if (Platform.is_ecs_instance()) or \
(hostname is not None and True in [hostname.lower().startswith(p) for p in [u'ip-', u'domu']]) or \
(hostname is None and os_name == 'windows'):
instanceid = EC2.get_instance_id(config)
if instanceid:
hostname = instanceid
Expand Down

0 comments on commit d9663d4

Please sign in to comment.