Saltstack Official PHP Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

macro.jinja 898B

123456789101112131415161718192021222324252627
  1. # Returns a generic block of values suitable for inclusion in most states.
  2. {% macro sls_block(dict, ind=4) %}
  3. {% for key, value in dict.items() %}
  4. {{ '-'|indent(ind, True) }} {{ key }}: {{ value|json() }}
  5. {% endfor %}
  6. {% endmacro %}
  7. # Serializes dicts into sequenced data
  8. {%- macro serialize(data) -%}
  9. {%- if data is mapping -%}
  10. {%- set ret = [] -%}
  11. {%- for key, value in data.items() -%}
  12. {%- set value = serialize(value)|load_json() -%}
  13. {%- do ret.append({key: value}) -%}
  14. {%- endfor -%}
  15. {%- elif data is iterable and data is not string -%}
  16. {%- set ret = [] -%}
  17. {%- for value in data -%}
  18. {%- set value = serialize(value)|load_json() -%}
  19. {%- do ret.append(value) -%}
  20. {%- endfor -%}
  21. {%- else -%}
  22. {% set ret = data %}
  23. {%- endif -%}
  24. {{ ret|json() }}
  25. {%- endmacro -%}