mirror of
https://github.com/saltstack-formulas/sudoers-formula.git
synced 2026-07-15 22:59:25 +02:00
test(map): verify map.jinja dump using _mapdata state
* Semi-automated using https://github.com/myii/ssf-formula/pull/245
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# yamllint disable rule:indentation rule:line-length
|
||||
# {{ grains.get('osfinger', grains.os) }}
|
||||
---
|
||||
{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #}
|
||||
{{ salt['slsutil.serialize'](
|
||||
'yaml',
|
||||
map,
|
||||
default_flow_style=False,
|
||||
allow_unicode=True,
|
||||
)
|
||||
| regex_replace("^\s+'$", "'", multiline=True)
|
||||
| trim
|
||||
}}
|
||||
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
---
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import sudoers with context %}
|
||||
|
||||
{%- set map = {
|
||||
'sudoers': sudoers,
|
||||
} %}
|
||||
{%- do salt['log.debug']('### MAP.JINJA DUMP ###\n' ~ map | yaml(False)) %}
|
||||
|
||||
{%- set output_file = '/tmp/salt_mapdata_dump.yaml' %}
|
||||
|
||||
{{ tplroot }}-mapdata-dump:
|
||||
file.managed:
|
||||
- name: {{ output_file }}
|
||||
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja
|
||||
- template: jinja
|
||||
- context:
|
||||
map: {{ map | yaml }}
|
||||
Reference in New Issue
Block a user