From 3c9efc713d8cddf2fe9609594b0ac0b17a8a6ea9 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:04:43 +0200 Subject: [PATCH] feat(repo): add repo pattern so we can set distro repo during tests --- php/macro.jinja | 8 ++++++++ php/repo/init.sls | 5 +++++ php/repo/install.sls | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 php/repo/init.sls create mode 100644 php/repo/install.sls diff --git a/php/macro.jinja b/php/macro.jinja index b5c76c3..f5e2269 100644 --- a/php/macro.jinja +++ b/php/macro.jinja @@ -33,3 +33,11 @@ - file: {{ state }} {%- endfor -%} {% endmacro %} + +{%- macro format_kwargs(kwarg) -%} + {%- filter indent(4) %} + {%- for k, v in kwarg|dictsort() %} +- {{ k }}: {{ v }} + {%- endfor %} + {%- endfilter %} +{%- endmacro %} diff --git a/php/repo/init.sls b/php/repo/init.sls new file mode 100644 index 0000000..d3e5518 --- /dev/null +++ b/php/repo/init.sls @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +include: + - .install diff --git a/php/repo/install.sls b/php/repo/install.sls new file mode 100644 index 0000000..41ee3a3 --- /dev/null +++ b/php/repo/install.sls @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import php with context %} +{%- from tplroot ~ "/macro.jinja" import format_kwargs with context %} + +php/repo/install: + pkgrepo.managed: + {{- format_kwargs(php.repo) }}