descala@gmail.com
2009-Jan-08 12:09 UTC
[Puppet Users] creating types with parameters from a hash (or array)
Hello,
I want to create many symbolic links as provided by an external_nodes
script.
I started with a simple manifest to create a type for each element in
an array:
$files = [ ''/tmp/one'', ''/tmp/two'' ]
file { $files:
ensure => ''/tmp/common_target'',
}
but, of course, this creates symlinks to the same file. I need
symlinks to diferent files. my question is: what about parameters? the
next example does not work, it just uses the last target for all
files:
$files = [ ''/tmp/one'', ''/tmp/two'' ]
$targets = [ ''/tmp/target1'', ''/tmp/target2''
]
file { $files:
ensure => $targets,
}
my external_nodes yaml looks like this:
parameters:
symlinks:
/tmp/one:
ensure: target1
/tmp/two:
ensure: target2
classes:
- foo_class
and my dream manifest is:
file {$symlinks}
is it a new feature? if it is new I want to develop it, but need some
hints ...
thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
descala@gmail.com
2009-Jan-09 15:27 UTC
Re: creating types with parameters from a hash (or array)
I filed an issue with a patch. http://projects.reductivelabs.com/issues/show/1858 thank you, david On 8 Gen, 13:09, desc...@gmail.com wrote:> Hello, > > I want to create many symbolic links as provided by an external_nodes > script. > > I started with a simple manifest to create a type for each element in > an array: > > $files = [ ''/tmp/one'', ''/tmp/two'' ] > file { $files: > ensure => ''/tmp/common_target'', > > } > > but, of course, this creates symlinks to the same file. I need > symlinks to diferent files. my question is: what about parameters? the > next example does not work, it just uses the last target for all > files: > > $files = [ ''/tmp/one'', ''/tmp/two'' ] > $targets = [ ''/tmp/target1'', ''/tmp/target2'' ] > file { $files: > ensure => $targets, > > } > > my external_nodes yaml looks like this: > > parameters: > symlinks: > /tmp/one: > ensure: target1 > /tmp/two: > ensure: target2 > classes: > - foo_class > > and my dream manifest is: > > file {$symlinks} > > is it a new feature? if it is new I want to develop it, but need some > hints ... > > thanks!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to puppet-dev+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---