Permalink
Browse files

lookup public hostname first, then private

  • Loading branch information...
1 parent ba6a2ba commit b74bc4f9b60a83435698b35ebaa4f7561a3d4d92 @pdmars pdmars committed Oct 26, 2011
Showing with 8 additions and 8 deletions.
  1. +8 −8 epu/decisionengine/impls/torque_ondemand.py
@@ -216,10 +216,10 @@ def decide(self, control, state):
log.debug("Attempting final cleanup.")
bad_instances = state.get_instances_by_state(InstanceStates.FAILED)
for instance in bad_instances:
- if instance.private_hostname:
- host = instance.private_hostname
- elif instance.public_hostname:
+ if instance.public_hostname:
host = instance.public_hostname
+ elif instance.private_hostname:
+ host = instance.private_hostname
else:
host = instance.public_ip
if host in self.workers:
@@ -270,9 +270,9 @@ def _get_num_workers_status(self, worker_status, status):
def _get_instance_from_ip(self, state, host):
found = []
for instance in state.instances.itervalues():
- if instance.private_hostname == host:
+ if instance.public_hostname == host:
found.append(instance)
- elif instance.public_hostname == host:
+ elif instance.private_hostname == host:
found.append(instance)
elif instance.public_ip == host:
found.append(instance)
@@ -289,10 +289,10 @@ def _get_instance_from_ip(self, state, host):
def _get_new_running_workers(self, state):
new_running_workers = []
for instance in state.get_instances_by_state(InstanceStates.RUNNING):
- if instance.private_hostname:
- host = instance.private_hostname
- elif instance.public_hostname:
+ if instance.public_hostname:
host = instance.public_hostname
+ elif instance.private_hostname:
+ host = instance.private_hostname
else:
host = instance.public_ip
if not host:

0 comments on commit b74bc4f

Please sign in to comment.