On Thursday, January 23, 2014 1:56:41 AM UTC-6, Krist van Besien wrote: > > Hello, > > > I have a need for an exported resource that only gets exported once. So a > class that exports this resource should test first if it hasn't already > been exported, and only then export it. > > In pseudo code: > > if > !exists X > then > @@X > > > The problem is that I can't seem to find out how to test for the existence > of an exported resource in puppet, without any side effects... > > Any hints? > >
Yes: don't do that. It only makes sense to export resources that are somehow specific to or characteristic of the node whose catalog is being compiled. If you have such a resource to export, then structure your manifests so that no more than one declaration of the resource can be evaluated during any catalog compilation. No need for any tests in that case. If different nodes may export *similar* resources, then do ensure that they all have distinct titles (and names) across all nodes. On the other hand, if your resources are not characteristic of any particular node, then they are not suited for export. We might be able to suggest specific alternatives if you explained what you are trying to achieve in more detail. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/6510ee0c-99ae-4087-a9ce-26e361c934be%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.