On Nov 15, 2012 9:20 PM, "Jonathan Gazeley" <[email protected]> wrote: > > On 15/11/12 11:11, David Schmitt wrote: >> >> On 15.11.2012 10:44, Jonathan Gazeley wrote: >>> >>> On 14/11/12 20:44, Peter Brown wrote: >>>> >>>> >>>> From what the error is telling me it is trying to fine a define called >>>> firewallrule but your define is actually called firewall... >>> >>> >>> Sorry, my mistake. The file that contains the define is called >>> firewall.pp, the define is called firewall and the way I am calling is >>> called firewall. The error message I pasted was from an experiment >>> renaming everything to firewallrule because I wondered if firewall was a >>> reserved word. >>> >>> The issue stands - with no mention of firewallrule I still get the same >>> problem. >> >> >> Please answer the other questions from Peter's mail: >> >> >>> Where are you including the define from? >>> Is it in it's own file in a module? or it it in site.pp or somesuch >>> global file? >>> If it's in it's own module the file will need to be called the same as >>> the define. >>> >> >> >> Especially if it is in a module, it will have to be called >> modulename::firewall. >> >> >> Or, if the module is called firewall, you might be able to put the >> firewall define into the init.pp and have it loaded from there. This >> works fine with classes, I've not tried that with defines yet. > > > Thanks David. The module is called "firewall" and the class "firewall" appears in init.pp. The define "firewall" simply appears within the class "firewall". > > # init.pp > class firewall { > define firewall($source, $port, $proto) { > > case $operatingsystem { > /Centos|Fedora|Scientific|Debian/: { > iptables { $title: > proto => $proto, > dport => $port, > source => $source, > jump => "ACCEPT", > } > } > /Ubuntu/: { > ufw::allow { $title: > port => $port, > from => $source, > proto => $proto, > } > } > } > } > } > > I'm a little bit confused on how classes, modules defines and filenames fit together.
Yeah there is your problem. Like david mentioned if the define is in a module you will need to call it via firewall::firewall. > > Thanks, > Jonathan > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" 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-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" 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-users?hl=en.
