<commit_before>---
###############################################################################
# Evaluate host groups and gather facts
###############################################################################
- name: Load openshift_facts and update repos
  hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config:oo_lb_to_config
  roles:
  - openshift_facts
  - openshift_repos

- name: Evaluate additional groups for upgrade
  hosts: localhost
  connection: local
  become: no
  tasks:
  - name: Evaluate etcd_hosts_to_backup
    add_host:
      name: "{{ item }}"
      groups: etcd_hosts_to_backup
    with_items: groups.oo_etcd_to_config if groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config | length > 0 else groups.oo_first_master

###############################################################################
# Pre-upgrade checks
###############################################################################
- name: Verify upgrade can proceed on first master
  hosts: oo_first_master
  vars:
    target_version: "{{ '1.2' if deployment_type == 'origin' else '3.2' }}"
    g_pacemaker_upgrade_url_segment: "{{ 'org/latest' if deployment_type =='origin' else '.com/enterprise/3.1' }}"
  gather_facts: no
  tasks:
  - fail:
      msg: >
        This upgrade is only supported for atomic-enterprise, origin, openshift-enterprise, and online
        deployment types
    when: deployment_type not in ['atomic-enterprise', 'origin','openshift-enterprise', 'online']

  - fail:
      msg: >
        This upgrade does not support Pacemaker:
        https://docs.openshift.{{ g_pacemaker_upgrade_url_segment }}/install_config/upgrading/pacemaker_to_native_ha.html
    when: openshift.master.cluster_method is defined and openshift.master.cluster_method == 'pacemaker'

  # Error out in situations where the user has older versions specified in their
  # inventory in any of the openshift_release, openshift_image_tag, and
  # openshift_pkg_version variables. These must be removed or updated to proceed
  # with upgrade.
  # TODO: Should we block if you're *over* the next major release version as well?
  - fail:
      msg: >
        openshift_pkg_version is {{ openshift_pkg_version }} which is not a
        valid version for a {{ target_version }} upgrade
    when: openshift_pkg_version is defined and openshift_pkg_version.split('-',1).1 | version_compare(target_version ,'<')

  - fail:
      msg: >
        openshift_image_tag is {{ openshift_image_tag }} which is not a
        valid version for a {{ target_version }} upgrade
    when: openshift_image_tag is defined and openshift_image_tag.split('v',1).1 | version_compare(target_version ,'<')

  - fail:
      msg: >
        openshift_release is {{ openshift_release }} which is not a
        valid release for a {{ target_version }} upgrade
    when: openshift_release is defined and not openshift_release | version_compare(target_version ,'=')

- include: ../../../../common/openshift-cluster/initialize_openshift_version.yml
  vars:
    # Request openshift_release 3.2 and let the openshift_version role handle converting this
    # to a more specific version, respecting openshift_image_tag and openshift_pkg_version if
    # defined, and overriding the normal behavior of protecting the installed version
    openshift_release: "3.2"
    openshift_protect_installed_version: False

- name: Verify master processes
  hosts: oo_masters_to_config
  roles:
  - openshift_facts
  tasks:
  - openshift_facts:
      role: master
      local_facts:
        ha: "{{ groups.oo_masters_to_config | length > 1 }}"<commit_msg>Fix use of v3.2 format for openshift_release in upgrade.<commit_after>---
###############################################################################
# Evaluate host groups and gather facts
###############################################################################
- name: Load openshift_facts and update repos
  hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config:oo_lb_to_config
  roles:
  - openshift_facts
  - openshift_repos

- name: Evaluate additional groups for upgrade
  hosts: localhost
  connection: local
  become: no
  tasks:
  - name: Evaluate etcd_hosts_to_backup
    add_host:
      name: "{{ item }}"
      groups: etcd_hosts_to_backup
    with_items: groups.oo_etcd_to_config if groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config | length > 0 else groups.oo_first_master

###############################################################################
# Pre-upgrade checks
###############################################################################
- name: Verify upgrade can proceed on first master
  hosts: oo_first_master
  vars:
    target_version: "{{ '1.2' if deployment_type == 'origin' else '3.2' }}"
    g_pacemaker_upgrade_url_segment: "{{ 'org/latest' if deployment_type =='origin' else '.com/enterprise/3.1' }}"
  gather_facts: no
  tasks:
  - fail:
      msg: >
        This upgrade is only supported for atomic-enterprise, origin, openshift-enterprise, and online
        deployment types
    when: deployment_type not in ['atomic-enterprise', 'origin','openshift-enterprise', 'online']

  - fail:
      msg: >
        This upgrade does not support Pacemaker:
        https://docs.openshift.{{ g_pacemaker_upgrade_url_segment }}/install_config/upgrading/pacemaker_to_native_ha.html
    when: openshift.master.cluster_method is defined and openshift.master.cluster_method == 'pacemaker'

  # Error out in situations where the user has older versions specified in their
  # inventory in any of the openshift_release, openshift_image_tag, and
  # openshift_pkg_version variables. These must be removed or updated to proceed
  # with upgrade.
  # TODO: Should we block if you're *over* the next major release version as well?
  - fail:
      msg: >
        openshift_pkg_version is {{ openshift_pkg_version }} which is not a
        valid version for a {{ target_version }} upgrade
    when: openshift_pkg_version is defined and openshift_pkg_version.split('-',1).1 | version_compare(target_version ,'<')

  - fail:
      msg: >
        openshift_image_tag is {{ openshift_image_tag }} which is not a
        valid version for a {{ target_version }} upgrade
    when: openshift_image_tag is defined and openshift_image_tag.split('v',1).1 | version_compare(target_version ,'<')

  - set_fact:
      openshift_release: "{{ openshift_release[1:] }}"
    when: openshift_release is defined and openshift_release[0] == 'v'

  - fail:
      msg: >
        openshift_release is {{ openshift_release }} which is not a
        valid release for a {{ target_version }} upgrade
    when: openshift_release is defined and not openshift_release | version_compare(target_version ,'=')

- include: ../../../../common/openshift-cluster/initialize_openshift_version.yml
  vars:
    # Request openshift_release 3.2 and let the openshift_version role handle converting this
    # to a more specific version, respecting openshift_image_tag and openshift_pkg_version if
    # defined, and overriding the normal behavior of protecting the installed version
    openshift_release: "3.2"
    openshift_protect_installed_version: False

- name: Verify master processes
  hosts: oo_masters_to_config
  roles:
  - openshift_facts
  tasks:
  - openshift_facts:
      role: master
      local_facts:
        ha: "{{ groups.oo_masters_to_config | length > 1 }}"
{'fraction_non_alphanumeric': 0.16253034799028865, 'fraction_numerical': 0.0048556784461828975, 'mean_word_length': 4.210822206605762, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '1693276', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2077, 'n_words': 600}