+1 vote
1 view
in DevOps and Agile by (30k points)
I am getting error while executing puppet script on Puppet master site.pp file I wrote following code

node default {

class t {
package {'apache2':
ensure => installed,

On Slave machine when i execute it
puppet agent --test
it throws the error 
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not parse for environment production: Classes, definitions, and nodes may only appear at toplevel or inside other classes (file: /etc/puppet/code/environments/production/manifests/site.pp, line: 3, column: 1) on node slave.ec2.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Can you please help me in this regard

1 Answer

0 votes
by (51.2k points)

Seems like you're mixing environment (agent is running under production environment, but your module is placed under development environment), copy your module under /etc/puppetlabs/code/environments/production/modules (as seen below) and test again.

cp -r /etc/puppetlabs/code/environments/development/modules/motd /etc/puppetlabs/code/environments/production/modules/

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !