On Wednesday, June 20, 2012 8:02:26 PM UTC-5, Steph wrote: > > I've not given it too much thought but I do have sympathy for argument > that divergence of (some of) Puppet's logical representations and their > labels from what's extant on the system reduces clarity and could > introduce error. I'm not talking about class names nor packages > really (there are already restrictions there for things like camelCase > IIRC) but lower down it gets more murky. Service names (i.e. init > scripts et al.) are *almost* an example as they're vendor controlled > but ultimately I can't think of a case where you'd use them as > variables. > > It was because of OS idiocy that I had to follow the symlinks > for /dev/disk/by-path/xen-vbd-* in a custom fact, but I have no > control over what those files are called. Having to munge the result > of that file lookup with underscores and then call it as $::xen_vbd_2049 > (or > whatever) does feel icky because it's a mental hoop to jump through: > the fact no-longer absolutely matches the name of the symlink.
This is just a special case of a wider problem. Pretty much any character can appear in a Unix file name, but a lot of them (and combinations of them) cannot appear in Puppet variable names. Space characters are an especially good and not altogether uncommon example. Hypothetically, double-colons are another example, though I've never seen them in a file name. It's not reasonable to suppose that you should be able to make variable names exactly match file names, unless you're in control of the file names. > The more > I think about it having to do the rename in facter doesn't seem great > to me either as it seems to me it puts the logic in the wrong place. > Taking the approach you chose as given, Facter seems to me exactly the right place: as the data intermediary between nodes and the puppetmaster, it's Facter's job to package node data into a form that the master can digest. What I think is odd is the choice to use file names as variable names in the first place. Compatibility problems aside, it doesn't seem to me that file names would meet my personal expectations for abstraction and comprehensibility. The style guide does explicitly say to not use dashes but if hyphens in > variables are a no-no it may be worth explicitly saying so in the > Variables section of language guide, and putting it in big red letters > in the Reserved Words section so that idiots like don't miss it first time > ;) > I fully agree there. The language guide should be specific about the allowed form of variable names, including, but not limited to, the fact that variable names must not contain hyphens. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/qaNjA9H0EykJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.