Re: [Puppet Users] Fun with hashes and ERB

2011-05-20 Thread Peter Meier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

> Thanks, that worked perfectly!  I had no idea key and value were reserved
> words.

they aren't and imho your example looks quite fine. But as you didn't
post the erb error in the first place, it's hard to tell what is
actually really wrong.

~pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3WNFoACgkQbwltcAfKi38JIACgqhaUVyVpVJvkvii1JxG0JzTA
GIEAoIZJ5I1SsmTYw7Ogg7vSeUEdk9pg
=BApj
-END PGP SIGNATURE-

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Fun with hashes and ERB

2011-05-17 Thread Aaron Grewell
Thanks, that worked perfectly!  I had no idea key and value were reserved
words.

On Mon, May 16, 2011 at 6:16 PM, yzhk...@gmail.com wrote:

> multipaths {
> <% devices.each do |key,value| -%>
> multipath {
> wwid<%= value  %>
> alias   <%= key %>
> }
> <% end -%>
> }
>
> On Tue, May 17, 2011 at 2:29 AM, Aaron Grewell wrote:
>
>> Hi all,
>> I'm trying to figure out the intersection of hashes and ERB.  I don't know
>> Ruby, so I put this together from examples available online and predictably
>> it generates an ERB syntax error.  Can you point me in the right direction?
>>
>> ### Call:
>> class {'multipath':
>> devices => {
>> oradata01 => "360050768018280d1f8000193",
>> oradata02 => "360050768018280d1f8000194",
>> oradata03 => "360050768018280d1f8000195",
>> }
>> }
>>
>> ### Class:
>> class multipath ($devices) {
>>
>> package { "device-mapper-multipath": }
>>
>> file { "/etc/multipath.conf":
>> mode=> "644",
>> content => template("multipath/multipath.conf.erb"),
>> notify  => Service["multipathd"],
>> require => Package["device-mapper-multipath"],
>> } # file
>>
>> service { "multipathd":
>> ensure  => running,
>> enable  => true,
>> require => Package["device-mapper-multipath"],
>> } # service
>> } # class mapper
>>
>> ### Template (multipath.conf.erb):
>>
>> defaults {
>> polling_interval30
>> failbackimmediate
>> no_path_retry   5
>> rr_min_io   100
>> path_checkertur
>> user_friendly_names yes
>> }
>>
>> devices {
>> device {
>> vendor  "IBM"
>> product "2145"
>> path_grouping_policygroup_by_prio
>> prio_callout"/sbin/mpath_prio_alua /dev/%n"
>> }
>> }
>>
>> multipaths {
>> <% devices.each do |alias,wwid| -%>
>> multipath {
>> wwid<%= wwid  %>
>> alias   <%= alias %>
>> }
>> <% end -%>
>> }
>>
>>  --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>  --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Fun with hashes and ERB

2011-05-16 Thread yzhk...@gmail.com
multipaths {
<% devices.each do |key,value| -%>
multipath {
wwid<%= value  %>
alias   <%= key %>
}
<% end -%>
}

On Tue, May 17, 2011 at 2:29 AM, Aaron Grewell wrote:

> Hi all,
> I'm trying to figure out the intersection of hashes and ERB.  I don't know
> Ruby, so I put this together from examples available online and predictably
> it generates an ERB syntax error.  Can you point me in the right direction?
>
> ### Call:
> class {'multipath':
> devices => {
> oradata01 => "360050768018280d1f8000193",
> oradata02 => "360050768018280d1f8000194",
> oradata03 => "360050768018280d1f8000195",
> }
> }
>
> ### Class:
> class multipath ($devices) {
>
> package { "device-mapper-multipath": }
>
> file { "/etc/multipath.conf":
> mode=> "644",
> content => template("multipath/multipath.conf.erb"),
> notify  => Service["multipathd"],
> require => Package["device-mapper-multipath"],
> } # file
>
> service { "multipathd":
> ensure  => running,
> enable  => true,
> require => Package["device-mapper-multipath"],
> } # service
> } # class mapper
>
> ### Template (multipath.conf.erb):
>
> defaults {
> polling_interval30
> failbackimmediate
> no_path_retry   5
> rr_min_io   100
> path_checkertur
> user_friendly_names yes
> }
>
> devices {
> device {
> vendor  "IBM"
> product "2145"
> path_grouping_policygroup_by_prio
> prio_callout"/sbin/mpath_prio_alua /dev/%n"
> }
> }
>
> multipaths {
> <% devices.each do |alias,wwid| -%>
> multipath {
> wwid<%= wwid  %>
> alias   <%= alias %>
> }
> <% end -%>
> }
>
>  --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.