<commit_before># Copyright Hybrid Logic Ltd.  See LICENSE file for details.

"""
AWS provisioner.
"""

from ._libcloud import LibcloudProvisioner
from ._install import (
    provision, run,
    task_install_ssh_key,
    task_upgrade_kernel,
    task_upgrade_selinux,
)


def provision_aws(node, package_source, distribution, variants):
    """
    Provision flocker on this node.
    """
    run(
        username='fedora',
        address=node.address,
        commands=task_install_ssh_key(),
    )
    run(
        username='root',
        address=node.address,
        commands=task_upgrade_kernel(),
    )

    node.reboot()

    run(
        username='root',
        address=node.address,
        commands=task_upgrade_selinux(),
    )

    run(
        username='root',
        address=node.address,
        commands=provision(
            package_source=package_source,
            distribution=node.distribution,
            variants=variants,
        )
    )
    return node.address


IMAGE_NAMES = {
    'fedora-20': 'Fedora-x86_64-20-20140407-sda',
}

<commit_msg>Handle DISTRO_TESTING for AWS better.<commit_after># Copyright Hybrid Logic Ltd.  See LICENSE file for details.

"""
AWS provisioner.
"""

from ._libcloud import LibcloudProvisioner
from ._common import Variants
from ._install import (
    provision, run,
    task_install_ssh_key,
    task_upgrade_kernel,
    task_upgrade_selinux,
    task_enable_updates_testing
)


def provision_aws(node, package_source, distribution, variants):
    """
    Provision flocker on this node.
    """
    run(
        username='fedora',
        address=node.address,
        commands=task_install_ssh_key(),
    )

    if Variants.DISTRO_TESTING in variants:
        # FIXME: We shouldn't need to duplicate this here.
        run(
            username='root',
            address=node.address,
            commands=task_enable_updates_testing(distribution)
        )

    run(
        username='root',
        address=node.address,
        commands=task_upgrade_kernel(),
    )

    node.reboot()

    run(
        username='root',
        address=node.address,
        commands=provision(
            package_source=package_source,
            distribution=node.distribution,
            variants=variants,
        ) + task_upgrade_selinux(),
    )
    return node.address


IMAGE_NAMES = {
    'fedora-20': 'Fedora-x86_64-20-20140407-sda',
}


{'fraction_non_alphanumeric': 0.0968412302576891, 'fraction_numerical': 0.013300083125519535, 'mean_word_length': 2.468299711815562, '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': '7216182', 'n_tokens_mistral': 777, 'n_tokens_neox': 718, 'n_words': 140}