Re: [Puppet-dev] Custom (ruby) type in module not found - "Invalid resource"

53 views
Skip to first unread message

Dan Bode

unread,
Oct 8, 2012, 12:36:49 PM10/8/12
to puppe...@googlegroups.com


On Mon, Oct 8, 2012 at 7:56 AM, Axel B <axel.b...@gmail.com> wrote:
Hello readers,

I have already asked this question in Puppet Users, but so far without working solution. Maybe I have more luck in here :) . I have developed a custom SVN type (based on http://is.gd/W0cIMS among others), and I guess it's fairly correct ruby code. (at least I don't get any syntax errors). Now I have deployed it in my module in <module>/lib/puppet/type/repo_checkout.rb and <module>/lib/puppet/provider/repo_checkout/svn.rb, and the files do get transferred to the client.

in my site.pp I do the following:

    repo_checkout { "test" :
        source  => "svn://l1214022/puppet/trunk/bas3_bali",
        method  => "export",
        path    => "/home/rsync/puppet/checkthis",
    }

... and I get the following error:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type reposync at /etc/puppet/manifests/site.pp:98 on node ...

This is an error on the master. It looks like you are trying to refer to a resource named reposync in the manifest (at the indicated line) and your resource is named repo_checkout
 


If I insert print statements in the code and invoke puppet agent --debug, I see the statements being executed on the client:

info: Loading downloaded plugin /home/rsync/.puppet/var/lib/puppet/type/reposync.rb
lala Huhu debug: catalog supports formats: b64_zlib_yaml dot pson raw yaml; using pson

Directly afterwards I get to see the message "Invalid resource type ...". It loads, updates, but does not find. After seeing this message for about 100 times I symlinked the type and provider dirs to /var/.../puppet/ (the global, core putty installation files). I basically wanted to see if I have an invalid ruby file, or if puppet simply doesn't notice the downloaded plugins. It turns out - the latter. in the global puppet dir I get no more "Invalid type" errors, and my debug print statement in the exists? method gets printed on screen.


Does anybody have an idea what I do wrong? It really sucks to be stuck at this point, I really would appreciate any help here.


Thanks in advance & greetings,
Axel.

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-dev/-/0hSsomXXmRoJ.
To post to this group, send email to puppe...@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Stefan Schulte

unread,
Oct 8, 2012, 12:48:37 PM10/8/12
to puppe...@googlegroups.com
On Mon, Oct 08, 2012 at 07:56:42AM -0700, Axel B wrote:
> Hello readers,
>
> [...]
> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid
> resource type reposync at /etc/puppet/manifests/site.pp:98 on node ...
>
> [...]
> info: Loading downloaded plugin
> /home/rsync/.puppet/var/lib/puppet/type/reposync.rb
> *lala Huhu *debug: catalog supports formats: b64_zlib_yaml dot pson raw
> yaml; using pson
>
> Directly afterwards I get to see the message "Invalid resource type ...".
> It loads, updates, but does not find.
> [...]

Hi Axel,

I suppose you use as master->agent setup? The most likely error that
comes to mind is that the puppet *master* does not find the plugin. The
master is responsible for the parameter validation so the master has to
load at least the reposync.rb type. So make sure your custom type is
present in /var/lib/puppet/lib/puppet/type/reposync.rb on your *master*.

Simply copy the files by hand or perform an agent run with pluginsync
turned on on your master. Then restart your master.

-Stefan

Axel B

unread,
Oct 9, 2012, 3:25:47 AM10/9/12
to puppe...@googlegroups.com
Hi Stefan,

It is exactly as you said. It works now - with one of the modules' type/provider symlinked into the *master's* global type/provider dirs.

But - seriously? That would mean that I have to symlink/copy each of the modules' facts to the global installation on the master, which is not only ... really bad, but also actually exactly the opposite of the things stated in http://is.gd/zMVyXK and http://is.gd/vZ9j8D ... . Is this a bug??


Thanks a lot :) & greetings,
Axel.






Am Montag, 8. Oktober 2012 18:45:46 UTC+2 schrieb Stefan Schulte:
comes to mind is that the puppet *master* does not find the plugin. The

Axel B

unread,
Oct 9, 2012, 6:40:06 AM10/9/12
to puppe...@googlegroups.com
Hi Dan,

yes - you were right, had I not been wrong before. That's a copy and paste error of the post actually. The module is in fact called "reposync", the file name as well as the module itself inside.

Sorry, and thanks very much for your help.


Greetings,
Axel.

Eric Sorenson

unread,
Oct 9, 2012, 12:30:08 PM10/9/12
to puppe...@googlegroups.com
Hi Axel, can you explain what you mean by opposite to those docs?

There is a bug about this which FWIW is fixed in 3.0:


-=Eric

Axel B

unread,
Oct 10, 2012, 6:19:48 AM10/10/12
to puppe...@googlegroups.com
oh box. Thanks a LOT! This _very_ much seems to be it.

well, in opposite to the docs means that nowhere in thost docs this behavior is mentioned, but they happily describe in detail how to write a custom type within a module. which cannot ever work with this bug - unless the master itself uses the type from that module, which it does not in my case.

really, thanks a lot. I will try to upgrade to v3 _somehow_ to get rid of that, cause that could be a major dealbreaker for us here.
Reply all
Reply to author
Forward
0 new messages