Puppet::Type.newtype(:bannerfile) do
  newparam(:name)do
  end
  newparam(:bannertext)do
  end

  newparam(:bannertext2)do
  end

end

but a name variable is being defined and I'm still seeing the issue.


On Thu, Feb 26, 2015 at 10:02 AM jcbollinger <john.bollin...@stjude.org>
wrote:

>
>
> 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
> <https://groups.google.com/d/msgid/puppet-users/0fc9f8dd-e584-4483-82aa-6d17c049bafc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAArvnv1gaYtUHMGuRBQ5WzC78QZ6M7H9Z7%3DrHpHsSXwxuzobbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to