--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengine+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/e69e10ea-d2f7-4b46-8e7f-d98e937a9160n%40googlegroups.com.
t.d…@servicemusic.org.uk writes:
Executive summary: Are there any conventions or recommendations for where to stage "on-demand" templates that are imported and then expanded?
Hi David,
In general, CFEngine doesn't try to prescribe very many things. I tend to leverage $(sys.statedir)
for caching things. I guess I have a tendency to stage templates next to their final location, but probably sys.statedir
would be a better choice since it's not uncommon that some apps would try to pick up and use any file in the same directory.
unpacking and installation is a sequence of two files promises: (1) import to the local machine with secure_cp (or similar) to a staging area; (2) install from that staging area.
I try to avoid this kind of thing in general, but perhaps you have good reasons for not having your templates copied as part of the update policy. Perhaps I mis-understood your original question. When I think about staging a file, I am rendering a config file to a temporary place, then validating that with something like apachectl configtest
or visudo -c
then promising the final location. Now I am thinking that you are talking about the templates themselves that you are copying locally to use for rendering. I still think sys.statedir
is a reasonable place for this kind of thing. Perhaps it would be convenient to do something like $(sys.statedir)/templates/$(this.namespace)/$(this.bundle)/my-template.mustache
.
Are there any conventions or recommendations for where, locally, to stage the imported template?
If not statedir (which is sometimes on a ramdisk), then $(sys.workdir)/templates/
also seems reasonable to me, but I don't know that it would be a widely used convention.
– Nick Anderson| Doer of Things | (+1) 785-550-1767 | https://northern.tech
sys.statedir
The name of the state directory where CFEngine looks for its embedded database files.
# statedir = /var/cfengine/state
History: Introduced in CFEngine 3.7
So yes, it's intended for internal usage, but there is no reason you can't throw your site's files there too, as long as there is no name collision with CFEngine's database files. I wouldn't put them at top level, just so sys.statedir doesn't get cluttered up -- like Nick suggested, use a templates/ directory, or make a site/ directory. :) /var/cfengine/state/acme or whatever. ;) In case you ever want to transfer something other than templates, maybe pull down a secret from the hub temporarily or something.
Best,
Aleksey
--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/b1973853-590c-47db-b238-a82c1a6f26ddn%40googlegroups.com.