On Wednesday, February 25, 2015 at 3:25:57 PM UTC-6, Salty Old Cowdawg 
wrote:
>
> I've created a very simple type as follows:
>
> Puppet::Type.newtype(:bannerfile) do
>   @doc = "Create a text file with banner text"
>   ensurable
>   newproperty(:name)do
>     isnamevar
>   end
>   newproperty(:bannertext)do
>   end
>   newproperty(:bannertext2)do
>   end
>
>
> end
> doesn't do anything yet, but it is a start.
>
> I'm invoking it from a class thusly:
>
>  bannerfile { "/tmp/bannerfile":
>           bannertext => "This would be banner text",
>           bannertext2 => $testmodule::config::line2
>
>         }
>
> and when I run the Puppet agent I get:
>
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> No set of title patterns matched the title "/tmp/bannerfile"
>
> what on earth is it trying to tell me?
>
>

It's telling you that the way your type's namevar is set up is wrong.  At a 
guess, Puppet thinks you have a composite namevar.  The custom type 
documentation <https://docs.puppetlabs.com/guides/custom_types.html> has 
this to say about namevars:

There are three ways to designate a namevar. Every type must have *exactly 
> one* parameter that meets *exactly one* of these criteria:
>
> *Option 1:* Create a parameter whose name is :name. Since most types just 
> use :name as the namevar, it gets special treatment and will 
> automatically become the namevar.
> [...]
> *Option 2:* Provide the :namevar => true option as an additional argument 
> to the newparam call.
> [...]
> *Option 3:* Call the isnamevar method (which takes no arguments) inside 
> the parameter’s code block.
>
>
(emphasis in the original).  Your 'name' parameter meets *two* of those 
criteria, so I'd try omitting the 'isnamevar' from its code block to trim 
that back to one.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/0fc9f8dd-e584-4483-82aa-6d17c049bafc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to