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

"""
Rackspace provisioner.
"""

from ._libcloud import monkeypatch, LibcloudProvisioner
from ._install import provision, run, task_disable_firewall


def provision_rackspace(node, package_source, distribution):
    """
    Provision flocker on this node.
    """
    commands = (
        task_disable_firewall()
        + provision(
            package_source=package_source,
            distribution=node.distribution,
        )
    )
    run(
        username='root',
        address=node.address,
        commands=commands,
    )
    return node.address

    @property
    def name(self):
        return self._node.name


IMAGE_NAMES = {
    'fedora-20': u'Fedora 20 (Heisenbug) (PVHVM)',
}


def rackspace_provisioner(username, key, region, keyname):
    """
    Create a LibCloudProvisioner for provisioning nodes on rackspace.

    :param bytes username: The user to connect to rackspace with.
    :param bytes key: The API key associated with the user.
    :param bytes region: The rackspace region in which to launch the instance.
    :param bytes keyname: The name of an existing ssh public key configured in<commit_msg>Move firewall step to the end.<commit_after># Copyright Hybrid Logic Ltd.  See LICENSE file for details.

"""
Rackspace provisioner.
"""

from ._libcloud import monkeypatch, LibcloudProvisioner
from ._install import provision, run, task_disable_firewall


def provision_rackspace(node, package_source, distribution):
    """
    Provision flocker on this node.
    """
    commands = (
        provision(
            package_source=package_source,
            distribution=node.distribution,
        ) +
        task_disable_firewall()
    )
    run(
        username='root',
        address=node.address,
        commands=commands,
    )
    return node.address

    @property
    def name(self):
        return self._node.name


IMAGE_NAMES = {
    'fedora-20': u'Fedora 20 (Heisenbug) (PVHVM)',
}


def rackspace_provisioner(username, key, region, keyname):
    """
    Create a LibCloudProvisioner for provisioning nodes on rackspace.

    :param bytes username: The user to connect to rackspace with.
    :param bytes key: The API key associated with the user.
    :param bytes region: The rackspace region in which to launch the instance.
    :param bytes keyname: The name of an existing ssh public key configured in
{'fraction_non_alphanumeric': 0.07945656648826678, 'fraction_numerical': 0.0032935364347468094, 'mean_word_length': 3.00329489291598, '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': '3373992', 'n_tokens_mistral': 703, 'n_tokens_neox': 672, 'n_words': 228}