summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2013-12-31 19:22:00 -0500
committerJames Shubin <james@shubin.ca>2013-12-31 19:22:00 -0500
commitf646fd61a6cf6474fb622285c26f66d637af716a (patch)
tree8ebd8d7634f7d68a31caef74e872ace9be3f9067
parentf533720ebe319a8120e9bbd8e1ef765fb7bf929f (diff)
downloadpuppet-gluster-f646fd61a6cf6474fb622285c26f66d637af716a.tar.gz
puppet-gluster-f646fd61a6cf6474fb622285c26f66d637af716a.tar.xz
puppet-gluster-f646fd61a6cf6474fb622285c26f66d637af716a.zip
The volume create script shouldn't depend on VIP existence.
* If VIP comes and goes, the create script gets added/deleted too. * If VIP isn't present on first run (it usually isn't) then the Exec['again'] won't get run because it's inside the VIP check. * This also consolidates the two identical conditional blocks.
-rw-r--r--manifests/volume.pp35
1 files changed, 16 insertions, 19 deletions
diff --git a/manifests/volume.pp b/manifests/volume.pp
index 8fa6e2c..013915a 100644
--- a/manifests/volume.pp
+++ b/manifests/volume.pp
@@ -212,25 +212,25 @@ define gluster::volume(
],
}
+ # store command in a separate file to run as bash...
+ # NOTE: we sleep for 5 seconds to give glusterd a chance to
+ # settle down first if we're doing a hot (clean) puppet run
+ file { "${vardir}/volume/create-${name}.sh":
+ content => inline_template("#!/bin/bash\n/bin/sleep 5s && /usr/sbin/gluster volume create ${name} ${valid_replica}${valid_stripe}transport ${valid_transport} ${brick_spec} > >(/usr/bin/tee '/tmp/gluster-volume-create-${name}.stdout') 2> >(/usr/bin/tee '/tmp/gluster-volume-create-${name}.stderr' >&2) || (${rmdir_volume_dirs} && /bin/false)\nexit \$?\n"),
+ owner => root,
+ 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/"],
+ }
+
# run if vip not defined (bypass mode) or if vip exists on this machine
if ("${valid_vip}" == '' or "${vipif}" != '') {
- # store command in a separate file to run as bash...
- # NOTE: we sleep for 5 seconds to give glusterd a chance to
- # settle down first if we're doing a hot (clean) puppet run
- file { "${vardir}/volume/create-${name}.sh":
- content => inline_template("#!/bin/bash\n/bin/sleep 5s && /usr/sbin/gluster volume create ${name} ${valid_replica}${valid_stripe}transport ${valid_transport} ${brick_spec} > >(/usr/bin/tee '/tmp/gluster-volume-create-${name}.stdout') 2> >(/usr/bin/tee '/tmp/gluster-volume-create-${name}.stderr' >&2) || (${rmdir_volume_dirs} && /bin/false)\nexit \$?\n"),
- owner => root,
- 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/"],
- }
-
# NOTE: This should only happen on one host!
# NOTE: There's maybe a theoretical race condition if this runs
# at exactly the same time on more than one host. That's why it
@@ -256,10 +256,7 @@ define gluster::volume(
alias => "gluster-volume-create-${name}",
}
}
- }
- # run if vip not defined (by pass mode) or vip exists on this machine
- if ("${valid_vip}" == '' or "${vipif}" != '') {
if $start == true {
# try to start volume if stopped
exec { "/usr/sbin/gluster volume start ${name}":