<commit_before>#!/bin/bash

set -e
set -u
set -o pipefail

PUPPET_AGENT_VERSION=$1

detect_rhel_7 ( ) {

  if grep -E ' 7\.' /etc/redhat-release &> /dev/null; then
    yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
    yum install -y "puppet-agent-${PUPPET_AGENT_VERSION}"
  fi

}

detect_rhel_6 ( ) {

  if grep -E ' 6\.' /etc/redhat-release &> /dev/null; then
    yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm
    yum install -y "puppet-agent-${PUPPET_AGENT_VERSION}"
  fi

}

detect_rhel_5 ( ) {

  if grep -E ' 5\.' /etc/redhat-release &> /dev/null; then
    echo 'nameserver 8.8.8.8' > /etc/resolv.conf
    cd /tmp
    curl -O http://yum.puppetlabs.com/RPM-GPG-KEY-puppet
    rpm --import RPM-GPG-KEY-puppet
    curl -O http://yum.puppetlabs.com/puppetlabs-release-pc1-el-5.noarch.rpm
    yum install -y puppetlabs-release-pc1-el-5.noarch.rpm
    yum install -y "puppet-agent-${PUPPET_AGENT_VERSION}"
  fi

}

detect_ubuntu_1604 ( ) {

  if grep -E 'DISTRIB_RELEASE=16.04' /etc/lsb-release &> /dev/null; then
    cd /tmp
    curl -O http://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
    dpkg -i puppetlabs-release-pc1-xenial.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_ubuntu_1404 ( ) {

  if grep -E 'DISTRIB_RELEASE=14.04' /etc/lsb-release &> /dev/null; then
    cd /tmp
    curl -O http://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb
    dpkg -i puppetlabs-release-pc1-trusty.deb
    rm puppetlabs-release-pc1-trusty.deb
    apt-get update
    # Confirm because the box already comes with a puppet package installed
    apt-get install -y "puppet-agent=${PUPPET_AGENT_VERSION}*"
    apt-get autoremove -y # The box comes with lots of not needed stuff
  fi

}

detect_ubuntu_1204 ( ) {

  if grep -E 'DISTRIB_RELEASE=12.04' /etc/lsb-release &> /dev/null; then
    cd /tmp
    curl -O http://apt.puppetlabs.com/puppetlabs-release-pc1-precise.deb
    dpkg -i puppetlabs-release-pc1-precise.deb
    rm puppetlabs-release-pc1-precise.deb
    apt-get update
    # Confirm because the box already comes with a puppet package installed
    apt-get install -y "puppet-agent=${PUPPET_AGENT_VERSION}*"
    apt-get autoremove -y # The box comes with lots of not needed stuff
  fi

}

detect_debian_6 ( ) {

  if grep -E '^6\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-squeeze.deb
    dpkg -i puppetlabs-release-pc1-squeeze.deb
    rm puppetlabs-release-pc1-squeeze.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_debian_7 ( ) {

  if grep -E '^7\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb
    dpkg -i puppetlabs-release-pc1-wheezy.deb
    rm puppetlabs-release-pc1-wheezy.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_debian_8 ( ) {

  if grep -E '^8\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-jessie.deb
    dpkg -i puppetlabs-release-pc1-jessie.deb
    rm puppetlabs-release-pc1-jessie.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_debian_9 ( ) {

  if grep -E '^9\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-stretch.deb
    dpkg -i puppetlabs-release-pc1-stretch.deb
    rm puppetlabs-release-pc1-stretch.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_sles_12 ( ) {

  if grep -E 'VERSION_ID="12' /etc/os-release &> /dev/null; then
    # Puppet repositories are already configured
    # Do not enable GPG check on Puppet repositories. It will break unattended install
    zypper refresh puppetlabs-pc1
    zypper install --oldpackage --no-recommends --no-confirm "puppet-agent=${PUPPET_AGENT_VERSION}"
  fi

}

detect_sles_11 ( ) {

  if grep -E 'VERSION_ID="11' /etc/os-release &> /dev/null; then
    # Remove old Puppet gems
    gem uninstall --all --executables facter hiera puppet
    zypper install --no-confirm http://yum.puppetlabs.com/puppetlabs-release-pc1-sles-11.noarch.rpm
    # Disable GPG check on Puppet repositories or it will break unattended install
    zypper modifyrepo -G puppetlabs-pc1
    zypper install --oldpackage --no-recommends --no-confirm "puppet-agent=${PUPPET_AGENT_VERSION}"
  fi

}<commit_msg>Fix Ubuntu 12 and SLES 12 mix up<commit_after>#!/bin/bash

set -e
set -u
set -o pipefail

PUPPET_AGENT_VERSION=$1

detect_rhel_7 ( ) {

  if grep -E ' 7\.' /etc/redhat-release &> /dev/null; then
    yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
    yum install -y "puppet-agent-${PUPPET_AGENT_VERSION}"
  fi

}

detect_rhel_6 ( ) {

  if grep -E ' 6\.' /etc/redhat-release &> /dev/null; then
    yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm
    yum install -y "puppet-agent-${PUPPET_AGENT_VERSION}"
  fi

}

detect_rhel_5 ( ) {

  if grep -E ' 5\.' /etc/redhat-release &> /dev/null; then
    echo 'nameserver 8.8.8.8' > /etc/resolv.conf
    cd /tmp
    curl -O http://yum.puppetlabs.com/RPM-GPG-KEY-puppet
    rpm --import RPM-GPG-KEY-puppet
    curl -O http://yum.puppetlabs.com/puppetlabs-release-pc1-el-5.noarch.rpm
    yum install -y puppetlabs-release-pc1-el-5.noarch.rpm
    yum install -y "puppet-agent-${PUPPET_AGENT_VERSION}"
  fi

}

detect_ubuntu_1604 ( ) {

  if grep -E 'DISTRIB_RELEASE=16.04' /etc/lsb-release &> /dev/null; then
    cd /tmp
    curl -O http://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
    dpkg -i puppetlabs-release-pc1-xenial.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_ubuntu_1404 ( ) {

  if grep -E 'DISTRIB_RELEASE=14.04' /etc/lsb-release &> /dev/null; then
    cd /tmp
    curl -O http://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb
    dpkg -i puppetlabs-release-pc1-trusty.deb
    rm puppetlabs-release-pc1-trusty.deb
    apt-get update
    # Confirm because the box already comes with a puppet package installed
    apt-get install -y "puppet-agent=${PUPPET_AGENT_VERSION}*"
    apt-get autoremove -y # The box comes with lots of not needed stuff
  fi

}

detect_ubuntu_1204 ( ) {

  if grep -E 'DISTRIB_RELEASE=12.04' /etc/lsb-release &> /dev/null; then
    cd /tmp
    curl -O http://apt.puppetlabs.com/puppetlabs-release-pc1-precise.deb
    dpkg -i puppetlabs-release-pc1-precise.deb
    rm puppetlabs-release-pc1-precise.deb
    apt-get update
    # Confirm because the box already comes with a puppet package installed
    apt-get install -y "puppet-agent=${PUPPET_AGENT_VERSION}*"
    apt-get autoremove -y # The box comes with lots of not needed stuff
  fi

}

detect_debian_6 ( ) {

  if grep -E '^6\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-squeeze.deb
    dpkg -i puppetlabs-release-pc1-squeeze.deb
    rm puppetlabs-release-pc1-squeeze.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_debian_7 ( ) {

  if grep -E '^7\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb
    dpkg -i puppetlabs-release-pc1-wheezy.deb
    rm puppetlabs-release-pc1-wheezy.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_debian_8 ( ) {

  if grep -E '^8\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-jessie.deb
    dpkg -i puppetlabs-release-pc1-jessie.deb
    rm puppetlabs-release-pc1-jessie.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_debian_9 ( ) {

  if grep -E '^9\.[0-9]' /etc/debian_version &> /dev/null; then
    cd /tmp
    wget http://apt.puppetlabs.com/puppetlabs-release-pc1-stretch.deb
    dpkg -i puppetlabs-release-pc1-stretch.deb
    rm puppetlabs-release-pc1-stretch.deb
    apt-get update
    apt-get install "puppet-agent=${PUPPET_AGENT_VERSION}*"
  fi

}

detect_sles_12 ( ) {

  if grep -E 'VERSION="12-' /etc/os-release &> /dev/null; then
    # Puppet repositories are already configured
    # Do not enable GPG check on Puppet repositories. It will break unattended install
    zypper refresh puppetlabs-pc1
    zypper install --oldpackage --no-recommends --no-confirm "puppet-agent=${PUPPET_AGENT_VERSION}"
  fi

}

detect_sles_11 ( ) {

  if grep -E 'VERSION_ID="11' /etc/os-release &> /dev/null; then
    # Remove old Puppet gems
    gem uninstall --all --executables facter hiera puppet
    zypper install --no-confirm http://yum.puppetlabs.com/puppetlabs-release-pc1-sles-11.noarch.rpm
    # Disable GPG check on Puppet repositories or it will break unattended install
    zypper modifyrepo -G puppetlabs-pc1
    zypper install --oldpackage --no-recommends --no-confirm "puppet-agent=${PUPPET_AGENT_VERSION}"
  fi

}
{'fraction_non_alphanumeric': 0.13059579566496024, 'fraction_numerical': 0.020477072214355733, 'mean_word_length': 2.9628830384117393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1429538', 'n_tokens_mistral': 3995, 'n_tokens_neox': 3701, 'n_words': 741}