summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2013-12-23 16:47:04 -0500
committerJames Shubin <james@shubin.ca>2013-12-24 06:42:57 -0500
commit680a7878af062decc9924dd49fe295e545b527ae (patch)
tree0e87391768dcd9c58993fe806446cd7f86322b36
parenta28e8e4507f70777fd896f7b66ec55eb4181da6d (diff)
downloadpuppet-gluster-680a7878af062decc9924dd49fe295e545b527ae.tar.gz
puppet-gluster-680a7878af062decc9924dd49fe295e545b527ae.tar.xz
puppet-gluster-680a7878af062decc9924dd49fe295e545b527ae.zip
Added preliminary Exec['again'] support to puppet-gluster.
* This will make magic things happen faster. * This doesn't give you an option to disable it. * This doesn't let you set the timeout. * This isn't necessarily complete. There might be more notify's needed.
-rw-r--r--manifests/again.pp39
-rw-r--r--manifests/volume.pp13
2 files changed, 51 insertions, 1 deletions
diff --git a/manifests/again.pp b/manifests/again.pp
new file mode 100644
index 0000000..63ee8d1
--- /dev/null
+++ b/manifests/again.pp
@@ -0,0 +1,39 @@
+# GlusterFS module by James
+# Copyright (C) 2012-2013+ James Shubin
+# Written by James Shubin <james@shubin.ca>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# NOTE: use with:
+# notify => Common::Again::Delta['gluster-exec-again'],
+
+# NOTE: this should be attached to the logical (often last) thing that, when it
+# runs, means or is a signal that something more is going to happen in the next
+# puppet run, and that stuff that is going to happen is useful to what just did
+# run, which is why we don't want to wait for it to happen naturally in 30 min.
+
+class gluster::again {
+
+ # TODO: we could include an option to disable this exec again and
+ # replace it with a "dummy" noop if someone doesn't want to use it.
+ include common::again
+
+ # when notified, this will run puppet again, delta sec after it ends!
+ common::again::delta { 'gluster-exec-again':
+ delta => 120, # 2 minutes
+ }
+
+}
+
+# vim: ts=8
diff --git a/manifests/volume.pp b/manifests/volume.pp
index d16db55..296849d 100644
--- a/manifests/volume.pp
+++ b/manifests/volume.pp
@@ -27,6 +27,7 @@ define gluster::volume(
$start = undef # start volume ? true, false (stop it) or undef
) {
include gluster::xml
+ include gluster::again
include gluster::vardir
include gluster::volume::base
if $ping {
@@ -36,6 +37,8 @@ define gluster::volume(
#$vardir = $::gluster::vardir::module_vardir # with trailing slash
$vardir = regsubst($::gluster::vardir::module_vardir, '\/$', '')
+ $shorewall = $::gluster::server::shorewall
+
$settle_count = 3 # three is a reasonable default!
$maxlength = 3
if $maxlength < $settle_count {
@@ -221,6 +224,10 @@ define gluster::volume(
group => root,
mode => 755,
ensure => present,
+ # this notify is the first to kick off the 2nd step! it
+ # was put here after a process of elimination, and this
+ # location makes a lot of sense: on change exec[again]!
+ notify => Common::Again::Delta['gluster-exec-again'],
require => File["${vardir}/volume/"],
}
@@ -259,6 +266,10 @@ define gluster::volume(
logoutput => on_failure,
onlyif => "/usr/sbin/gluster volume list | /bin/grep -qxF '${name}' -",
unless => "/usr/sbin/gluster volume status ${name}", # returns false if stopped
+ notify => $shorewall ? {
+ false => undef,
+ default => Common::Again::Delta['gluster-exec-again'],
+ },
require => $settled ? { # require if type exists
false => undef,
default => Exec["gluster-volume-create-${name}"],
@@ -286,7 +297,6 @@ define gluster::volume(
}
}
- $shorewall = $::gluster::server::shorewall
if $shorewall {
$zone = $::gluster::server::zone # firewall zone
@@ -367,6 +377,7 @@ define gluster::volume(
# difference to record, or the sequence hasn't settled
# we also check that we have our minimum settle count!
onlyif => "/usr/bin/test ! -e '${watchfile}' || ${diff} || /usr/bin/test '1' != '${one}' || /usr/bin/test ${watch_trim_size} -lt ${settle_count}",
+ notify => Common::Again::Delta['gluster-exec-again'],
require => [
File["${vardir}/volume/fsm/${name}/"],
# easy way to ensure the transition types don't need to