Skip to content
Browse files

Fix the main exec for ipset

  • Loading branch information...
1 parent 56f2012 commit e6dd17c9e0686732b2dd259d7bcc3a6c16c6c633 @thias committed
Showing with 20 additions and 5 deletions.
  1. +3 −0 modules/ipset/ChangeLog
  2. +1 −1 modules/ipset/Modulefile
  3. +16 −4 modules/ipset/manifests/init.pp
View
3 modules/ipset/ChangeLog
@@ -1,3 +1,6 @@
+2012-04-25 - 0.0.2
+* Fix the main exec, since mixing "unless" and "subscribe" wasn't working.
+
2012-04-24 - 0.0.1
* Initial module release.
View
2 modules/ipset/Modulefile
@@ -1,5 +1,5 @@
name 'thias-ipset'
-version '0.0.1'
+version '0.0.2'
source 'git://github.com/thias/puppet-modules/modules/ipset'
author 'Matthias Saou'
license 'Apache 2.0'
View
20 modules/ipset/manifests/init.pp
@@ -39,12 +39,24 @@
# Run in the from_file mode (the only one implemented initially
if $from_file {
- exec { "ipset-${title}":
- command => "/usr/local/sbin/ipset_from_file -n ${title} -f ${from_file} -t \"${ipset_type}\" -c \"${ipset_create_options}\" -a \"${ipset_add_options}\"",
- # Both : set doesn't exist case *and* IP list changes case
+
+ # We need two execs, one for when the set doesn't exist and the
+ # other when the file changes. It's not possible to mix both
+ # "unless" and "subscribe", as "unless" will prevent the
+ # "subscribe" triggered runs from actually being executed.
+ $command = "/usr/local/sbin/ipset_from_file -n ${title} -f ${from_file} -t \"${ipset_type}\" -c \"${ipset_create_options}\" -a \"${ipset_add_options}\""
+ exec { "ipset-create-${name}":
+ command => $command,
unless => "/usr/sbin/ipset list ${title}",
- subscribe => File[$from_file],
require => Package['ipset'],
+ path => [ '/sbin', '/usr/sbin', '/bin', '/usr/bin' ],
+ }
+ exec { "ipset-refresh-${name}":
+ command => $command,
+ subscribe => File[$from_file],
+ refreshonly => true,
+ require => Package['ipset'],
+ path => [ '/sbin', '/usr/sbin', '/bin', '/usr/bin' ],
}
}

0 comments on commit e6dd17c

Please sign in to comment.
Something went wrong with that request. Please try again.