mirror of
https://github.com/saltstack-formulas/sudoers-formula.git
synced 2026-07-15 18:40:03 +02:00
refactor(map): use top-level values: key in map.jinja dumps
* Semi-automated using https://github.com/myii/ssf-formula/pull/284
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# {{ grains.get('osfinger', grains.os) }}
|
||||
# {{ grains.get("osfinger", grains.os) }}
|
||||
---
|
||||
{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #}
|
||||
{{ salt['slsutil.serialize'](
|
||||
'yaml',
|
||||
{{ salt["slsutil.serialize"](
|
||||
"yaml",
|
||||
map,
|
||||
default_flow_style=False,
|
||||
allow_unicode=True,
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
# vim: ft=sls
|
||||
---
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import sudoers as mapdata with context %}
|
||||
{%- set tplroot = tpldir.split("/")[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import sudoers with context %}
|
||||
|
||||
{%- do salt['log.debug']('### MAP.JINJA DUMP ###\n' ~ mapdata | yaml(False)) %}
|
||||
{%- set _mapdata = {
|
||||
"values": {
|
||||
"sudoers": sudoers,
|
||||
}
|
||||
} %}
|
||||
{%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %}
|
||||
|
||||
{%- set output_dir = '/temp' if grains.os_family == 'Windows' else '/tmp' %}
|
||||
{%- set output_file = output_dir ~ '/salt_mapdata_dump.yaml' %}
|
||||
{%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %}
|
||||
{%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %}
|
||||
|
||||
{{ tplroot }}-mapdata-dump:
|
||||
file.managed:
|
||||
@@ -16,4 +21,4 @@
|
||||
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja
|
||||
- template: jinja
|
||||
- context:
|
||||
map: {{ mapdata | yaml }}
|
||||
map: {{ _mapdata | yaml }}
|
||||
|
||||
Reference in New Issue
Block a user