Thank you all. Updated the module and now works without the import:

https://github.com/belminf/puppet-iptables

On Jan 9, 8:51 am, jcbollinger <john.bollin...@stjude.org> wrote:
> On Jan 6, 9:10 pm, bel <belm...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > I am working on this module:
>
> >https://github.com/belminf/puppet-iptables
>
> > I have this defined resource:
>
> > define iptables::hole ($proto='tcp', $port, $source=undef) {
> >     firewall { "100 input: $name":
> >       chain => 'INPUT',
> >       proto => $proto,
> >       dport => $port,
> >       source => $source,
> >       action => 'accept',
> >     }
>
> > }
>
> > I want it to notify an `exec`. However, the only way I could make this work
> > is if I make the `exec` in the global scope (i.e., importing in site.pp).
> > Otherwise, if I define the `exec` resource and do `require =>
> > Exec['persist-iptables']`, when the `iptables::hole` resource is defined,
> > it cannot find the `exec` resource.
>
> > Can someone help me re-factor this so it doesn't require an import? You are
> > more than welcomed to modify the code on github.
>
> ALL Puppet resources have global scope.  Very likely either your
> target exec is not in a class, or you do not ensure that its class is
> included before you try to reference it.  Here is one way that will
> work:
>
> iptables/persist.pp:
> ---------------------------
> class iptables::persistance {
>     exec { 'persist-iptables':
>         # ...
>     }
>
> }
>
> iptables/hole.pp:
> ------------------------
> define iptables::hole ($proto='tcp', $port, $source=undef) {
>     include 'iptables::persistance'
>     firewall { "100 input: $name":
>       # ...
>       notify => Exec[''persist-iptables']
>     }
>
> }
>
> John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to