def delete_instances(self, config): for instance_cfg in config['servers']: instances = utils.get_instances_names_from_conf(instance_cfg) self.delete_instance(instance_cfg["name"]) for i in instances: self.delete_instance(i)
def rebuild_instances(self, config): instances = [] for instance_cfg in config['servers']: instances += utils.get_instances_names_from_conf(instance_cfg) for i in instances: self.rebuild_instance(i) if not utils.check_availability(session=self, instances=instances): raise RuntimeError("Not all nodes available")
def create_instances(self, config, check=True): # Waiting for DNS records update instances = [] for instance_cfg in config['servers']: instances += utils.get_instances_names_from_conf(instance_cfg) for i in instances: try: while socket.gethostbyname(i): print '.', time.sleep(3) except socket.gaierror: print('\nA-record for {0} was deleted'.format(i)) for instance_cfg in config['servers']: self.create_instance(data=instance_cfg) instances = [] for instance_cfg in config['servers']: instances += utils.get_instances_names_from_conf(instance_cfg) if check: if not utils.check_availability(session=self, instances=instances): raise RuntimeError("Not all nodes available")