def place(self, block=True): if get_domain() == None: print('SDB Persistence Domain not set') domain_name = self.get_string('Specify SDB Domain') set_domain(domain_name) s = ServerSet() for item in self.items: r = item.ami.run(min_count=1, max_count=item.quantity, key_name=item.key.name, user_data=item.get_userdata_string(), security_groups=item.groups, instance_type=item.instance_type, placement=item.zone.name) if block: states = [i.state for i in r.instances] if states.count('running') != len(states): print(states) time.sleep(15) states = [i.update() for i in r.instances] for i in r.instances: server = Server() server.name = item.name server.instance_id = i.id server.reservation = r server.save() s.append(server) if len(s) == 1: return s[0] else: return s
def place(self, block=True): if get_domain() == None: print 'SDB Persistence Domain not set' domain_name = self.get_string('Specify SDB Domain') set_domain(domain_name) s = ServerSet() for item in self.items: r = item.ami.run(min_count=1, max_count=item.quantity, key_name=item.key.name, user_data=item.get_userdata_string(), security_groups=item.groups, instance_type=item.instance_type, placement=item.zone.name) if block: states = [i.state for i in r.instances] if states.count('running') != len(states): print states time.sleep(15) states = [i.update() for i in r.instances] for i in r.instances: server = Server() server.name = item.name server.instance_id = i.id server.reservation = r server.save() s.append(server) if len(s) == 1: return s[0] else: return s