Just poking around on the Docs site and went to the facter recipe for VMware. (http://reductivelabs.com/trac/puppet/wiki/IsVmwareGuestRecipe) If you look at the bottom, the author states that they were unable to get case statements to match as a regex. case $macaddress { "00:0C:29:*":{ file{ "/etc/running_inside_vmware": ensure => present } } } Is there a way to do regex matching in a case statement or is this solely the realm of facter? Thanks, --Robert
On Feb 6, 2007, at 12:06 PM, Robert Nickel wrote:> Just poking around on the Docs site and went to the facter recipe > for VMware. > (http://reductivelabs.com/trac/puppet/wiki/IsVmwareGuestRecipe) > > If you look at the bottom, the author states that they were unable > to get case > statements to match as a regex. > > case $macaddress { > "00:0C:29:*":{ > file{ "/etc/running_inside_vmware": ensure => present } > } > } > > Is there a way to do regex matching in a case statement or is this > solely the > realm of facter?Puppet currently has no support for regexes, so you''re restricted to doing this within Facter at this point. At some point something like this will need to happen, but I''m going to avoid it for as long as possible. It might make more sense to have an external server-side module that can do this rather than extend the language, because Puppet''s language is really about specification not about computation. -- Hoare''s Law of Large Problems: Inside every large problem is a small problem struggling to get out. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
> > case $macaddress { > > "00:0C:29:*":{ > > file{ "/etc/running_inside_vmware": ensure => present } > > } > > } > > Puppet currently has no support for regexes, so you''re restricted to > doing this within Facter at this point. > > At some point something like this will need to happen, but I''m going > to avoid it for as long as possible. It might make more sense to > have an external server-side module that can do this rather than > extend the language, because Puppet''s language is really about > specification not about computation.Would it make sense to make this external server-side module an extension of facter? I''m thinking of the case where there''s a "more"(all?) knowing server capable of giving remote facts to facter. Right now, this could be done with some RPC calls, but are there plans to standardize that? --mac
On Feb 6, 2007, at 4:31 PM, Chris McEniry wrote:> > Would it make sense to make this external server-side module an > extension of facter? I''m thinking of the case where there''s a > "more"(all?) knowing server capable of giving remote facts to > facter. Right now, this could be done with some RPC calls, but > are there plans to standardize that?Frankly, I haven''t thought about it all that much; it just seems like a natural way to push complexity out of the language. The more I wrestle with the different kinds of problems we need to express in our configurations, the more it seems to make sense to build stacks of small tools with limited semantic domains. Facter is clearly one such tool, and I''ve been thinking of creating another tool that just handles node/class mapping (i.e., a tool that accepts a list of facts for a host and produces the class memberships for that host). This idea of a server-side facter is a pretty good idea, and would probably just be added to the stack. This is literally the first time I''ve thought about it, but it shouldn''t be too hard to reuse the Facter code to build such a tool; then it would just be a question of how to insert this tool between the client and the compilation phase. If we can keep Puppet''s language focused on specifying the details of resources, and not force it to also handle class membership determination, I think we''ll be a lot happier. At least, I will be. This is definitely something to think about. Anyone else feel any particular way about this? -- The one thing more difficult than following a regimen is not imposing it on others. -- Marcel Proust --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com