def lp_drop(self, pf, target): """ drop module of linchpin cli : still need to fix the linchpin_config and outputs, inventory_outputs paths""" pf = parse_yaml(pf) init_dir = os.getcwd() e_vars = {} e_vars['linchpin_config'] = self.get_config_path() e_vars['outputfolder_path'] = init_dir+"/outputs" e_vars['inventory_outputs_path'] = init_dir + "/inventories" e_vars['state'] = "absent" if target == "all": for key in set(pf.keys()).difference(self.excludes): e_vars['topology'] = self.find_topology(pf[key]["topology"], pf) output = invoke_linchpin(self.base_path, e_vars, "TEARDOWN", console=True) else: print(pf[target]) if pf.get(target, False): topology_path = self.find_topology(pf[target]["topology"], pf) e_vars['topology'] = topology_path if e_vars['topology'] is None: print("Topology not found !!") output = invoke_linchpin(self.base_path, e_vars, "TEARDOWN", console=True)
def lp_rise(self, pf, target): pf = parse_yaml(pf) init_dir = os.getcwd() e_vars = {} e_vars['linchpin_config'] = self.get_config_path() e_vars['outputfolder_path'] = init_dir+"/outputs" e_vars['inventory_outputs_path'] = init_dir+"/inventories" e_vars['state'] = "present" if target == "all": for key in set(pf.keys()).difference(self.excludes): e_vars['topology'] = self.find_topology(pf[key]["topology"], pf) if e_vars['topology'] is None: print("Topology not found !!") break if pf[key].has_key('layout'): layout_path = self.find_layout(pf[key]["layout"], pf) e_vars['inventory_layout_file'] = layout_path if e_vars['inventory_layout_file'] is None: print("Layout not found !!") break print(e_vars) output = invoke_linchpin(self.base_path, e_vars, "PROVISION", console=True) else: if pf.get(target, False): topology_path = self.find_topology(pf[target]["topology"], pf) e_vars['topology'] = topology_path if e_vars['topology'] is None: print("Topology not found !!") if pf[key].has_key('layout'): layout_path = self.find_layout(pf[target]["layout"], pf) e_vars['inventory_layout_file'] = layout_path if e_vars['inventory_layout_file'] is None: print("Layout not found !!") print(e_vars) output = invoke_linchpin(self.base_path, e_vars, "PROVISION", console=True) else: raise KeyError('Target not found in PinFile')
def lp_drop(self, lpf, target): """ drop module of linchpin cli : still need to fix the linchpin_config and outputs, inventory_outputs paths""" lpf = parse_yaml(lpf) init_dir = os.getcwd() e_vars = {} e_vars['linchpin_config'] = self.get_config_path() e_vars['inventory_outputs_path'] = init_dir + "/inventory" e_vars['state'] = "absent" if target == "all": for key in set(lpf.keys()).difference(self.excludes): e_vars['topology'] = self.find_topology(lpf[key]["topology"], lpf) topo_name = lpf[key]["topology"].strip(".yml").strip(".yaml") output_path = init_dir + "/outputs/" + topo_name + ".output" e_vars['topology_output_file'] = output_path output = invoke_linchpin(self.base_path, e_vars, "TEARDOWN", console=True) else: print(lpf[target]) if lpf.get(target, False): topology_path = self.find_topology(lpf[target]["topology"], lpf) e_vars['topology'] = topology_path if e_vars['topology'] is None: print("Topology not found !!") topo_name = lpf[target]["topology"] topo_name = topo_name.strip(".yml").strip(".yaml") output_path = init_dir + "/outputs/" + topo_name + ".output" e_vars['topology_output_file'] = output_path output = invoke_linchpin(self.base_path, e_vars, "TEARDOWN", console=True)