Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
Created September 14, 2011 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorenmacbeth/1217029 to your computer and use it in GitHub Desktop.
Save sorenmacbeth/1217029 to your computer and use it in GitHub Desktop.
def _launch_cluster_instances(self, instance_templates):
singleton_hosts = []
for instance_template in instance_templates:
instance_template.add_env_strings(singleton_hosts)
instances = self._launch_instances(instance_template)
if instance_template.number == 1:
if len(instances) != 1:
logger.error("Expected a single '%s' instance, but found %s.",
"".join(instance_template.roles), len(instances))
return
else:
for role in instance_template.roles:
singleton_host_env = "%s_HOST=%s" % \
(self._sanitize_role_name(role),
instances[0].public_ip)
singleton_hosts.append(singleton_host_env)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment