Issue #4416 has been updated by Nick Lewis.

Status changed from Accepted to Merged - Pending Release

Merged a fix to this to 2.6.x in 
commit:01c11424b61163fae71de3611a5166c894601937.

The problem was that if provider plugins are loaded first, they will cause 
their type to be autoloaded. The type is then created, the provider is created 
which causes the type to be "providified" -- that is, have a 'provider' 
parameter added to it. Then later on in the plugin load sequence, the type 
plugin is explicitly reloaded, which causes a new type with the same name to be 
created, removing the old version. This type still has the associated providers 
(those associations are made externally to the type itself, by name), but is no 
longer "providified".

Our fix was to explicitly also "providify" the type during creation, right 
after it tries to load its providers. This is only done if it actually has 
providers. Provider creation also still providifies a type, in case providers 
aren't made available until after the type has been created.

A more correct solution in the future will be to unify plugins and the 
autoloader. Right now, the two have no knowledge of each other, so a file can 
be autoloaded and also loaded as a plugin, which causes things to be loaded 
multiple times and causes lots of headaches like this. So currently, if the 
provider plugin happens to be loaded first, the following loads will happen:

* provider loaded as a plugin

* type autoloaded due to the provider requesting it

* type loaded as a plugin

* providers autoloaded due to the type being created

This is suboptimal, but a proper fix is larger scope and not appropriate for 
2.6.x. So this fix only addresses the symptoms, unfortunately. A more correct 
fix is planned for the future.

We also fixed an issue where if a provider was loaded with an error, it could 
not be reloaded successfully even after the error had been fixed. This was 
because genclass was creating the class, but failing before putting it into the 
provider hash for the type. So the class existed, but when the 'provide' method 
was called again later to create the provider after it was fixed, it didn't 
find the existing provider class, and so didn't remove it before creating the 
replacement. So there was a constant collision, which failed. Now we will 
always try to remove the class even if we can't find it in the provider hash, 
which is just a noop if it doesn't exist.
----------------------------------------
Feature #4416: Resources cannot be used on the run where they are synced
https://projects.puppetlabs.com/issues/4416

Author: Dan Bode
Status: Merged - Pending Release
Priority: Urgent
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


<pre>
node puppetclient {
  vcsrepo { "/usr/local/dev/repo":
    ensure => present,
    provider => git
  }
}
</pre>
here is the code that syncs vcsrepo type
<pre>
# puppetd -td
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does 
not exist
debug: Puppet::Type::User::ProviderUser_role_add: file roledel does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting false
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows 
is missing
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/classes.txt]: Autorequiring 
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/reports]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/public_keys]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/run/puppet/agent.pid]: Autorequiring File[/var/run/puppet]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring 
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring 
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/private_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: Finishing transaction -606566788
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/reports]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: Finishing transaction -607538088
debug: Using cached certificate for ca
debug: Using cached certificate for puppetclient
debug: Finishing transaction -607774148
debug: Loaded state in 0.00 seconds
info: Retrieving plugin
debug: Loaded state in 0.00 seconds
debug: Using cached certificate for ca
debug: Using cached certificate for puppetclient
debug: Using cached certificate_revocation_list for ca
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
info: /File[/var/lib/puppet/lib]: Storing newly-audited value  for content
info: /File[/var/lib/puppet/lib/facter]: Storing newly-audited value  for 
content
notice: /File[/var/lib/puppet/lib/puppet]/ensure: created
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider]/ensure: created
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider/vcsrepo]/ensure: created
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider/vcsrepo.rb]/ensure: defined 
content as '{md5}60a6a1c0e3edb6baaf5669ecb5d0aa65'
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider/vcsrepo/bzr.rb]/ensure: 
defined content as '{md5}bccc75cc202396faf15331ba1e0c1cf8'
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider/vcsrepo/cvs.rb]/ensure: 
defined content as '{md5}d083915b04b10c9be58466019595c65e'
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider/vcsrepo/git.rb]/ensure: 
defined content as '{md5}9fb37dd98385b2546dc816d581d25db2'
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider/vcsrepo/hg.rb]/ensure: 
defined content as '{md5}269ce7d0a35d2e5b31cee48d03840597'
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/provider/vcsrepo/svn.rb]/ensure: 
defined content as '{md5}6900fd41da5d949ef724727148e4375a'
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/type]/ensure: created
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
notice: /File[/var/lib/puppet/lib/puppet/type/vcsrepo.rb]/ensure: defined 
content as '{md5}0a499c37fb9eb45a52f7c8270dbdeda1'
debug: Finishing transaction -607876798
debug: Storing state
debug: Stored state in 0.02 seconds
info: Loading downloaded plugin 
/var/lib/puppet/lib/puppet/provider/vcsrepo/svn.rb
debug: Reloading svn vcsrepo provider
info: Loading downloaded plugin 
/var/lib/puppet/lib/puppet/provider/vcsrepo/git.rb
debug: Reloading git vcsrepo provider
info: Loading downloaded plugin 
/var/lib/puppet/lib/puppet/provider/vcsrepo/cvs.rb
debug: Reloading cvs vcsrepo provider
info: Loading downloaded plugin 
/var/lib/puppet/lib/puppet/provider/vcsrepo/hg.rb
debug: Reloading hg vcsrepo provider
info: Loading downloaded plugin 
/var/lib/puppet/lib/puppet/provider/vcsrepo/bzr.rb
debug: Reloading bzr vcsrepo provider
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/type/vcsrepo.rb
info: Redefining vcsrepo in Puppet::Type
info: Loading downloaded plugin /var/lib/puppet/lib/puppet/provider/vcsrepo.rb
info: Loading facts in blah
info: Loading facts in blah
debug: catalog supports formats: b64_zlib_yaml dot marshal pson raw yaml; using 
pson
info: Caching catalog for puppetclient
debug: Using cached certificate for ca
debug: Using cached certificate for puppetclient
debug: Using cached certificate_revocation_list for ca
debug: Value of 'preferred_serialization_format' (pson) is invalid for report, 
using default (b64_zlib_yaml)
debug: report supports formats: b64_zlib_yaml marshal raw yaml; using 
b64_zlib_yaml
err: Could not run Puppet configuration client: Invalid parameter provider at 
/etc/puppet/manifests/site.pp:24
</pre>

it fails with the invalid parameter message, but if I execute puppetd again, it 
works:

<pre>
# puppetd -td
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does 
not exist
debug: Puppet::Type::User::ProviderUser_role_add: file roledel does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting false
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows 
is missing
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/certs/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/private_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/run/puppet/agent.pid]: Autorequiring File[/var/run/puppet]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/reports]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring 
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring 
File[/var/lib/puppet/state]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/state/classes.txt]: Autorequiring 
File[/var/lib/puppet/state]
debug: Finishing transaction -606463728
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/reports]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring 
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys/puppetclient.pem]: Autorequiring 
File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: Finishing transaction -607435628
debug: Using cached certificate for ca
debug: Using cached certificate for puppetclient
debug: Finishing transaction -607671498
debug: Loaded state in 0.00 seconds
info: Retrieving plugin
debug: Loaded state in 0.00 seconds
debug: Using cached certificate for ca
debug: Using cached certificate for puppetclient
debug: Using cached certificate_revocation_list for ca
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; 
using pson
info: /File[/var/lib/puppet/lib]: Storing newly-audited value  for content
info: /File[/var/lib/puppet/lib/facter]: Storing newly-audited value  for 
content
debug: Finishing transaction -607774148
debug: Storing state
debug: Stored state in 0.03 seconds
info: Loading facts in blah
info: Loading facts in blah
debug: catalog supports formats: b64_zlib_yaml dot marshal pson raw yaml; using 
pson
info: Caching catalog for puppetclient
debug: Puppet::Type::Vcsrepo::ProviderHg: file hg does not exist
debug: Puppet::Type::Vcsrepo::ProviderCvs: file cvs does not exist
debug: Puppet::Type::Vcsrepo::ProviderSvn: file svn does not exist
debug: Puppet::Type::Vcsrepo::ProviderBzr: file bzr does not exist
debug: Creating default schedules
debug: Loaded state in 0.00 seconds
debug: /Stage[main]//Node[puppetclient]/Notify[test123]/require: requires 
Vcsrepo[/usr/local/dev/repo]
info: Applying configuration version '1280516948'
debug: Puppet::Type::Vcsrepo::ProviderGit: Executing '/usr/bin/git init'
notice: /Stage[main]//Node[puppetclient]/Vcsrepo[/usr/local/dev/repo]/ensure: 
created
debug: Finishing transaction -607242698
debug: Storing state
debug: Stored state in 0.02 seconds
notice: Finished catalog run in 0.10 seconds
debug: Using cached certificate for ca
debug: Using cached certificate for puppetclient
debug: Using cached certificate_revocation_list for ca
debug: Value of 'preferred_serialization_format' (pson) is invalid for report, 
using default (b64_zlib_yaml)
debug: report supports formats: b64_zlib_yaml marshal raw yaml; using 
b64_zlib_yaml
</pre>



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to