Saltstack Official Syslog-NG Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

28 行
644B

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=jinja
  3. {%- macro rule_builder(rule) -%}
  4. {%- if rule is none -%}
  5. {%- elif rule is sameas true -%}
  6. yes
  7. {%- elif rule is sameas false -%}
  8. no
  9. {%- elif rule is number -%}
  10. {{ rule }}
  11. {%- elif rule is mapping -%}
  12. {%- for k, v in rule.items() -%}
  13. {{ k }}({{ rule_builder(v) }})
  14. {%- endfor -%}
  15. {%- elif rule is iterable and rule is not string -%}
  16. {%- for v in rule -%}
  17. {{ rule_builder(v) }}
  18. {%- endfor -%}
  19. {%- else -%}
  20. {%- if rule[0] == '=' -%}
  21. {{ rule[1:] }}
  22. {%- else -%}
  23. "{{ rule }}"
  24. {%- endif -%}
  25. {%- endif -%}
  26. {%- endmacro -%}