Shantanu
2012-Apr-12 18:09 UTC
[Puppet Users] using array parameters with inherited parameterized classes
I am trying to use an inherited array parameter in a parameterized class as follows: <puppet> class params{ $packages = $operatingsystem ? { Centos => [''scons'',''bzip2''], Ubuntu => [''scons'',''bzip2''], # Ubuntu => ''scons'', } } class depacks( $packages = "$params::packages" ) inherits params { package{ $packages: ensure => ''present'', } } class {"depacks": } </puppet> * It''s failing with following error: <error> err: /Stage[main]/Depacks/Package[sconsbzip2]/ensure: change from purged to present failed: Execution of ''/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install sconsbzip2'' returned 100: Reading package lists... Building dependency tree... Reading state information... E: Couldn''t find package sconsbzip2 </error> * It works fine if I override the inherited array parameter while calling/evaluating the class: <puppet> class {"depacks": packages => [''scons'',''bzip2''], } </puppet> I am using Puppet 2.6.14 with Ruby 1.8.7. The error occurs on both Ubuntu and CentOS systems. Am I missing something here? Any pointers will be really helpful. -- Thanks, Shantanu -- 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.
Craig Dunn
2012-Apr-13 09:07 UTC
Re: [Puppet Users] using array parameters with inherited parameterized classes
> class depacks( > $packages = "$params::packages" > ) inherits params { > > package{ $packages:Putting quotes around $params::packages is making $packages a string rather than an array. Remove the quotes and it should work Regards Craig -- Craig Dunn | http://www.craigdunn.org Yahoo/Skype: craigrdunn | Twitter: @crayfishX -- 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.
Shantanu
2012-Apr-13 14:25 UTC
[Puppet Users] Re: using array parameters with inherited parameterized classes
On Apr 13, 4:07 am, Craig Dunn <cr...@craigdunn.org> wrote:> > class depacks( > > $packages = "$params::packages" > > ) inherits params { > > > package{ $packages: > > Putting quotes around $params::packages is making $packages a string > rather than an array. Remove the quotes and it should work >Thanks for pointing it out Craig. It''s working now. -- Shantanu -- 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.