def configure(current_node=None):
    """Deploy chef-solo specific files"""
    current_node = current_node or {}
    # Ensure that the /tmp/chef-solo/cache directory exist
    cache_dir = "{0}/cache".format(env.node_work_path)
    # First remote call, could go wrong
    try:
        cache_exists = exists(cache_dir)
    except EOFError as e:
        abort("Could not login to node, got: {0}".format(e))
    if not cache_exists:
        with settings(hide('running', 'stdout'), warn_only=True):
            output = sudo('mkdir -p {0}'.format(cache_dir))
        if output.failed:
            error = "Could not create {0} dir. ".format(env.node_work_path)
            error += "Do you have sudo rights?"
            abort(error)
    # Change ownership of /tmp/chef-solo/ so that we can rsync
    with hide('running', 'stdout'):
        with settings(warn_only=True):
            output = sudo(
                'chown -R {0} {1}'.format(env.user, env.node_work_path))
        if output.failed:
            error = "Could not modify {0} dir. ".format(env.node_work_path)
            error += "Do you have sudo rights?"
            abort(error)
    # Set up chef solo configuration
    logging_path = os.path.dirname(LOGFILE)
    if not exists(logging_path):
        sudo('mkdir -p {0}'.format(logging_path))
    if not exists('/etc/chef'):
        sudo('mkdir -p /etc/chef')
    # Set parameters and upload solo.rb template
    reversed_cookbook_paths = cookbook_paths[:]
    reversed_cookbook_paths.reverse()
    cookbook_paths_list = '[{0}]'.format(', '.join(
        ['"{0}/{1}"'.format(env.node_work_path, x)
            for x in reversed_cookbook_paths]))
    data = {
        'node_work_path': env.node_work_path,
        'cookbook_paths_list': cookbook_paths_list,
        'environment': current_node.get('chef_environment', '_default'),
        'verbose': "true" if env.verbose else "false",
        'http_proxy': env.http_proxy,
        'https_proxy': env.https_proxy
    }
    with settings(hide('everything')):
        try:
            upload_template('solo.rb.j2', '/etc/chef/solo.rb',
                            context=data, use_sudo=True, backup=False,
                            template_dir=BASEDIR, use_jinja=True, mode=0400)
        except __HOLE__:
            error = ("Failed to upload '/etc/chef/solo.rb'\nThis "
                     "can happen when the deployment user does not have a "
                     "home directory, which is needed as a temporary location")
            abort(error)
    with hide('stdout'):
        sudo('chown root:$(id -g -n root) {0}'.format('/etc/chef/solo.rb'))
dataset/ETHPy150Open tobami/littlechef/littlechef/solo.py/configure