Afternoon all...
I'm trying to use Munge in a custom Puppet type to set the param value to
that of another param if the current value is null...
Code I've got is:
Puppet::Type.newtype(:netapp_export) do
> @doc = "Manage Netapp NFS Export creation, modification and deletion."
>
> apply_to_device
>
> ensurable do
> desc "Netapp NFS Export resource state. Valid values are: present,
> absent."
>
> defaultto(:present)
>
> newvalue(:present) do
> provider.create
> end
>
> newvalue(:absent) do
> provider.destroy
> end
> end
>
> newparam(:name) do
> desc "The export name."
> isnamevar
> end
>
> newparam(:persistent) do
> desc "Persistent export?"
> newvalues(:true, :false)
> defaultto(:true)
> end
>
> newparam(:path) do
> desc "The filer path to export."
> Puppet.debug("Validating path param.")
> munge do |value|
> if value.nil?
> Puppet.debug("path param is nil. Setting to #{@resource[:name]}")
> resource[:name]
> else
> Puppet.debug("path param is not nil.")
> end
> end
> #Puppet.debug("path value is: #{@resource[:path]}.")
> end
>
> end
>
>
However I'm not having any success with the above.
Any ideas???
Cheers
Gavin
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/vmLalusLpVYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.