Thanks Dan!

The conversions action does exactly what I want.

:-)

On 16 nov, 18:02, Dan Bode <d...@puppetlabs.com> wrote:
> Hi Dennis,
>
>
>
>
>
> On Tue, Nov 16, 2010 at 7:28 AM, Dennis vdM <cybernijn...@gmail.com> wrote:
> > Hi all,
>
> > I have a small facter script which gives me the outcome of a subnet:
>
> > Facter.add("lokatie") do
> >   setcode do
> >      %x{facter ipaddress | awk -F"." '{print $2}'}.chomp
> >   end
> > end
>
> > This script gives me either 84 or 85 as result.
> > What I really want is to label 84 as 'AAA' and 85 as 'BBB' (so facter
> > gives either AAA or BBB as a result), but I can't seem to make it
> > work :-(
>
> is 84,85 the full list of numbers that need to be translated? if you know
> all of the values you want to translate, you could do something like:
>
> conversions = {
>   '84' => 'AAA',
>   '85' => 'BBB'
>
> }
>
> Facter.add("lokatie") do
>   setcode do
>      subnet = %x{facter ipaddress | awk -F"." '{print $2}'}.chomp
>      conversions[subnet]
>   end
> end
>
>
>
>
>
> > Can anyone push me in the right direction?
>
> > Regards,
> > Dennis
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Puppet Users" group.
> > To post to this group, send email to puppet-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@google­groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/puppet-users?hl=en.- Tekst uit oorspronkelijk 
> >bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk 
> bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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.

Reply via email to