Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
def setup_load_config():
    """
    Perform setup of ContextData() object, and run get_temp_filename()
    """

    global cd
    global provider
    global config_path
    global config_data

    provider = 'dummy'

    cd = ContextData()
    cd.load_config_data()
    cd.create_config()
    config_path = cd.get_temp_filename()
    config_data = cd.cfg_data
    cd.write_config_file(config_path)
Ejemplo n.º 3
0
def setup_context_data():
    """
    Perform setup of ContextData() object, and run get_temp_filename()
    """

    global config_path
    global config_data
    global evars_data
    global logfile

    cd = ContextData()
    cd.load_config_data()
    cd.create_config()
    evars_data = cd.evars
    config_path = cd.get_temp_filename()
    config_data = cd.cfg_data

    logfile = cd.logfile
    cd.write_config_file(config_path)
Ejemplo n.º 4
0
def setup_load_config():

    """
    Perform setup of ContextData() object, and run get_temp_filename()
    """

    global cd
    global provider
    global config_path
    global config_data

    provider = 'dummy'

    cd = ContextData()
    cd.load_config_data()
    cd.create_config()
    config_path = cd.get_temp_filename()
    config_data = cd.cfg_data
    cd.write_config_file(config_path)
Ejemplo n.º 5
0
def setup_context_data():

    """
    Perform setup of ContextData() object, and run get_temp_filename()
    """

    global config_path
    global config_data
    global evars_data
    global logfile

    cd = ContextData()
    cd.load_config_data()
    cd.create_config()
    evars_data = cd.evars
    config_path = cd.get_temp_filename()
    config_data = cd.cfg_data

    logfile = cd.logfile
    cd.write_config_file(config_path)