def get_inventory(self, topo, layout, config): if len(topo['duffy_res']) == 0: return "" host_data = self.get_host_data(topo, config) inven_hosts = self.get_host_ips(host_data) # adding sections to respective host groups host_groups = self.get_layout_host_groups(layout) self.add_sections(host_groups) # set children for each host group self.set_children(layout) # set vars for each host group self.set_vars(layout) # add ip addresses to each host self.add_ips_to_groups(inven_hosts, layout) self.add_common_vars(host_groups, layout) output = StringIO() self.config.write(output) return output.getvalue()
def get_inventory(self, topo, layout, config): host_data = [] inven_hosts = [] for res in topo: hd = self.get_host_data(res, config) if hd: host_data.append(hd) inven_hosts.extend(self.get_host_ips(hd)) # adding sections to respective host groups host_groups = self.get_layout_host_groups(layout) self.add_sections(host_groups) # set children for each host group self.set_children(layout) # set vars for each host group self.set_vars(layout) # add ip addresses to each host self.add_ips_to_groups(inven_hosts, layout) self.add_common_vars(host_groups, layout) output = StringIO() self.config.write(output) return output.getvalue()
def generate_inventory(self): output = StringIO() self.config.write(output) return output.getvalue()
def parse(row): reader = csv.reader(StringIO(row)) row = reader.next() return Crime(*row)