Skip to content
Snippets Groups Projects
Select Git revision
  • 2aa1a180194d49b79590aee1605e0628db61ad16
  • main default protected
  • v0.1-beta1
3 results

local_hshexport.php

Blame
  • macro.jinja 1.02 KiB
    {# https://github.com/saltstack/salt/issues/28606#issuecomment-211537586 #}
    {%- macro deep_merge(a, b) %}
    {%-     for k,v in b.items() %}
    {%-         if v is string or v is number %}
    {%-             do a.update({ k: v }) %}
    {%-         elif v is not mapping %}
    {%-             if a[k] is not defined %}
    {%-                 do a.update({ k: v }) %}
    {%-             elif a[k] is iterable and a[k] is not mapping and a[k] is not string %}
    {%-                 do a.update({ k: v|list + a[k]|list}) %}
    {%-             else %}
    {%-                 do a.update({ k: v }) %}
    {%-             endif %}
    {%-         elif v is mapping %}
    {%-             if a[k] is not defined %}
    {%-                 do a.update({ k: v }) %}
    {%-             elif a[k] is not mapping %}
    {%-                 do a.update({ k: v }) %}
    {%-             else %}
    {%-                 do deep_merge(a[k], v) %}
    {%-             endif %}
    {%-         else %}
    {%-            do a.update({ k: 'ERROR: case not contempled in merging!' }) %}
    {%-         endif %}
    {%-     endfor %}
    {%- endmacro %}