Andreas Schäfer
2010-May-06 18:09 UTC
[Puppet Users] Custom Type fails with "No namevar for..."
Hi,
I''m trying to create a custom type for Puppet 0.25.4. The type is
located in a custom module and looks like this:
gentryx@rei ~/puppet-gentryx $ cat
modules/gentoo_useflags/lib/puppet/type/useflag.rb
module Puppet
newtype(:useflag) do
newparam(:name) do
desc "Foo Bar"
isnamevar
end
ensurable do
newvalue(:set) do
end
newvalue(:unset) do
end
defaultto :unset
end
def retrieve
:unset
end
end
end
If I try to use the type in a class, for instance like this...
gentryx@rei ~/puppet-gentryx $ cat modules/gentoo_useflags/manifests/init.pp
class useflagtest {
useflag { "foo bar":
ensure => set
}
}
...I get an error when applying the configuration:
rei ~ # puppetd -v --test
info: Retrieving plugin
info: Loading facts in hardware_platform
info: Loading facts in hardware_platform
err: Could not retrieve catalog from remote server: Error 400 on SERVER: No
namevar for useflag at /etc/puppet/modules/gentoo_useflags/manifests/init.pp:4
on node rei.informatik.uni-erlangen.de
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
Which leaves me a little puzzled since I''m calling
"isnamevar". According to what I saw in Puppet''s source code,
this
/should/ work, but apparently I''m missing something important.
Any ideas, what might be causing this error?
Thanks in advance
-Andreas
ps: the full source of the test module can be found at
http://gentryx.de/~gentryx/gentoo_useflags.tbz
--
=========================================================Andreas Schäfer
HPC and Grid Computing
Chair of Computer Science 3
Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany
+49 9131 85-27910
PGP/GPG key via keyserver
I''m a bright... http://www.the-brights.net
=========================================================
(\___/)
(+''.''+)
(")_(")
This is Bunny. Copy and paste Bunny into your
signature to help him gain world domination!