1

I’m quite new to devops/ci/cd, so bear with me.

Currently, I’m getting a puppet manifest configuration set up for docker image verification. Let me try to layout it out:

I have a puppet master server with the following configuration:

  • Puppetmaster version: 5.5.10-4ubuntu3
  • Both of the servers are linux 20.04
  • All hosted on AWS

/etc/puppet/code/environments/production/manifests/site.pp

node default {
    include 'docker'
    docker::image { 'jorgemauriciodev/ubuntu-dockerfile-dev-v1': }
}

Every time I try a new verification command in the .pp, I restart the puppet master server with the following command: sudo systemctl restart puppet-master

I’ve installed a module called garethr-docker on both of my servers – the agent and the master.

On the slave / agent server, I have this image docker image present and running: jorgemauriciodev/ubuntu-dockerfile-dev-v1 For the first step, I just want to check if the image exists in my slave server. Later on, I’ll figure out to make sure it’s running or built with the Dockerfile.

On the slave / agent server, I run: sudo puppet agent –test

And I receive the following error message:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::docker for ip-123-123-123-123.us-east-2.compute.internal (file: /etc/puppet/code/environments/production/manifests/site.pp, line: 2, column: 5) on node ip-123-123-123-123.us-east-2.compute.internal Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Anyone has any idea on what I’m getting wrong with the puppet manifest file?

Edit 1:

I did some changes that were suggested. Now, my file has a diferent name and changed the content: /etc/puppet/code/environments/production/manifests/init.pp

include 'docker'
class { 'docker':
  version => 'latest',
}
docker::image { 'jorgemauriciodev/ubuntu-dockerfile-dev-v1': }

Still returns me that same error message.

Here´s the full message:

/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Retrieving plugin
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Retrieving locales
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::docker for ip-172-31-21-116.us-east-2.compute.internal (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 1, column: 1) on node ip-172-31-21-116.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
/usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0

Edit 2:

I installed further modules on master server and slave/agent server with this command:

sudo puppet module install puppetlabs-docker --version 4.1.2

And it´s still returning me an error message, but now seems that it´s a different one. So, probably a syntax issue now.

Here´s the important part of the message.

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Docker] is already declared; cannot redeclare (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 3) (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 3, column: 1) on node ip-123-123-123-123.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Besides this message, it´s still returning me those warnings, but the list is much bigger. However, I don´t think it´s a concern at this time.

1 Answer 1

0

Error 500 in puppet means bad written code, can you pls share the whole config(init.pp) and I can tell you from there.

class { 'docker':
  version => 'latest',
}

docker::image { 'jorgemauriciodev/ubuntu-dockerfile-dev-v1': }

More information is available here: https://forge.puppet.com/modules/puppetlabs/docker

11
  • Ok. That´s the full file. Alright, then. I´ll change the name of the file and check it that´s it. should it be in the path that I put? Feb 27, 2022 at 23:40
  • usually is this /etc/puppetlabs/code/environments/production/manifests/init.pp Feb 27, 2022 at 23:51
  • Please look at the answer. This is how it should be written, try copy/paste it and file is not needed to be exactly init.pp in your case, sorry my bad. Feb 28, 2022 at 0:06
  • thanks for the help. I did exactly as you posted, restarted puppet master server, ran sudo puppet agent --test and still getting the same error. I´m not sure if I installed the module garethr-docker right. I used this CMD: sudo puppet module install garethr-docker. I should install it on the master o slave? And is there a way for me to check if I installed it right? Or is there anything else missing? Feb 28, 2022 at 0:16
  • 1
    Worked! Thanks a million! Feb 28, 2022 at 2:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .