<commit_before>"""
Idempotent API for managing nginx sites
"""
from fabric.api import *
from fabtools.files import upload_template, is_link


def server():
    """
    I can haz nginx server
    """
    sudo("/etc/init.d/nginx start")


def site(server_name, options=None, enabled=True):
    """
    I can haz nginx site
    """
    if options is None:
        options = {}
    options['server_name'] = server_name

    upload_template('/etc/nginx/sites-available/%(server_name)s.conf' % locals(),
        'nginx/sites/%(server_name)s.conf' % locals(),
        context=options,
        use_sudo=True)

    if enabled:
        if not is_link('/etc/nginx/sites-enabled/%(server_name)s.conf' % locals()):<commit_msg>Updated nginx 'server' requirement to ensure package is installed and server is running.<commit_after>"""
Idempotent API for managing nginx sites
"""
from fabric.api import *
from fabtools.files import upload_template, is_link
from fabtools.icanhaz.deb import package
from fabtools.icanhaz.service import started


def server():
    """
    I can haz nginx server
    """
    package('nginx')
    started('nginx')


def site(server_name, options=None, enabled=True):
    """
    I can haz nginx site
    """
    if options is None:
        options = {}
    options['server_name'] = server_name

    upload_template('/etc/nginx/sites-available/%(server_name)s.conf' % locals(),
        'nginx/sites/%(server_name)s.conf' % locals(),
        context=options,
        use_sudo=True)

    if enabled:
        if not is_link('/etc/nginx/sites-enabled/%(server_name)s.conf' % locals()):
{'fraction_non_alphanumeric': 0.13245448838669177, 'fraction_numerical': 0.0, 'mean_word_length': 3.2620320855614975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '890697', 'n_tokens_mistral': 519, 'n_tokens_neox': 491, 'n_words': 123}