<commit_before>from fabric.api import *
from fabric.contrib import files

conf_external_interface = """# The external network interface
auto eth1
iface eth1 inet manual
up ip link set dev $IFACE up
down ip link set dev $IFACE down"""

class PrepareHost(object):
    """Prepare OpenStack physical hosts"""

    def __init__(self, user, hosts):
        self.user = user
        self.hosts = hosts
        env.user = self.user
        env.hosts = self.hosts

    def setup_external_interface(self):
        with cd('/etc/network'):
            files.append('interfaces', conf_external_interface, use_sudo=True)
        sudo('ifdown eth1', warn_only=True)
        sudo('ifup eth1', warn_only=True)
        # TODO: purge old eth1 configuration

    def setup_ntp(self):
        sudo('echo \'Asia/Shanghai\' > /etc/timezone')
        sudo('cat /usr/share/zoneinfo/Asia/Shanghai | tee /etc/localtime')
        sudo('apt-get install chrony -y')
        # TODO: setup ntp server and ntp client, current all are clients

    def set_openstack_repository(self):
        sudo('apt-get update')
        sudo('apt-get install software-properties-common -y')
        sudo('add-apt-repository cloud-archive:liberty -y')
        with prefix('sudo apt-get update'):
            sudo('DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade')
        sudo('apt-get install python-openstackclient -y')<commit_msg>Update docstring<commit_after>from fabric.api import *
from fabric.contrib import files

conf_external_interface = """# The external network interface
auto eth1
iface eth1 inet manual
up ip link set dev $IFACE up
down ip link set dev $IFACE down"""

class PrepareHost(object):
    """Prepare OpenStack physical hosts"""

    def __init__(self, user, hosts):
        self.user = user
        self.hosts = hosts
        env.user = self.user
        env.hosts = self.hosts

    def setup_external_interface(self):
        """host networking"""
        with cd('/etc/network'):
            files.append('interfaces', conf_external_interface, use_sudo=True)
        sudo('ifdown eth1', warn_only=True)
        sudo('ifup eth1', warn_only=True)
        # TODO: purge old eth1 configuration

    def setup_ntp(self):
        """network time protocal (ntp)"""
        sudo('echo \'Asia/Shanghai\' > /etc/timezone')
        sudo('cat /usr/share/zoneinfo/Asia/Shanghai | tee /etc/localtime')
        sudo('apt-get install chrony -y')
        # TODO: setup ntp server and ntp client, current all are clients

    def set_openstack_repository(self):
        """openstack packages"""
        sudo('apt-get update')
        sudo('apt-get install software-properties-common -y')
        sudo('add-apt-repository cloud-archive:liberty -y')
        with prefix('sudo apt-get update'):
            sudo('DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade')
        sudo('apt-get install python-openstackclient -y')
{'fraction_non_alphanumeric': 0.11934552454282965, 'fraction_numerical': 0.003208213025344883, 'mean_word_length': 2.7163289630512515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2939380', 'n_tokens_mistral': 989, 'n_tokens_neox': 903, 'n_words': 246}