def generate_inventory(self, resource_data, layout, inv_format="cfg", topology_data={}, config_data={}): inv = GenericInventory.GenericInventory(inv_format=inv_format, role_path=self.role_path) inventory = inv.get_inventory(resource_data, layout, topology_data, config_data) return inventory
def setup_generic_inventory_filter(): global filter global res_output cd = ContextData() cd.load_config_data() config_path = cd.get_temp_filename() config_data = cd.cfg_data cd.write_config_file(config_path) lpc = LinchpinContext() lpc.load_config(search_path=[config_path]) lpc.load_global_evars() lpc.setup_logging() lpa = LinchpinAPI(lpc) filter = GenericInventory.GenericInventory(role_path=lpa.role_path) provider = 'general-inventory' base_path = '{0}'.format(os.path.dirname( os.path.realpath(__file__))).rstrip('/') lib_path = os.path.realpath(os.path.join(base_path, os.pardir)) mock_path = '{0}/{1}/{2}'.format(lib_path, 'mockdata', provider) res_output = 'linchpin.benchmark' res_file = open(mock_path + '/' + res_output) res_output = json.load(res_file)['17']['targets'][0]['general-inventory'][ 'outputs']['resources'] res_file.close()
def generate_inventory(self, resource_data, layout, inv_format="cfg", topology_data={}): inv = GenericInventory.GenericInventory(inv_format=inv_format) inventory = inv.get_inventory(resource_data, layout, topology_data) return inventory
def setup_inventory_filter(): global filter global inv filter = GenericInventory.GenericInventory() subdir = 'layouts' base_path = '{0}'.format(os.path.dirname( os.path.realpath(__file__))).rstrip('/') lib_path = os.path.realpath(os.path.join(base_path, os.pardir)) mock_path = '{0}/{1}/{2}'.format(lib_path, 'mockdata', subdir) template = 'parsed-layout.json' template_file = open(mock_path+'/'+template) inv = json.load(template_file)
def setup_inventory_filter(): global filter global inv filter = GenericInventory.GenericInventory() subdir = 'layouts' base_path = '{0}'.format(os.path.dirname( os.path.realpath(__file__))).rstrip('/') lib_path = os.path.realpath(os.path.join(base_path, os.pardir)) mock_path = '{0}/{1}/{2}'.format(lib_path, 'mockdata', subdir) template = 'parsed-layout.json' template_file = open(mock_path+'/'+template) # object hook can be removed once python 2 is no longer supported inv = json.load(template_file, object_hook=_byteify)
def setup_generic_inventory_filter(): global filter global res_output filter = GenericInventory.GenericInventory() provider = 'general-inventory' base_path = '{0}'.format(os.path.dirname( os.path.realpath(__file__))).rstrip('/') lib_path = os.path.realpath(os.path.join(base_path, os.pardir)) mock_path = '{0}/{1}/{2}'.format(lib_path, 'mockdata', provider) res_output = 'linchpin.benchmark' res_file = open(mock_path+'/'+res_output) res_output = json.load(res_file)['17']['targets'][0]['general-inventory']['outputs']['resources'] res_file.close()
def setup_generic_inventory_filter(): global filter global res_output filter = GenericInventory.GenericInventory() provider = 'general' base_path = '{0}'.format(os.path.dirname( os.path.realpath(__file__))).rstrip('/') lib_path = os.path.realpath(os.path.join(base_path, os.pardir)) mock_path = '{0}/{1}/{2}'.format(lib_path, 'mockdata', provider) res_output = 'topo.json' res_file = open(mock_path + '/' + res_output) res_output = json.load(res_file) res_file.close()