{% import_yaml "influxdb/defaults.yaml" as version_map %}

{# Get default settings for version #}
{% set defaults = version_map.get('0_9') %}

{##
Setup variable using grains['os_family'] based logic, only add key:values here
that differ from whats in defaults.yaml
##}

{% set os_family_map = salt['grains.filter_by']({
   'Debian': {},
   'RedHat': {},
  },
  grain="os_family",
  merge=salt['pillar.get']('influxdb:lookup'))
%}

{## Merge the os_family_map into default settings ##}
{% do defaults.influxdb.update(os_family_map) %}

{# Get legacy pillar data for backwards compatibility #}
{% for p_entry in ['bind-address'] %}
{% do defaults.influxdb.conf.update(
    {
        p_entry: salt['pillar.get'](
            'influxdb:{}'.format(p_entry),
            defaults.influxdb.conf.get(p_entry)
        )
    }
) %}
{% endfor %}

{% for p_section in ['admin', 'api', 'raft', 'protobuf'] %}
{% set conf_section = defaults.influxdb.conf.get('p_section', {}) %}
{% do conf_section.update(
    salt['pillar.get'](
        'influxdb:{}'.format(p_section),
        {}
    )
) %}
{% endfor %}

{# Update settings defaults from pillar data #}
{% set influxdb_settings = salt['pillar.get'](
    'influxdb',
    default=defaults.influxdb,
    merge=True)
%}

# vi: set ft=sls :

{% import_yaml "influxdb/defaults.yaml" as version_map %}

{# Get default settings for version #}
{% set defaults = version_map.get('0_9') %}

{##
Setup variable using grains['os_family'] based logic, only add key:values here
that differ from whats in defaults.yaml
##}

{% set os_family_map = salt['grains.filter_by']({
   'Debian': {},
   'RedHat': {},
  },
  grain="os_family",
  merge=salt['pillar.get']('influxdb:lookup'))
%}

{## Merge the os_family_map into default settings ##}
{% do defaults.influxdb.update(os_family_map) %}

{# Update settings defaults from pillar data #}
{% set influxdb_settings = salt['pillar.get'](
    'influxdb',
    default=defaults.influxdb,
    merge=True)
%}

# vi: set ft=sls :

Drop support for legacy pillar structure
Drop support for legacy pillar structure

This commit drops support for the legacy pillar structure that was
maintained for old deployments of this formula. Some of these settings
are also no longer supported by InfluxDB itself.
