[Puppet-users] using $name in default assignment within define?

Mark D. Nagel mnagel at willingminds.com
Mon Mar 26 19:27:52 CDT 2007


I thought this made sense, but apparently I am mistaken:

define copyfile($owner = root, $group = root, $repo = "config",
                $mode, $source = $name, $purge = false, $backup = false,
                $recurse = false, $server = $servername) {
    file { $name:
        mode => $mode,
        owner => $owner,
        group => $group,
        backup => $backup,
        recurse => $recurse,
        purge => $purge,
        source => "puppet://$server/$repo/$source"
    }
}

I thought that if I didn't specify $source, it would be set to $name and
life would be good.  According to the YAML file, it is being replaced
with the empty string.  This is 0.22.2.  Is it just that the value is
not available yet at that point in argument binding, or is this just
unreasonable?  I am going to try another method, but was curious whether
this ought to work at all.

Thanks,
Mark

-- 
Mark D. Nagel, CCIE #3177 <mnagel at willingminds.com>
Principal Consultant, Willing Minds LLC (http://www.willingminds.com)
cell: 949-279-5817, desk: 714-630-4772, fax: 949-623-9854



More information about the Puppet-users mailing list