def apply(squadron_dir, node_name, tempdir, resources, previous_run,
        dry_run=False):
    log.debug('entering commit.apply %s',
            [squadron_dir, node_name, tempdir, resources, dry_run])
    node_info = get_node_info(os.path.join(squadron_dir, 'nodes'), node_name)

    if not check_node_info(node_info):
        # Return early if there's an error
        log.debug('leaving commit.apply, check_node_info returned error')
        return (False, None)

    log.debug("node_info['env']: " + str(node_info['env']))
    conf_dir = os.path.join(squadron_dir, 'config', node_info['env'])

    result = {}

    # handle the state of the system via the library
    library_dir = os.path.join(squadron_dir, 'libraries')
    state = StateHandler(library_dir)
    for service in node_info['services']:
        # Get config
        configdata = _get_config(conf_dir, service)
        version = configdata['version']
        base_dir = configdata['base_dir']

        get_service_file = functools.partial(_get_service_file, squadron_dir, service, version)

        # defaults file is optional
        cfg = get_service_file('defaults', {})
        cfg.update({'node_name': node_name})
        cfg.update(configdata['config'])

        # validate each schema
        schema = get_service_file('schema', {})
        if schema:
            jsonschema.validate(cfg, schema)

        # Setting the state comes first, since the rest of this might
        # depend on the state of the system (like virtualenv)
        stateinfo = get_service_file('state', {}, config=cfg)
        for state_item in stateinfo:
            library = state_item['name']
            items = state_item['parameters']

            # Should print these out nicely if they're just strings
            if isinstance(items[0], str) or isinstance(items[0], unicode):
                print_items = ', '.join(items)
            else:
                print_items = items

            log.info("%s %s through %s",
                    "Would process" if dry_run else "Processing",
                    print_items,
                    library)
            state.apply(library, items, dry_run)

        service_dir = os.path.join(squadron_dir, 'services',
                                service, version, 'root')
        render = DirectoryRender(service_dir)

        tmp_serv_dir = os.path.join(tempdir, service)
        makedirsp(tmp_serv_dir)
        # Apply templates
        atomic = render.render(tmp_serv_dir, cfg, resources, dry_run)

        # Copy files from previous runs if applicable
        copy_config = get_service_file('copy', [], config=cfg)
        _apply_copy(copy_config, previous_run, service, tmp_serv_dir)

        result[service] = {
                'atomic': atomic,
                'base_dir': base_dir,
                'config': cfg,
                'dir': tmp_serv_dir,
                'version':version,
            }
    log.debug('leaving commit.apply: ' + str(result))
    return result
This method takes input from the given squadron_dir and configures
dataset/ETHPy150Open gosquadron/squadron/squadron/commit.py/apply