Skip to content

Commit

Permalink
fix(config.sls): fix salt-lint errors
Browse files Browse the repository at this point in the history
```bash
Examining bind/config.sls of type state
[204] Lines should be no longer that 160 chars
bind/config.sls:217
{%-       do generate_reverse(zone_records, salt['pillar.get']('bind:available_zones:' + zone + ':generate_reverse:net'), salt['pillar.get']('bind:available_zones:' + zone + ':generate_reverse:for_zones'), salt['pillar.get']('bind:available_zones', {})) %}

[206] Jinja variables should have spaces before and after: {{ var_name }}
bind/config.sls:225
zones{{ dash_view }}-{{ zone }}{{ '.include' if serial_auto else ''}}:

[206] Jinja variables should have spaces before and after: {{ var_name }}
bind/config.sls:227
    - name: {{ zones_directory }}/{{ file }}{{ '.include' if serial_auto else ''}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
bind/config.sls:295
    - unless: "grep {{ key_flags.zsk }} {{ key_directory }}/K{{zone}}.+{{ key_algorithm_field }}+*.key"

[206] Jinja variables should have spaces before and after: {{ var_name }}
bind/config.sls:304
    - unless: "grep {{ key_flags.ksk }} {{ key_directory }}/K{{zone}}.+{{ key_algorithm_field }}+*.key"
```
  • Loading branch information
myii committed Oct 9, 2019
1 parent 7a356e3 commit 920615a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bind/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,22 @@ bind_rndc_client_config:
{%- endif %}
{%- set zone_records = salt['pillar.get']('bind:available_zones:' + zone + ':records', {}) %}
{%- if salt['pillar.get']('bind:available_zones:' + zone + ':generate_reverse') %}
{%- do generate_reverse(zone_records, salt['pillar.get']('bind:available_zones:' + zone + ':generate_reverse:net'), salt['pillar.get']('bind:available_zones:' + zone + ':generate_reverse:for_zones'), salt['pillar.get']('bind:available_zones', {})) %}
{%- do generate_reverse(
zone_records,
salt['pillar.get']('bind:available_zones:' + zone + ':generate_reverse:net'),
salt['pillar.get']('bind:available_zones:' + zone + ':generate_reverse:for_zones'),
salt['pillar.get']('bind:available_zones', {})
) %}
{%- endif %}
{# If we define RRs in pillar, we use the internal template to generate the zone file
otherwise, we fallback to the old behaviour and use the declared file
#}
{%- set zone_source = 'salt://bind/files/zone.jinja' if zone_records != {} else 'salt://' ~ map.zones_source_dir ~ '/' ~ file %}
{%- set serial_auto = salt['pillar.get']('bind:available_zones:' + zone + ':soa:serial', '') == 'auto' %}
{% if file and zone_data['type'] == 'master' -%}
zones{{ dash_view }}-{{ zone }}{{ '.include' if serial_auto else ''}}:
zones{{ dash_view }}-{{ zone }}{{ '.include' if serial_auto else '' }}:
file.managed:
- name: {{ zones_directory }}/{{ file }}{{ '.include' if serial_auto else ''}}
- name: {{ zones_directory }}/{{ file }}{{ '.include' if serial_auto else '' }}
- source: {{ zone_source }}
- template: jinja
{% if zone_records != {} %}
Expand Down Expand Up @@ -292,7 +297,7 @@ zsk-{{ zone }}:
- cwd: {{ key_directory }}
- name: dnssec-keygen -a {{ key_algorithm }} -b {{ key_size }} -n ZONE {{ zone }}
- runas: {{ map.user }}
- unless: "grep {{ key_flags.zsk }} {{ key_directory }}/K{{zone}}.+{{ key_algorithm_field }}+*.key"
- unless: "grep {{ key_flags.zsk }} {{ key_directory }}/K{{ zone }}.+{{ key_algorithm_field }}+*.key"
- require:
- file: bind_key_directory
Expand All @@ -301,7 +306,7 @@ ksk-{{ zone }}:
- cwd: {{ key_directory }}
- name: dnssec-keygen -f KSK -a {{ key_algorithm }} -b {{ key_size }} -n ZONE {{ zone }}
- runas: {{ map.user }}
- unless: "grep {{ key_flags.ksk }} {{ key_directory }}/K{{zone}}.+{{ key_algorithm_field }}+*.key"
- unless: "grep {{ key_flags.ksk }} {{ key_directory }}/K{{ zone }}.+{{ key_algorithm_field }}+*.key"
- require:
- file: bind_key_directory
{% endif %}
Expand Down

0 comments on commit 920615a

Please sign in to comment.