Ask Your Question
2

"Could not find declared class" in development environment

asked 2014-07-18 05:16:55 -0500

PuppetGossin gravatar image

updated 2014-07-20 00:53:32 -0500

Hi, runnning puppet 3.4.3 on ubuntu 14.04, and have a setup with a production and a development environment, which are identical (except a few spec files):

# diff -u -r /etc/puppet/environments/development/modules /etc/puppet/environments/production/modules
Only in /etc/puppet/environments/development/modules/apt/spec: fixtures
Only in /etc/puppet/environments/development/modules/epel/spec: fixtures
Only in /etc/puppet/environments/development/modules/erlang/spec: fixtures
Only in /etc/puppet/environments/development/modules/rabbitmq/spec: fixtures
Only in /etc/puppet/environments/development/modules/staging/spec/fixtures: manifests
Only in /etc/puppet/environments/development/modules/staging/spec/fixtures: modules
Only in /etc/puppet/environments/development/modules/stdlib/spec/fixtures: modules
# diff -u -r /etc/puppet/environments/development/manifests /etc/puppet/environments/production/manifests
#

However when I run a client using production (puppet agent -t) there are no errors and the config is applied, but if I connect to the development environment I get an error:

# puppet agent --test --environment=development
Info: Retrieving plugin
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/rabbitmq_erlang_cookie.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/staging_windir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/staging_http_get.rb
Info: Loading facts in /var/lib/puppet/lib/facter/os_maj_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class ::ntp at /etc/puppet/environments/development/manifests/site.pp:7 on node chiles.skyhigh
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
#

If I --no-daemonize --debug the server, the same error is printed when I use the development environment instead of the following lines which are printed when I use production environments:

Debug: importing '/etc/puppet/environments/production/modules/ntp/manifests/init.pp' in environment production
Debug: Automatically imported ntp from ntp into production
Debug: importing '/etc/puppet/environments/production/modules/ntp/manifests/params.pp' in environment production
Debug: Automatically imported ntp::params from ntp/params into production

this happened after upgrading the ntp module. What I cant figure out is that the two environments are identical (except for the spec files shown above) but still the development environment does not seem to compile

any help greatly appreciated

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-08-07 07:31:35 -0500

PuppetGossin gravatar image

OK, finally fixed the problem myself with some good help from a colleauge, the source of the problem was that I had done a chmod -R 644 in the ntp module dir, and this of course does not show with the diff :)

(btw, if you do this in a module you will just get a "Error 400 on SERVER: Permission denied" when the agent contacts the puppetmaster and this is a good error message, but the problem is if you restart the puppetmaster, then the error becomes "Error 400 on SERVER: Puppet::Parser::AST::Resource failed ..." which is much harder to trace back to a permission problem)

A forced reinstall of the module fixed the problem:

puppet module install --force  puppetlabs-ntp --environment=development
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-07-18 05:16:55 -0500

Seen: 6,725 times

Last updated: Aug 07 '14