On Wed, 2022-05-25 at 15:08 +0100, 'unman' via qubes-users wrote: > On Tue, May 24, 2022 at 11:54:27PM +0200, 'Johannes Graumann' via > qubes-users wrote: > > Can any one point me to why the following fails? I have been > > banging my > > head against this for a while ... > > > > --- SNIP --- > > create bind dirs config file: > > file.managed: > > - name: /rw/config/qubes-bind-dirs.d/50_user.conf > > - makedirs: True > > - mode: 644 > > - dir_mode: 755 > > > > {% set binddirs = ['/usr/local'] %} > > > > {% for binddir in binddirs %} > > configure '{{ binddir }}' to be persistent: > > file.replace: > > - name: /rw/config/qubes-bind-dirs.d/50_user.conf > > - pattern: "^binds+=( '{{ binddir }}' )$" > > - repl: "binds+=( '{{ binddir }}' )" > > - append_if_not_found: True > > {% endfor %} > > --- SNIP --- > > > > The corresponding error ("State 'create bind dirs config file' in > > SLS > > 'custom_dom0.sys-vpn-mpihlr_assert_vpn_setup' is not formed as a > > list") > > is a complete red herring, as the so called first part by itself > > works > > just fine and only fails when I add the latter (jinja) part ... > > > > How do I properly deal with the single quotes in `pattern` and > > `repl`? > > > > Thanks for any pointers. > > > > Sincerely, Joh > > > > > > Hi Joh > > Change the closing tag on the for statement to "-%}" > This is, I think, salt specific - according to the jinja specs it > will remove whitespace > Your use of single quotes in pattern and repl will be fine. > > A simpler (and lazier) formulation would use file.append: > > {% for binddir in binddirs %} > configure '{{ binddir }}' to be persistent: > file.append: > - name: /rw/config/qubes-bind-dirs.d/50_user.conf > - text: "binds+=( '{{ binddir }}' )" > - makedirs: True > {% endfor %} > > You can drop the explicit file.managed in this case. > > unman
Thank you so much! Addition of the darn `-` made my problem disappear ... this one really had me pulling my hear out! Sincerely, Joh -- You received this message because you are subscribed to the Google Groups "qubes-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to qubes-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-users/63be168de19dca02f1e7760a318f6caff6fdf2ca.camel%40graumannschaft.org.