On Friday, September 20, 2013 10:30:46 PM UTC-5, Frederiko Costa wrote: > > Hi all, > > I'm trying to find a better way to implement this, but I can't think of. I > have a jdk module that requires to create a symlink to whatever version is > the one installed. Say I install jdk-6u35, it will create something like > /usr/java/jdk_1.6.35. I would like to create a symlink /usr/java/jdk whose > target would be /usr/java/jdk_1.6.35. > > The point here isn't to ask how to create the symlink - that's > straightforward. I'm in a chicken-egg problem. I'm sure there's got a > better and easier way to do this that I can't think of. > > I wrote a facter to report the jdk version running. Based on the string > returned by the facter, it works great. However, I jdk is not installed, > this facter returns nil - the catalog is compiled and the value was nil at > compilation time - and the file resource, property target, fails. I bypass > this with an if clause and everything runs fine because jdk is already > there and the symlink will be created. I know I could tell my facter to > return something else (actually I create a link to latest, and that works, > but it's a poor's man solution). > > Have any you run into this situation? Any suggestion? Not convinced if > facter is the way to go in this particular case. > >
Facts are THE way to communicate information about the current state of your nodes to the master to inform catalog compilation. If you have a chicken & egg problem then it is not facter's fault, it is yours: your custom fact is not suitable for the use to which you are trying to put it. Evidently, it determines the JDK version by a mechanism that depends on the symlink you described, and clearly such a fact cannot be used to direct the form of the symlink. You have at least two options: 1. Come up with a better way to determine which JDK is installed. For example, if you are installing the JDK via your system's packaging system (yum / apt / etc.) then your custom fact could querythe package manager to extract the information you want. 2. Instead of inquiring which JDK version is installed, you could choose what version you want to be installed, and have Puppet make it so. 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.