<commit_before>---
# We need sudo for some of the Docker commands.
sudo: required

env:
  # Provide a list of OSes we want to use for testing.
  - distro: centos7
    init: /usr/lib/systemd/systemd
    run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"

# Tell Travis to start Docker when it brings up an environment.
services:
  - docker

before_install:
  # Pull container from Docker Hub.
  - 'docker pull geerlingguy/docker-${distro}-ansible:latest'

script:
  # Start the container from the image and perform tests.
  
  # Create a random file to store the container ID.
  - container_id=$(mktemp)

  # Run container detached, with our role mounted inside.
  - 'docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-role-papertrail:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'

  # Check the role/playbook's syntax.
  - >
    docker exec --tty "$(cat ${container_id})" env TERM=xterm
    ansible-playbook /etc/ansible/roles/ansible-role-papertrail/tests/test.yml
    --syntax-check

  # Run the role/playbook with ansible-playbook.
  - >
    docker exec --tty "$(cat ${container_id})" env TERM=xterm
    ansible-playbook /etc/ansible/roles/ansible-role-papertrail/tests/test.yml

  # Run the role/playbook again, checking to make sure it's idempotent.
  - idempotence=$(mktemp)
  - >
    docker exec "$(cat ${container_id})"
    ansible-playbook /etc/ansible/roles/ansible-role-papertrail/tests/test.yml
    | tee -a ${idempotence}
  - >
    tail ${idempotence}
    | grep -q 'changed=0.*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)

  # Ensure remote_syslog is installed.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm which remote_syslog'

  # Ensure remote_syslog is installed.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm stat /etc/log_files.yml'

  # Ensure rsyslog.service is running.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm systemctl -l status rsyslog'

  # Ensure remote_syslog.service is running.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm systemctl -l status remote_syslog'


notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/
<commit_msg>Debugging remote_syslog service issues 001<commit_after>---
# We need sudo for some of the Docker commands.
sudo: required

env:
  # Provide a list of OSes we want to use for testing.
  - distro: centos7
    init: /usr/lib/systemd/systemd
    run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"

# Tell Travis to start Docker when it brings up an environment.
services:
  - docker

before_install:
  # Pull container from Docker Hub.
  - 'docker pull geerlingguy/docker-${distro}-ansible:latest'

script:
  # Start the container from the image and perform tests.
  
  # Create a random file to store the container ID.
  - container_id=$(mktemp)

  # Run container detached, with our role mounted inside.
  - 'docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-role-papertrail:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'

  # Check the role/playbook's syntax.
  - >
    docker exec --tty "$(cat ${container_id})" env TERM=xterm
    ansible-playbook /etc/ansible/roles/ansible-role-papertrail/tests/test.yml
    --syntax-check

  # Run the role/playbook with ansible-playbook.
  - >
    docker exec --tty "$(cat ${container_id})" env TERM=xterm
    ansible-playbook /etc/ansible/roles/ansible-role-papertrail/tests/test.yml

  # Run the role/playbook again, checking to make sure it's idempotent.
  - idempotence=$(mktemp)
  - >
    docker exec "$(cat ${container_id})"
    ansible-playbook /etc/ansible/roles/ansible-role-papertrail/tests/test.yml
    | tee -a ${idempotence}
  - >
    tail ${idempotence}
    | grep -q 'changed=0.*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)

  # Ensure remote_syslog is installed.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm which remote_syslog'

  # Ensure remote_syslog is installed.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm stat /etc/log_files.yml'

  # Ensure rsyslog.service is running.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm systemctl -l status rsyslog'

  # Ensure remote_syslog.service is running.
  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm systemctl -l status remote_syslog'

  - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm cat /var/log/messages'

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/

{'fraction_non_alphanumeric': 0.13647008728975943, 'fraction_numerical': 0.003193527783691718, 'mean_word_length': 3.5303760848601735, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '591460', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1589, 'n_words': 439}