Hello, I''m trying to build a module to install Dell OpenManage. I see there''s a fact that productname: productname => PowerEdge R200 I think there''s no way to have a condtion that says if productname starts with PowerEdge? Would I need a custom fact? Anyone write one yet? :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Ross McKerchar
2008-Nov-25 21:57 UTC
[Puppet Users] Re: condition to test if fact contains ..
> Hello, > > I''m trying to build a module to install Dell OpenManage. I see there''s > a fact that productname: > > productname => PowerEdge R200 > > I think there''s no way to have a condtion that says if productname > starts with PowerEdge? Would I need a custom fact? Anyone write one > yet? :)Very unsophisticated but seems to do the job: Facter.add("productclass") do setcode do Facter.value("productname").split('' '')[0] end end -ross --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
That did the trick, thanks a lot Ross! Gary On Nov 26, 5:57 am, Ross McKerchar <Ross.McKerc...@sophos.com> wrote:> > Hello, > > > I''m trying to build a module to install Dell OpenManage. I see there''s > > a fact that productname: > > > productname => PowerEdge R200 > > > I think there''s no way to have a condtion that says if productname > > starts with PowerEdge? Would I need a custom fact? Anyone write one > > yet? :) > > Very unsophisticated but seems to do the job: > > Facter.add("productclass") do > setcode do > Facter.value("productname").split('' '')[0] > end > end > > -ross--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---