Skip to content

Commit

Permalink
fix(macros): use openvpn/macros.jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
alxwr committed Jul 13, 2019
1 parent 2fff1ee commit 637387e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion openvpn/config.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "openvpn/map.jinja" import map with context %}
{% from "openvpn/map.jinja" import multipart_param with context %}
{% from "openvpn/macros.jinja" import multipart_param with context %}
include:
- openvpn
Expand Down
2 changes: 1 addition & 1 deletion openvpn/files/common_opts.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "openvpn/map.jinja" import multipart_param with context %}
{% from "openvpn/macros.jinja" import multipart_param with context %}

{%- if config.daemon is defined and config.daemon == True %}
daemon
Expand Down
13 changes: 13 additions & 0 deletions openvpn/macros.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{%- macro multipart_param(value, index=None) %}
{%- if value is string %}
{%- set value = value.split() %}
{%- endif %}
{%- if not index is none -%}
{{ value[index] }}
{%- else -%}
{%- for item in value -%}
{%- if not loop.first %} {% endif -%}
{{ item }}
{%- endfor %}
{%- endif %}
{%- endmacro -%}
14 changes: 0 additions & 14 deletions openvpn/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,3 @@
),
base='openvpn')
%}

{%- macro multipart_param(value, index=None) %}
{%- if value is string %}
{%- set value = value.split() %}
{%- endif %}
{%- if not index is none -%}
{{ value[index] }}
{%- else -%}
{%- for item in value -%}
{%- if not loop.first %} {% endif -%}
{{ item }}
{%- endfor %}
{%- endif %}
{%- endmacro -%}
2 changes: 1 addition & 1 deletion openvpn/network_manager_networks/files/connection.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- from "openvpn/map.jinja" import multipart_param with context -%}
{%- from "openvpn/macros.jinja" import multipart_param with context -%}
{%- set config = salt['pillar.get']('openvpn:network_manager:networks:'+network_name, {}) -%}
{%- macro pairs(data) -%}
{%- for key, value in data|dictsort -%}
Expand Down

0 comments on commit 637387e

Please sign in to comment.