Bug #3136

custom plugins "type/" is not loaded first . If provider/* depends on those if fails to load at load plugins

Added by Alban Browaeys over 2 years ago. Updated 12 months ago.

Status:Duplicate Start date:02/01/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Affected Puppet version:0.25.4 Branch:
Keywords:
Votes: 0

Description

For example error with puppet-mysql:

info: Loading downloaded plugin /var/lib/puppet/lib/facter/mysql.rb
info: Loading downloaded plugin 
/var/lib/puppet/lib/puppet/parser/functions/mysql_password.rb
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/provider/mysql_database/mysql.rb
err: Could not load downloaded file /var/lib/puppet/lib/puppet/provider/mysql_database/mysql.rb: undefined method `provide' for nil:NilClass
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/provider/mysql_grant/mysql.rb
err: Could not load downloaded file /var/lib/puppet/lib/puppet/provider/mysql_grant/mysql.rb: undefined method `provide' for nil:NilClass
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/provider/mysql_user/mysql.rb
err: Could not load downloaded file /var/lib/puppet/lib/puppet/provider/mysql_user/mysql.rb: undefined method `provide' for nil:NilClass
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/type/mysql_database.rb
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/type/mysql_grant.rb
/var/lib/puppet/lib/puppet/provider/mysql_grant/mysql.rb:14: warning: already initialized constant MYSQL_USER_PRIVS
/var/lib/puppet/lib/puppet/provider/mysql_grant/mysql.rb:20: warning: already initialized constant MYSQL_DB_PRIVS
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/type/mysql_user.rb
info: Loading facts in mysql
info: Loading facts in mysql

Code that fails is

Puppet::Type.type(:mysql_database).provide(:mysql,
                :parent => Puppet::Provider::Package) do

        desc "Use mysql as database."

that is “info: Loading downloaded plugin /var/lib/puppet/lib/puppet/type/mysql_database.rb” which happens after: “info: Loading downloaded plugin /var/lib/puppet/lib/puppet/provider/mysql_database/mysql.rb”

even though the provider mysql_database needs it defined beforehand.

Attached is a patch to workaround this by loading (on the client side as its there that sort happens) puppet://puppet/plugins/puppet/type before all the others.

Maybe facts should also be up explicitely but right now the default sort ordering place them on the top already (but this is directory layout dependent).

0001-Load-the-plugins-type-first.patch (1.7 kB) Alban Browaeys, 02/01/2010 06:25 pm


Related issues

related to Puppet - Feature #6907: Ensure providers can be used in the same puppet run that ... Closed 03/30/2011
duplicated by Puppet - Feature #4416: Resources cannot be used on the run where they are synced Closed 07/30/2010
duplicated by Puppet - Bug #3561: Error loading provider during pluginsync (provider are do... Duplicate 04/15/2010

History

Updated by Markus Roberts over 2 years ago

  • Status changed from Unreviewed to Needs More Information

I may not be understanding your point, but it seems a simple “require” statement would do the trick. Would this not suffice?

Updated by Tim Stoop over 1 year ago

Which file would i need to require to fix this? I’m running into the same ‘problem’. It’s not really a problem, because everything works as expected, but I’d love to get rid of the error.

Already require'ing ‘puppet/type’, but that doesn’t do it, I’m afraid.

Updated by Dan Carley over 1 year ago

There is some more info about this in #3561.

Updated by Nick Lewis 12 months ago

  • Status changed from Needs More Information to Duplicate

This seems to be fixed by #4416. Please re-open if that’s not the case.

Also available in: Atom PDF