[Puppet Users] scope of variable inside defined type

Rajgourav Jain
Mon, 17 Nov 2014 08:06:25 -0000

Hi,

I have written two defined type and trying to use some variables between
them.

----foo/manifest/init.pp ------------
define foo( $x=undef, $y=undef)
{

  if $x == undef {
   $xx = $defualt_x
  } else {
    $xx  = $x
  }

if $y == undef {
   $yy $defualt_y
  } else {
    $yy= $y
  }

 fooinstall {$xx:}
}


--------------foo/manifest/install.pp-------------------
define foo::install (){
  if  $yy= "some text"
  {
     puppet code here
   }
  else {
     puppet code here
  }
}


------ sites.pp ----
node 'hostnam-l.domain.com'
{
foo { "Aname" :
   $x => a,
   $y => b,
 }
}

Could you suggest how can I make this code work. I am not able to access
$xx and $yy in defined type foo::install.

Thanks,
Rajgourav Jain

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/7567f067-3342-44b1-b8b6-dd185c176af7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.