<commit_before>---

# This snippet determines if a Docker upgrade is required by checking the inventory
# variables, the available packages, and sets l_docker_version to True if so.

- set_fact:
    docker_upgrade: True
  when: docker_upgrade is not defined

- name: Check if Docker is installed
  command: rpm -q docker
  register: pkg_check
  failed_when: pkg_check.rc > 1
  changed_when: no

- name: Get current version of Docker
  command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker"
  register: curr_docker_version
  changed_when: false

- name: Get latest available version of Docker
  command: >
    {{ repoquery_cmd }} --qf '%{version}' "docker"
  register: avail_docker_version
  failed_when: false
  changed_when: false

- fail:
    msg: This playbook requires access to Docker 1.10 or later
  # Disable the 1.10 requirement if the user set a specific Docker version
  when: avail_docker_version.stdout | version_compare('1.10','<') and docker_version is not defined

# Default l_docker_upgrade to False, we'll set to True if an upgrade is required:
- set_fact:
    l_docker_upgrade: False

# Make sure a docker_verison is set if none was requested:
- set_fact:
    docker_version: "{{ avail_docker_version.stdout }}"
  when: docker_version is not defined

- name: Flag for Docker upgrade if necessary
  set_fact:
    l_docker_upgrade: True<commit_msg>Allow overriding the Docker 1.10 requirement for upgrade.<commit_after>---

# This snippet determines if a Docker upgrade is required by checking the inventory
# variables, the available packages, and sets l_docker_version to True if so.

- set_fact:
    docker_upgrade: True
  when: docker_upgrade is not defined

- name: Check if Docker is installed
  command: rpm -q docker
  register: pkg_check
  failed_when: pkg_check.rc > 1
  changed_when: no

- name: Get current version of Docker
  command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker"
  register: curr_docker_version
  changed_when: false

- name: Get latest available version of Docker
  command: >
    {{ repoquery_cmd }} --qf '%{version}' "docker"
  register: avail_docker_version
  failed_when: false
  changed_when: false

- fail:
    msg: This playbook requires access to Docker 1.10 or later
  # Disable the 1.10 requirement if the user set a specific Docker version
  when: docker_version is not defined and (docker_upgrade is not defined or docker_upgrade | bool == True) and (avail_docker_version.stdout == "" or avail_docker_version.stdout | version_compare('1.10','<'))

# Default l_docker_upgrade to False, we'll set to True if an upgrade is required:
- set_fact:
    l_docker_upgrade: False

# Make sure a docker_verison is set if none was requested:
- set_fact:
    docker_version: "{{ avail_docker_version.stdout }}"
  when: docker_version is not defined

- name: Flag for Docker upgrade if necessary
  set_fact:
    l_docker_upgrade: True
{'fraction_non_alphanumeric': 0.07777013076393668, 'fraction_numerical': 0.007914659325533379, 'mean_word_length': 4.136042402826855, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4741137', 'n_tokens_mistral': 939, 'n_tokens_neox': 842, 'n_words': 335}