def add_instances(self, image_id, count, user_data): new_reservation = Reservation() new_reservation.id = random_reservation_id() for index in range(count): new_instance = Instance( image_id, user_data, ) new_reservation.instances.append(new_instance) self.reservations[new_reservation.id] = new_reservation return new_reservation
def add_instances(self, image_id, count): new_reservation = Reservation() new_reservation.id = random_reservation_id() for index in range(count): new_instance = Instance() new_instance.id = random_instance_id() new_instance.image_id = image_id new_instance._state_name = "pending" new_instance._state_code = 0 new_reservation.instances.append(new_instance) self.reservations[new_reservation.id] = new_reservation return new_reservation
def add_instances(self, image_id, count, user_data, security_group_names): new_reservation = Reservation() new_reservation.id = random_reservation_id() security_groups = [self.get_security_group_from_name(name) for name in security_group_names] for index in range(count): new_instance = Instance( image_id, user_data, security_groups, ) new_reservation.instances.append(new_instance) self.reservations[new_reservation.id] = new_reservation return new_reservation
def add_instances(self, image_id, count, user_data, security_group_names, **kwargs): new_reservation = Reservation() new_reservation.id = random_reservation_id() security_groups = [ self.get_security_group_from_name(name) for name in security_group_names ] security_groups.extend( self.get_security_group_from_id(sg_id) for sg_id in kwargs.pop("security_group_ids", [])) for index in range(count): new_instance = Instance(image_id, user_data, security_groups, **kwargs) new_reservation.instances.append(new_instance) self.reservations[new_reservation.id] = new_reservation return new_reservation
def add_instances(self, image_id, count, user_data, security_group_names, **kwargs): new_reservation = Reservation() new_reservation.id = random_reservation_id() security_groups = [self.get_security_group_from_name(name) for name in security_group_names] security_groups.extend(self.get_security_group_from_id(sg_id) for sg_id in kwargs.pop("security_group_ids", [])) for index in range(count): new_instance = Instance( image_id, user_data, security_groups, **kwargs ) new_reservation.instances.append(new_instance) self.reservations[new_reservation.id] = new_reservation return new_reservation