<commit_before>#!/bin/bash
# -*- coding: utf-8 -*-

# This file is part of Cockpit.
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Cockpit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.

unset command_not_found_handle

# TODO: Currently we have only one set of base packages, but we should
# allow different sets for different OSes.
#
HS_BASE_PCKGS="virt-deploy pystache sshpass telnet fabric python-pip avocado virt-manager qemu-img"

export HS_GRP="virtualization"
HS_CON="-c qemu:///system"
export HS_POOLNAME="cockpitx"
export HS_POOLNAME_PATH=/home/$HS_POOLNAME

function echolog(){
    echo "`date -u '+%Y%m%d-%H:%M:%S'` HOST: $@"
}

function host_dependencies_fedora(){
    sudo yum -y yum-plugin-copr
    sudo yum -y copr enable fsimonce/virt-deploy
    sudo yum -y copr enable lmr/Autotest
    sudo yum -y install $HS_BASE_PCKGS
}

function host_dependencies_rhel7(){
    sudo yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    curl https://copr.fedoraproject.org/coprs/fsimonce/virt-deploy/repo/epel-7/fsimonce-virt-deploy-epel-7.repo > virt-deploy.repo
    curl https://copr.fedoraproject.org/coprs/lmr/Autotest/repo/epel-7/lmr-Autotest-epel-7.repo > avocado.repo
    sudo /bin/cp virt-deploy.repo avocado.repo /etc/yum.repos.d/
    sudo yum -y install $HS_BASE_PCKGS
}
function definepools(){
    local HS_PNAME=$1
    local HS_IPEXTENSION=123
    sudo mkdir -p $HS_POOLNAME_PATH
    sudo virsh $HS_CON pool-define /dev/stdin <<EOF
<pool type='dir'>
  <name>$HS_PNAME</name>
  <target>
    <path>$HS_POOLNAME_PATH</path><commit_msg>test-avocado: Add missing "install" command to host setup script<commit_after>#!/bin/bash
# -*- coding: utf-8 -*-

# This file is part of Cockpit.
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Cockpit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.

unset command_not_found_handle

# TODO: Currently we have only one set of base packages, but we should
# allow different sets for different OSes.
#
HS_BASE_PCKGS="virt-deploy pystache sshpass telnet fabric python-pip avocado virt-manager qemu-img"

export HS_GRP="virtualization"
HS_CON="-c qemu:///system"
export HS_POOLNAME="cockpitx"
export HS_POOLNAME_PATH=/home/$HS_POOLNAME

function echolog(){
    echo "`date -u '+%Y%m%d-%H:%M:%S'` HOST: $@"
}

function host_dependencies_fedora(){
    sudo yum -y install yum-plugin-copr
    sudo yum -y copr enable fsimonce/virt-deploy
    sudo yum -y copr enable lmr/Autotest
    sudo yum -y install $HS_BASE_PCKGS
}

function host_dependencies_rhel7(){
    sudo yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    curl https://copr.fedoraproject.org/coprs/fsimonce/virt-deploy/repo/epel-7/fsimonce-virt-deploy-epel-7.repo > virt-deploy.repo
    curl https://copr.fedoraproject.org/coprs/lmr/Autotest/repo/epel-7/lmr-Autotest-epel-7.repo > avocado.repo
    sudo /bin/cp virt-deploy.repo avocado.repo /etc/yum.repos.d/
    sudo yum -y install $HS_BASE_PCKGS
}
function definepools(){
    local HS_PNAME=$1
    local HS_IPEXTENSION=123
    sudo mkdir -p $HS_POOLNAME_PATH
    sudo virsh $HS_CON pool-define /dev/stdin <<EOF
<pool type='dir'>
  <name>$HS_PNAME</name>
  <target>
    <path>$HS_POOLNAME_PATH</path>
{'fraction_non_alphanumeric': 0.10794807560920064, 'fraction_numerical': 0.010475973582327488, 'mean_word_length': 3.985244040862656, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, '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': '7224626', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1498, 'n_words': 460}