def predeploy(self): default_info = env_util.get_node_default_facts(self.env) deployment_info = [] network_data = self.env.get_network_data() gw_admin = transformations.get_network_gw(network_data, "fuelweb_admin") if self.isolated: facts = [info for info in default_info if info['uid'] == str(self.node.id)] env_util.write_facts_to_dir(facts, self.node.data['cluster']) for info in default_info: if not ('primary-controller' in info['roles'] or info['uid'] == str(self.node.id)): continue if self.isolated: transformations.remove_ports(info) if info['uid'] == str(self.node.id): endpoints = info["network_scheme"]["endpoints"] self.gateway = endpoints["br-ex"]["gateway"] transformations.reset_gw_admin(info, gw_admin) # From run_ping_checker info['run_ping_checker'] = False env_util.prepare_net_info(info) deployment_info.append(info) if deployment_info: self.env.upload_facts('deployment', deployment_info)
def update_deployment_info(env, isolated): default_info = env.get_default_facts('deployment') network_data = env.get_network_data() gw_admin = transformations.get_network_gw(network_data, "fuelweb_admin") if isolated: # From backup_deployment_info backup_path = os.path.join( magic_consts.FUEL_CACHE, "deployment_{0}.orig".format(env.id), ) if not os.path.exists(backup_path): os.makedirs(backup_path) # Roughly taken from Environment.write_facts_to_dir for info in default_info: fname = os.path.join( backup_path, "{0}_{1}.yaml".format(info['role'], info['uid']), ) with open(fname, 'w') as f: yaml.safe_dump(info, f, default_flow_style=False) deployment_info = [] for info in default_info: if isolated: transformations.remove_ports(info) transformations.reset_gw_admin(info, gw_admin) # From run_ping_checker info['run_ping_checker'] = False transformations.remove_predefined_nets(info) deployment_info.append(info) env.upload_facts('deployment', deployment_info) tasks = env.get_deployment_tasks() tasks_helpers.skip_tasks(tasks) env.update_deployment_tasks(tasks)
def predeploy(self): default_info = self.env.get_default_facts('deployment') deployment_info = env_util.get_deployment_info(self.env) network_data = self.env.get_network_data() gw_admin = transformations.get_network_gw(network_data, "fuelweb_admin") if self.isolated: # From backup_deployment_info backup_path = os.path.join( magic_consts.FUEL_CACHE, "deployment_{0}.orig".format(self.node.data['cluster']), ) if not os.path.exists(backup_path): os.makedirs(backup_path) # Roughly taken from Environment.write_facts_to_dir for info in default_info: if not info['uid'] == str(self.node.id): continue fname = os.path.join( backup_path, "{0}_{1}.yaml".format(info['role'], info['uid']), ) with open(fname, 'w') as f: yaml.safe_dump(info, f, default_flow_style=False) for info in default_info: if not (info['role'] == 'primary-controller' or info['uid'] == str(self.node.id)): continue if self.isolated: transformations.remove_ports(info) if info['uid'] == str(self.node.id): endpoints = info["network_scheme"]["endpoints"] self.gateway = endpoints["br-ex"]["gateway"] transformations.reset_gw_admin(info, gw_admin) # From run_ping_checker info['run_ping_checker'] = False transformations.remove_predefined_nets(info) deployment_info.append(info) self.env.upload_facts('deployment', deployment_info) tasks = self.env.get_deployment_tasks() tasks_helpers.skip_tasks(tasks) self.env.update_deployment_tasks(tasks)