def GenerateNAutoscaledGroup()

in templates/autoscaled_group.py [0:0]


def GenerateNAutoscaledGroup(context):
  """Generates N groups of IGM and AUTOSCALER combinations.

  The groups are all the same except the zone in which they run. That is
  determined by the ZoneList property.

  Args:
    context: The DM PythonEvaluationContext

  Returns:
    list of resources to be deployed.
  """
  i_template = context.properties[default.VM_TEMPLATE]
  if not common.IsComputeLink(i_template):
    context.properties[VM_TEMPLATE] = common.GlobalComputeLink(
        context.env[default.PROJECT], 'instanceTemplates', i_template)
  replica_list = context.properties[default.REPLICAS]

  resource_list = []

  for zone_dict in replica_list:
    resource_list.extend(GenerateAutscaledGroup(context, zone_dict))
  return resource_list