Custom providers/types correct location

211 views
Skip to first unread message

David Campos

unread,
Jul 24, 2012, 11:33:11 AM7/24/12
to puppet...@googlegroups.com
Hello all,

I do not know whether I have hit a bug or it is just a misconception about puppet configuration but I have found a strange inconsistency setting custom providers and types. Theoretically, custom providers and types can be located at a folder named <module_name>/lib/puppet/providers or <module_name>/lib/puppet/types and they should be sent to agents when using the puppet master - agent approach (if pluginsync is allowed).

The problem comes when I tried to set this up with the glassfish module. I found that leaving the library at lib folder was not enough and I was getting the following exceptions:

err: Could not autoload domain: Could not autoload /etc/puppet/modules/glassfish/lib/puppet/provider/domain/asadmin.rb: no such file to load -- puppet/provider/asadmin at /etc/puppet/modules/glassfish/manifests/config.pp:32 on node norway-vm4663
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:27:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:159:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:158:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:35:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:196:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:109:in `do_find'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:68:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:68:in `process'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick/rest.rb:24:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:45:in `listen'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `call'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:42:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:41:in `initialize'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:41:in `new'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:41:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:38:in `synchronize'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:38:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/server.rb:126:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/server.rb:141:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet/daemon.rb:124:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:202:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:144:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:416:in `hook'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:407:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:69:in `execute'
/usr/bin/puppet:4
err: /usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:27:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:159:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:158:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:35:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:196:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:109:in `do_find'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:68:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/handler.rb:68:in `process'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick/rest.rb:24:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:45:in `listen'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `call'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:42:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:41:in `initialize'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:41:in `new'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:41:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:38:in `synchronize'
/usr/lib/ruby/site_ruby/1.8/puppet/network/http/webrick.rb:38:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/server.rb:126:in `listen'
/usr/lib/ruby/site_ruby/1.8/puppet/network/server.rb:141:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet/daemon.rb:124:in `start'
/usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:202:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:144:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:416:in `hook'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:407:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:69:in `execute'
/usr/bin/puppet:4
err: Could not autoload domain: Could not autoload /etc/puppet/modules/glassfish/lib/puppet/provider/domain/asadmin.rb: no such file to load -- puppet/provider/asadmin at /etc/puppet/modules/glassfish/manifests/config.pp:32 on node norway-vm4663

Searching a bit through google, someone pointed that sometimes puppet was searching libraries at libdir so I moved it there, and the exception was gone! But the code was not being executed and only traces were written on the master. But I didn't want it to be executed on the master! Or was it not being really executed? (nothing different was happening on the master).

At the end, I have placed the library either at <module_dir>/lib folder and at libdir but I do not like this approach. What's happening? Thanks!

Puppet 2.7.14
 

ZJE

unread,
Jul 24, 2012, 12:33:28 PM7/24/12
to puppet...@googlegroups.com

I'm using Puppet 3.0.0rfc3, so your YMMV, but for me it's <module_name>/lib/puppet/provider/<typename> and <module_name>/lib/puppet/type
Note both "type" and "provider" are both
singular - there's no trailing 's'.

Nick Fagerlund

unread,
Jul 24, 2012, 1:52:59 PM7/24/12
to puppet...@googlegroups.com


On Tuesday, July 24, 2012 9:33:28 AM UTC-7, ZJE wrote:

I'm using Puppet 3.0.0rfc3, so your YMMV, but for me it's <module_name>/lib/puppet/provider/<typename> and <module_name>/lib/puppet/type
Note both "type" and "provider" are both
singular - there's no trailing 's'.

David Campos

unread,
Jul 25, 2012, 4:45:03 AM7/25/12
to puppet...@googlegroups.com
Excuse me, I did just type from my memory without an exact look to path :). The folder structure that happens to be deployed is the following:

Glassfish dir

PUPPET\CONFDIR\MODULES\GLASSFISH\LIB
\---puppet
    +---provider
    |   |   asadmin.rb
    |   |   
    |   +---application
    |   |       asadmin.rb
    |   |       
    |   +---authrealm
    |   |       asadmin.rb
    |   |       
    |   +---customresource
    |   |       asadmin.rb
    |   |       
    |   +---domain
    |   |       asadmin.rb
    |   |       
    |   +---jdbcconnectionpool
    |   |       asadmin.rb
    |   |       
    |   +---jdbcresource
    |   |       asadmin.rb
    |   |       
    |   +---jvmoption
    |   |       asadmin.rb
    |   |       
    |   \---systemproperty
    |           asadmin.rb
    |           
    \---type
            application.rb
            authrealm.rb
            customresource.rb
            domain.rb
            jdbcconnectionpool.rb
            jdbcresource.rb
            jvmoption.rb
            systemproperty.rb
         
lib directory

PUPPET\VARDIR\LIB
\---puppet
    +---provider
    |   |   asadmin.rb
    |   |   
    |   +---application
    |   |       asadmin.rb
    |   |       
    |   +---authrealm
    |   |       asadmin.rb
    |   |       
    |   +---customresource
    |   |       asadmin.rb
    |   |       
    |   +---domain
    |   |       asadmin.rb
    |   |       
    |   +---jdbcconnectionpool
    |   |       asadmin.rb
    |   |       
    |   +---jdbcresource
    |   |       asadmin.rb
    |   |       
    |   +---jvmoption
    |   |       asadmin.rb
    |   |       
    |   \---systemproperty
    |           asadmin.rb
    |           
    \---type
            application.rb
            authrealm.rb
            customresource.rb
            domain.rb
            jdbcconnectionpool.rb
            jdbcresource.rb
            jvmoption.rb
            systemproperty.rb   
Reply all
Reply to author
Forward
0 new messages