Saltstack Official Apache Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.1KB

  1. # macros for conf Files
  2. {%- macro output_indented(mytext, indent_value) %}
  3. {{ mytext | indent(indent_value, true) }}
  4. {%- endmacro %}
  5. {%- macro directives_output(container, col, default_keys = []) -%}
  6. {%- for ordered_directive in container.get('directives', []) -%}
  7. {%- for directive, value in ordered_directive.items() if directive not in default_keys| difference(['LogFormat']) -%}
  8. {{ output_indented(directive + ' ' + value|string, col) }}
  9. {%- endfor %}
  10. {%- endfor %}
  11. {%- endmacro %}
  12. {%- macro container_output(container_name, container_data, col=0, default_directives = []) -%}
  13. {%- set header_text = '<' ~ container_name ~ ' ' ~ container_data.item ~ '>' -%}
  14. {{ output_indented(header_text, col) }}
  15. {{ directives_output(container_data, col+4, default_directives ) }}
  16. {%- for nested_container_name, nested_containers in container_data.get('containers', {}).items() %}
  17. {%- for nested_container in nested_containers %}
  18. {{ container_output(nested_container_name, nested_container, col+4) }}
  19. {%- endfor %}
  20. {%- endfor %}
  21. {%- set footer_text = '</' ~ container_name ~ '>' -%}
  22. {{ output_indented(footer_text, col) }}
  23. {%- endmacro %}