Error Could not find declared class firewall at etc puppetlabs code environments production manifests site pp

0 votes

On running  run /opt/puppetlabs/bin/puppet agent --test on my node I get the above error. as shown:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Error while evaluating a Resource Statement. Could not find declared class firewall at /etc/puppetlabs/code/environments/production/manifests/site.pp:7:1 on node mark-inspiron.

I have written a firewall module. the file section works but bot the firewall. Can somebody please help?

Here's my site.pp

file {'/tmp/it_works.txt':                        # resource type file and filename
  ensure  => present,                             # make sure it exists
  mode    => '0644',                              # file permissions
  content => "It works on ${ipaddress_eth0}!\n",  # Print the eth0 IP fact
}

class { 'firewall': }

resources { 'firewall':
    purge => true,
}

firewall { "051 asterisk-set-rate-limit-register":
    string      => "REGISTER sip:",
    string_algo => "bm",
    dport       => '5060',
    proto       => 'udp',
    recent      => 'set',
    rname       => 'VOIPREGISTER',
    rsource     => 'true';
}
firewall { "052 asterisk-drop-rate-limit-register":
    string      => "REGISTER sip:",
    string_algo => "bm",
    dport       => '5060',
    proto       => 'udp',
    action      => 'drop',
    recent      => 'update',
    rseconds    => '600',
    rhitcount   => '5',
    rname       => 'VOIPREGISTER',
    rsource     => true,
    rttl        => true;
}
Aug 5, 2019 in Puppet by Shreya
966 views

1 answer to this question.

0 votes

The modules that you install on master need to be somewhere in your modulepath. You can either place it in the modules directory within your $codedir (normally /etc/puppetlabs/code/modules) or in your directory environment modules directory (likely /etc/puppetlabs/code/environments/production/modules in your case since your cited site.pp is there). you could also define some additional module paths in your environment.conf, and place those modules there.

There are many ways through which you can deploy those methods like r10k,code manager etc,but the easiest of them is to install puppetlabs-firewall  module.This will ensure that catalog will find it while compiling.

also note, that:

resources { 'firewall':
  purge => true,
}

will remove any changes to associated firewall configurations that are not managed by Puppet. 

answered Aug 5, 2019 by Sirajul
• 59,050 points

Related Questions In Puppet

0 votes
1 answer

Puppet: Error: Could not parse for environment production: Syntax error at '='; expected '}'

This error occurs if puppet apply -e is used ...READ MORE

answered Aug 1, 2019 in Puppet by Sirajul
• 59,050 points
1,478 views
0 votes
1 answer
0 votes
1 answer

Error saying "Error: Could not parse for environment production" - Puppet

Hey @Nagya, You need to set the ...READ MORE

answered Feb 15, 2019 in Puppet by Kavya
1,010 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,066 views
+2 votes
1 answer
0 votes
1 answer

Error: Could not find class git::config for xxxx on node xxxx

You should note that you cannot call include on git::config. git::config is a ...READ MORE

answered Jul 31, 2019 in Puppet by Sirajul
• 59,050 points
313 views