<commit_before>#!/usr/bin/env bash
#################################################
#
# <NAME> <<EMAIL>>
# Copyright(c) 2015
###############################################

SOURCE="${BASH_SOURCE[0]}"
RDIR="$( dirname "$SOURCE" )"
ANSIBLE_VERSION=${1:-latest}
OS_VERSION=`cat /etc/*release | grep -oE '[0-9]+\.[0-9]+'|cut -d "." -f1 |head -n 1`

apt-get update
apt-get install python-pip python-dev -y
if [ "${OS_VERSION}" == "12" ];then
    apt-get install python-setuptools -y
fi

set -e


if [ "$ANSIBLE_VERSION" = "latest" ]; then
    pip install --upgrade ansible;
else
    pip install --upgrade ansible==$ANSIBLE_VERSION;
fi

cd $RDIR/..

printf "[defaults]\nroles_path = ../" > ansible.cfg
ansible-playbook -i tests/test-inventory tests/test.yml --syntax-check
ANSIBLE_SHORT_VERSION=`ansible-playbook --version 2> /dev/null|cut -d " " -f2|cut -d "." -f1,2` ansible-playbook -i tests/test-inventory tests/test.yml --connection=local --sudo

# Run the role/playbook again, checking to make sure it's idempotent.
ANSIBLE_SHORT_VERSION=`ansible-playbook --version 2> /dev/null|cut -d " " -f2|cut -d "." -f1,2` ansible-playbook -i tests/test-inventory tests/test.yml --connection=local --sudo | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)


exit 0
<commit_msg>try to fix the issue on ubuntu 12.04: ImportError: No module named setuptools<commit_after>#!/usr/bin/env bash
#################################################
#
# <NAME> <<EMAIL>>
# Copyright(c) 2015
###############################################

SOURCE="${BASH_SOURCE[0]}"
RDIR="$( dirname "$SOURCE" )"
ANSIBLE_VERSION=${1:-latest}
OS_VERSION=`cat /etc/*release | grep -oE '[0-9]+\.[0-9]+'|cut -d "." -f1 |head -n 1`

apt-get update
apt-get install python-pip python-dev -y
if [ "${OS_VERSION}" == "12" ];then
    apt-get install python-setuptools -y
    apt-get install ansible -y
    apt-get remove ansible -y
fi

set -e


if [ "$ANSIBLE_VERSION" = "latest" ]; then
    pip install --upgrade ansible;
else
    pip install --upgrade ansible==$ANSIBLE_VERSION;
fi

cd $RDIR/..

printf "[defaults]\nroles_path = ../" > ansible.cfg
ansible-playbook -i tests/test-inventory tests/test.yml --syntax-check
ANSIBLE_SHORT_VERSION=`ansible-playbook --version 2> /dev/null|cut -d " " -f2|cut -d "." -f1,2` ansible-playbook -i tests/test-inventory tests/test.yml --connection=local --sudo

# Run the role/playbook again, checking to make sure it's idempotent.
ANSIBLE_SHORT_VERSION=`ansible-playbook --version 2> /dev/null|cut -d " " -f2|cut -d "." -f1,2` ansible-playbook -i tests/test-inventory tests/test.yml --connection=local --sudo | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)


exit 0

{'fraction_non_alphanumeric': 0.23367820192650732, 'fraction_numerical': 0.020692115590438816, 'mean_word_length': 4.116788321167883, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '6096555', 'n_tokens_mistral': 1075, 'n_tokens_neox': 967, 'n_words': 256}