On Thursday, February 15, 2018 at 9:46:17 AM UTC-6, buoyant_puppy wrote: > > Got it, thanks everyone. > > Just one small point to add - I'm not actually directly concerned with > Execs here. If you look at my original example, I was needing to do a > conditional check like "if directory exists then...", and my Exec-based > solution for it is just an ugly workaround. I understand the puppet > philosophy here is focused on being declarative, but it's just extremely > common that we don't have the pleasure of working in a purely declarative > environment. As such I think it'd be nice to see unless/requires/etc evolve > further. >
You are not the first to express an interest in Puppet developing in that direction, but Puppet already has mechanisms for the kind of thing you describe. The main approaches to adapting to target-machine state are 1. to rely on *facts* collected from the node to influence details of the catalog. To this end, there are well-developed facilities for defining and distributing your own custom facts. 2. to rely on resource providers to behave appropriately for the target environment; this is under the control of provider developers, including you if you wish to be one. These are well-matched to Puppet's model of operation, which is to first compute a target state based on the machine's identity and current state, site manifests, and site data (catalog building); then to attempt to take whatever action is needed to put the machine in that state (catalog application). A key aspect here is that the target state embodied by a catalog is unconditional at the level of abstraction of the catalog, and perhaps that's what you mean by "purely declarative". But although that perhaps fits the catalog, it does not fit Puppet DSL at all, nor, therefore, the overall system. In the past, I have been fond of saying "Puppet is not a script engine." I consider that a strength, not a weakness. 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/95d19587-1996-4990-9915-83c85bf504ca%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.