On Friday, September 5, 2014 1:37:21 PM UTC-5, Colin Kincaid Williams wrote:
>
> I'm going to try your suggestion. Thanks for the response! I'm curious 
> however if $rm_hosts is available where you suggest. 
>


I made no suggestion about where $rm_hosts is available in your code.  You 
were proposing to use it in some scope where apparently you were confident 
it was available, and I gave you a way you could use it in that scope to 
achieve what you appeared to be trying to do.  I relied on your evaluation 
of its availability.

Inasmuch as you raise the question, however, you should note that resource 
declarations do not establish scopes, and moreover that parameter bindings 
in resource declarations do not add *anything* to the scope in which the 
declaration appears.  The parameter bindings in a given parameter list are 
not available elsewhere in that list nor in the surrounding scope -- they 
are available only in the body of the declared resource.

 

> E.G.
>
> class role::wh::hadoop::production {
>           $is_rm = $::hostname in $rm_hosts
>
>
> When the relevant lines from the provided hadoop.pp pasted above :
>
> class role::wh::hadoop::production {
>   
>     class { 'cdh5::hadoop':
>         namenode_hosts                           => [
>         'us3sm2nn010r07.comp.prod.local',
>         'us3sm2nn011r08.comp.prod.local',
>     ],
>     rm_hosts                                 => [
>                                                         
> 'us3sm2nn010r07.comp.prod.local',
>                                                         
> 'us3sm2nn011r08.comp.prod.local',
>                                                     ],
>
>
>

You would probably want to pull the value being bound to class parameter 
cdh5::hadoop::rm_hosts out to a local variable in the role class:

$rm_hosts = [
  'us3sm2nn010r07.comp.prod.local',
  'us3sm2nn011r08.comp.prod.local',
]

$is_rm = $::hostname in $rm_hosts

class { 'cdh5::hadoop':
  # ...
  rm_hosts => $rm_hosts,
  # ...
}
 

John

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d98d0913-0305-4b7f-bd8d-87fd3287583b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to