Reference each title in array of titles
With Puppet 2.7.11, I need to create several symbolic links from /usr/local/bin
to /usr/bin
and want to be clever:
class containing_class {
file { [ "/usr/local/bin/job", "/usr/local/bin/jstart",
"/usr/local/bin/jstop", "/usr/local/bin/jsub"]:
ensure => link,
target => regsubst(name, "^/usr/local/bin/", "/usr/bin/")
}
However, name
causes the links' targets to be name
, $name
and $title
use containing_class
(!) instead and $path
the value of $PATH
.
How can I reference the title/path of the individual file in the call?
Well, this might not be what you want, but should work:
class containing_class {
define bin_link {
file { $title:
ensure => link,
target => regsubst($title, "^/usr/local/bin/", "/usr/bin/"),
}
}
bin_link { [ "/usr/local/bin/job", "/usr/local/bin/jstart",
"/usr/local/bin/jstop", "/usr/local/bin/jsub"]: }
}