<commit_before># keepalived configuration
#
# **** DO NOT EDIT THIS FILE ****
#
# This file is managed by Salt.
# Any changes will be overwritten.
{{ '\n' }}

{% import 'config.jinja' as config %}
{{ config.keepalived_config(keepalived_final_values) }}

{#
Macro Explanation:

This is a recursive macro that takes the type of entry and determines how 
it is suppose to appear in the configuration file.  Strings and numbers 
are just written out.  Lists and hashes are placed inside if couple of 
parenthesis.  It also takes into account the special groupings like 
vrrp_instance and virtual_server.  Any additional data from a list or a 
hash is then processed by calling the macro again.

Forced carriage returns and use of jinja's indent are only there to make 
the final file more human readable.  They serve no other function.  
#}
{#
{%- import_yaml 'keepalived/defaults.yaml' as keepalived_defaults -%}
{%- set keepalived_final_values = salt.pillar.get(
    'keepalived',
    default=keepalived_defaults,
    merge=True) -%}

{%- set groupings = ['vrrp_script', 'vrrp_sync_group', 'vrrp_instance', 
    'virtual_server_group', 'virtual_server', 'real_server'] -%}
{%- macro config_entries(data, indents, carryover='') -%}
  {%- if data is string or data is number -%}
    {{- data|string|indent(indents, True) }}{{ '\n' -}}
  {%- elif data is none -%}
    {{- '\n' -}}
  {%- else -%}
    {%- if indents != 0 and not carryover -%}
      {{- " {\n" -}}
    {%- endif -%}
    {%- if data is mapping -%}
      {%- for entry in data|dictsort -%}
        {%- if entry[0] in groupings -%}
          {{- config_entries(entry[1], indents, carryover=entry[0]) -}}
        {%- else -%}
          {%- if carryover -%}
            {{- carryover|indent(indents, True) }}{{ '  ' }}
          {%- endif -%}
            {{- entry[0]|indent(indents, True) }}
            {{- config_entries(entry[1], indents + 2) -}}
        {%- endif -%}
      {%- endfor -%}
    {%- else -%}
      {%- for entry in data -%}
        {{- config_entries(entry, indents) -}}
      {%- endfor -%}
    {%- endif -%}
    {%- if indents != 0 and not carryover -%}
      {{- '}'|indent(indents - 2, True) }}{{ '\n' }}
    {%- endif -%}
  {%- endif -%}
{%- endmacro -%}

{{ config_entries(keepalived_final_values, 0) }}
#}
<commit_msg>Correcting the import.<commit_after># keepalived configuration
#
# **** DO NOT EDIT THIS FILE ****
#
# This file is managed by Salt.
# Any changes will be overwritten.
{{ '\n' }}

{% import 'keepalived/templates/config.jinja' as config %}
{{ config.keepalived_config(keepalived_final_values) }}

{#
Macro Explanation:

This is a recursive macro that takes the type of entry and determines how 
it is suppose to appear in the configuration file.  Strings and numbers 
are just written out.  Lists and hashes are placed inside if couple of 
parenthesis.  It also takes into account the special groupings like 
vrrp_instance and virtual_server.  Any additional data from a list or a 
hash is then processed by calling the macro again.

Forced carriage returns and use of jinja's indent are only there to make 
the final file more human readable.  They serve no other function.  
#}
{#
{%- import_yaml 'keepalived/defaults.yaml' as keepalived_defaults -%}
{%- set keepalived_final_values = salt.pillar.get(
    'keepalived',
    default=keepalived_defaults,
    merge=True) -%}

{%- set groupings = ['vrrp_script', 'vrrp_sync_group', 'vrrp_instance', 
    'virtual_server_group', 'virtual_server', 'real_server'] -%}
{%- macro config_entries(data, indents, carryover='') -%}
  {%- if data is string or data is number -%}
    {{- data|string|indent(indents, True) }}{{ '\n' -}}
  {%- elif data is none -%}
    {{- '\n' -}}
  {%- else -%}
    {%- if indents != 0 and not carryover -%}
      {{- " {\n" -}}
    {%- endif -%}
    {%- if data is mapping -%}
      {%- for entry in data|dictsort -%}
        {%- if entry[0] in groupings -%}
          {{- config_entries(entry[1], indents, carryover=entry[0]) -}}
        {%- else -%}
          {%- if carryover -%}
            {{- carryover|indent(indents, True) }}{{ '  ' }}
          {%- endif -%}
            {{- entry[0]|indent(indents, True) }}
            {{- config_entries(entry[1], indents + 2) -}}
        {%- endif -%}
      {%- endfor -%}
    {%- else -%}
      {%- for entry in data -%}
        {{- config_entries(entry, indents) -}}
      {%- endfor -%}
    {%- endif -%}
    {%- if indents != 0 and not carryover -%}
      {{- '}'|indent(indents - 2, True) }}{{ '\n' }}
    {%- endif -%}
  {%- endif -%}
{%- endmacro -%}

{{ config_entries(keepalived_final_values, 0) }}
#}

{'fraction_non_alphanumeric': 0.16573033707865167, 'fraction_numerical': 0.00432152117545376, 'mean_word_length': 2.7210610932475885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2349116', 'n_tokens_mistral': 1661, 'n_tokens_neox': 1557, 'n_words': 440}