<commit_before>{% set enabled_roles = roles|rejectattr('disable_upgrade_deployment')|list -%}
{% set batch_upgrade_steps_max = 3 -%}
{% set upgrade_steps_max = 6 -%}
{% set deliver_script = {'deliver': False} -%}
heat_template_version: ocata
description: 'Upgrade steps for all roles'

parameters:
  servers:
    type: json

  role_data:
    type: json
    description: Mapping of Role name e.g Controller to the per-role data

  UpdateIdentifier:
    type: string
    description: >
      Setting to a previously unused value during stack-update will trigger
      the Upgrade resources to re-run on all roles.
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  KeystoneRegion:
    type: string
    default: 'regionOne'
    description: Keystone region for endpoint
  NovaPassword:
    description: The password for the nova service and db account, used by nova-api.
    type: string
    hidden: true

conditions:
  # Conditions to disable any steps where the task list is empty
  {%- for role in roles %}
  {{role.name}}UpgradeBatchConfigEnabled:
    not:
      equals:
        - {get_param: [role_data, {{role.name}}, upgrade_batch_tasks]}
        - []
  {{role.name}}UpgradeConfigEnabled:
    not:
      equals:
        - {get_param: [role_data, {{role.name}}, upgrade_tasks]}
        - []
  {%- endfor %}

resources:

{% for role in roles if role.disable_upgrade_deployment|default(false) %}
  {{role.name}}DeliverUpgradeScriptConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config:
        list_join:
        - ''
        - - "#!/bin/bash\n\n"
          - "set -eu\n\n"
          - "if hiera -c /etc/puppet/hiera.yaml service_names | grep nova_compute ; then\n\n"
          - "  crudini --set /etc/nova/nova.conf placement auth_type password\<PASSWORD>"
          - "  crudini --set /etc/nova/nova.conf placement username placement\n\n"
          - "  crudini --set /etc/nova/nova.conf placement project_domain_name Default\n\n"
          - "  crudini --set /etc/nova/nova.conf placement user_domain_name Default\n\n"
          - "  crudini --set /etc/nova/nova.conf placement project_name service\n\n"
          - "  crudini --set /etc/nova/nova.conf placement os_interface internal\n\n"
          - str_replace:
              template: |
                crudini --set /etc/nova/nova.conf placement password '<PASSWORD>'
                crudini --set /etc/nova/nova.conf placement os_region_name 'REGION_NAME'
                crudini --set /etc/nova/nova.conf placement auth_url 'AUTH_URL'
              params:
                SERVICE_PASSWORD: { get_param: <PASSWORD> }
                REGION_NAME: { get_param: KeystoneRegion }
                AUTH_URL: { get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
          - "  systemctl restart openstack-nova-compute\n\n"
          - "fi\n\n"
          - str_replace:
              template: |
                ROLE='ROLE_NAME'
              params:
                ROLE_NAME: {{role.name}}
          - get_file: ../extraconfig/tasks/pacemaker_common_functions.sh<commit_msg>Remove nova placement config for compute service node on upgrade<commit_after>{% set enabled_roles = roles|rejectattr('disable_upgrade_deployment')|list -%}
{% set batch_upgrade_steps_max = 3 -%}
{% set upgrade_steps_max = 6 -%}
{% set deliver_script = {'deliver': False} -%}
heat_template_version: ocata
description: 'Upgrade steps for all roles'

parameters:
  servers:
    type: json

  role_data:
    type: json
    description: Mapping of Role name e.g Controller to the per-role data

  UpdateIdentifier:
    type: string
    description: >
      Setting to a previously unused value during stack-update will trigger
      the Upgrade resources to re-run on all roles.
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  KeystoneRegion:
    type: string
    default: 'regionOne'
    description: Keystone region for endpoint
  NovaPassword:
    description: The password for the nova service and db account, used by nova-api.
    type: string
    hidden: true

conditions:
  # Conditions to disable any steps where the task list is empty
  {%- for role in roles %}
  {{role.name}}UpgradeBatchConfigEnabled:
    not:
      equals:
        - {get_param: [role_data, {{role.name}}, upgrade_batch_tasks]}
        - []
  {{role.name}}UpgradeConfigEnabled:
    not:
      equals:
        - {get_param: [role_data, {{role.name}}, upgrade_tasks]}
        - []
  {%- endfor %}

resources:

{% for role in roles if role.disable_upgrade_deployment|default(false) %}
  {{role.name}}DeliverUpgradeScriptConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config:
        list_join:
        - ''
        - - "#!/bin/bash\n\n"
          - "set -eu\n\n"
          - str_replace:
              template: |
                ROLE='ROLE_NAME'
              params:
                ROLE_NAME: {{role.name}}
          - get_file: ../extraconfig/tasks/pacemaker_common_functions.sh
{'fraction_non_alphanumeric': 0.10502195913691044, 'fraction_numerical': 0.0007637960664502578, 'mean_word_length': 2.4325032765399737, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, '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': '2212698', 'n_tokens_mistral': 1633, 'n_tokens_neox': 1566, 'n_words': 418}