<commit_before>{# Definition of services in the rc-apps and production-apps environments #}
{% set ENVIRONMENT = salt.grains.get('environment') %}
{% set env_settings = salt.cp.get_url("https://raw.githubusercontent.com/mitodl/salt-ops/main/salt/environment_settings.yml", dest=None)|load_yaml %}
{% set env_data = env_settings.environments[ENVIRONMENT] %}
{% set datacenter = "apps-ci" %}
{% if ENVIRONMENT == "rc-apps" %}
{% set datacenter = "apps-qa" %}
{% endif %}
{% if ENVIRONMENT = "production-apps"}
{% set datacenter = "apps-production" %}
{% endif %}
{% set lan_nodes = ["provider=aws tag_key=consul_env tag_value=" ~ datacenter] %}
{% for host, addr in salt.saltutil.runner(
    'mine.get',
    tgt='consul-' ~ ENVIRONMENT ~ '-*',
    fun='grains.item',
    tgt_type='glob').items() %}
{% do lan_nodes.append('{0}'.format(addr['ec2:local_ipv4'])) %}
{% endfor %}

consul:
  extra_configs:
    defaults:
      recursors:
        - {{ env_settings.environments[ENVIRONMENT].network_prefix }}.0.2
        - 8.8.8.8
      datacenter: {{ datacenter }}
      retry_join: {{ lan_nodes|tojson }}<commit_msg>Fix Jinja conditional block for Consul apps pillar<commit_after>{# Definition of services in the rc-apps and production-apps environments #}
{% set ENVIRONMENT = salt.grains.get('environment') %}
{% set env_settings = salt.cp.get_url("https://raw.githubusercontent.com/mitodl/salt-ops/main/salt/environment_settings.yml", dest=None)|load_yaml %}
{% set env_data = env_settings.environments[ENVIRONMENT] %}
{% set datacenter = "apps-ci" %}
{% if ENVIRONMENT == "rc-apps" %}
{% set datacenter = "apps-qa" %}
{% endif %}
{% if ENVIRONMENT == "production-apps" %}
{% set datacenter = "apps-production" %}
{% endif %}
{% set lan_nodes = ["provider=aws tag_key=consul_env tag_value=" ~ datacenter] %}
{% for host, addr in salt.saltutil.runner(
    'mine.get',
    tgt='consul-' ~ ENVIRONMENT ~ '-*',
    fun='grains.item',
    tgt_type='glob').items() %}
{% do lan_nodes.append('{0}'.format(addr['ec2:local_ipv4'])) %}
{% endfor %}

consul:
  extra_configs:
    defaults:
      recursors:
        - {{ env_settings.environments[ENVIRONMENT].network_prefix }}.0.2
        - 8.8.8.8
      datacenter: {{ datacenter }}
      retry_join: {{ lan_nodes|tojson }}
{'fraction_non_alphanumeric': 0.18053097345132743, 'fraction_numerical': 0.007964601769911504, 'mean_word_length': 4.221709006928407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2935194', 'n_tokens_mistral': 864, 'n_tokens_neox': 794, 'n_words': 141}