FAQ
Hi list,

working on my formula [0] for the Radicale CalDAV/CardDAV-server [1]
I just wondered:
   Should I rather gather configuration data from pillar inside the
   template for a configuration file
OR
   should I pass them via defaults in the file.managed state so it's
   easier to see how the whole thing works when looking at the states?

After all, the first point in the Best Practices' General Rules [2] is
"Modularity and clarity should be emphasized whenever possible."

What do you think?

Regards, Florian

PS: The state in question:

{% if salt['grains.get']('os') == 'Ubuntu' -%}
# Uses pillar['radicale:disabled'] and pillar[radicale:verbose_init]
# (Defaulting to False and True, respectively)
/etc/default/radicale:
   file.managed:
     src: salt://radicale/etc_default_radicale.jinja
     template: jinja
{%- endif %}

vs.

{% if salt['grains.get']('os') == 'Ubuntu' -%}
/etc/default/radicale:
   file.managed:
     src: salt://radicale/etc_default_radicale.jinja
     template: jinja
     defaults:
       disabled: {{ salt['pillar.get']('radicale:disabled',False) }}
       verbose_init: {{ salt['pillar.get']('radicale:verbose_init',True) }}
{%- endif %}

I prefer the later one as it's more obvious what happens.

PPS: Yeah, I know, I should move templates for files to
salt://radicale/files...

[0] https://github.com/0xf10e/radicale-formula
[1] http://radicale.org
[2]
http://docs.saltstack.com/en/latest/topics/best_practices.html#general-rules


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedSep 25, '14 at 11:17a
activeSep 25, '14 at 11:17a
posts1
users1

1 user in discussion

Florian Ermisch: 1 post

People

Translate

site design / logo © 2023 Grokbase