From b5e83426b9d0af4abff241670bf5a68fdfc265fb Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 10 Apr 2014 16:40:08 -0400 Subject: Make Exec['again'] optional. As a result puppet-common is optional. Although if you remove all the features, it's not as awesome anymore :) --- DOCUMENTATION.md | 9 +++++++++ manifests/brick.pp | 10 ++++++++-- manifests/simple.pp | 13 ++++++------- manifests/volume.pp | 25 ++++++++++++++++++++----- puppet-gluster-documentation.pdf | Bin 226497 -> 227469 bytes 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index a8eea4a..541ff39 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -512,6 +512,9 @@ Whether to use _fping_ or not to help with ensuring the required hosts are available before doing certain types of operations. Optional, but recommended. Boolean value. +####`again` +Do you want to use _Exec['again']_ ? This helps build your cluster quickly! + ####`baseport` Specify the base port option as used in the glusterd.vol file. This is useful if the default port range of GlusterFS conflicts with the ports used for @@ -680,6 +683,9 @@ place to stop this. In general, you probably don't ever want to touch this. Do you want to allow Puppet-Gluster to do dangerous things? You have to set this to _true_ to allow Puppet-Gluster to _fdisk_ and _mkfs_ your file system. +####`again` +Do you want to use _Exec['again']_ ? This helps build your cluster quickly! + ####`comment` Add any comment you want. This is also occasionally used internally to do magic things. @@ -732,6 +738,9 @@ Do we want to include ping checks with _fping_? ####`settle` Do we want to run settle checks? +####`again` +Do you want to use _Exec['again']_ ? This helps build your cluster quickly! + ####`start` Requested state for the volume. Valid values include: _true_ (start), _false_ (stop), or _undef_ (un-managed start/stop state). diff --git a/manifests/brick.pp b/manifests/brick.pp index 2fb3cae..b4c69c5 100644 --- a/manifests/brick.pp +++ b/manifests/brick.pp @@ -36,10 +36,13 @@ define gluster::brick( $xfs_nobarrier = false, $force = false, # if true, this will overwrite any xfs fs it sees, useful for rebuilding gluster and wiping data. NOTE: there are other safeties in place to stop this. $areyousure = false, # do you allow puppet to do dangerous things ? + $again = true, # do we want to use Exec['again'] ? $comment = '' ) { include gluster::brick::base - include gluster::again + if $again { + include gluster::again + } include gluster::vardir #$vardir = $::gluster::vardir::module_vardir # with trailing slash @@ -405,7 +408,10 @@ define gluster::brick( command => '/bin/true', # do nothing but notify logoutput => on_failure, onlyif => "/usr/bin/test -z '${valid_fsuuid}'", - notify => Common::Again::Delta['gluster-exec-again'], + notify => $again ? { + false => undef, + default => Common::Again::Delta['gluster-exec-again'], + }, # this (optional) require makes it more logical require => File["${vardir}/brick/fsuuid/"], } diff --git a/manifests/simple.pp b/manifests/simple.pp index 8686263..1b72df3 100644 --- a/manifests/simple.pp +++ b/manifests/simple.pp @@ -32,6 +32,7 @@ class gluster::simple( $brick_params_defaults = [], # array of hashes to use as brick count $setgroup = '', # pick a volume property group to set, eg: virt $ping = true, # use fping or not? + $again = true, # do we want to use Exec['again'] ? $baseport = '', # specify base port option as used in glusterd.vol file $rpcauthallowinsecure = false, # needed in some setups in glusterd.vol $shorewall = true @@ -66,13 +67,10 @@ class gluster::simple( # if this is a hash, then it's used as the defaults for all the bricks! validate_hash($brick_param_defaults) - # in someone explicitly added this value, then don't overwrite it... - if has_key($brick_param_defaults, 'areyousure') { - $valid_brick_param_defaults = $brick_param_defaults - } else { - $areyousure = {areyousure => true} - $valid_brick_param_defaults = merge($brick_param_defaults, $areyousure) - } + # if someone explicitly added this value, then don't overwrite it... + $areyousure = {'areyousure' => true} + $againhash = {'again' => $again} # pass through the $again value + $valid_brick_param_defaults = merge($areyousure, $againhash, $brick_param_defaults) # if this is an array, then each element is the default for each brick! # if this is an array, then the number of elements is the brick count!! @@ -175,6 +173,7 @@ class gluster::simple( bricks => true, # automatic brick collection... ping => $ping, start => true, + again => $again, } Gluster::Volume <<||>> diff --git a/manifests/volume.pp b/manifests/volume.pp index 218e8ed..ff6a824 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -27,10 +27,13 @@ define gluster::volume( $vip = '', # vip of the cluster (optional but recommended) $ping = true, # do we want to include fping checks ? $settle = true, # do we want to run settle checks ? + $again = true, # do we want to use Exec['again'] ? $start = undef # start volume ? true, false (stop it) or undef ) { include gluster::xml - include gluster::again + if $again { + include gluster::again + } include gluster::vardir include gluster::volume::base if $ping { @@ -230,7 +233,10 @@ define gluster::volume( logoutput => on_failure, unless => "/usr/sbin/gluster volume list | /bin/grep -qxF '${name}' -", # reconnect if it doesn't exist onlyif => sprintf("/usr/sbin/gluster peer status --xml | ${vardir}/xml.py stuck %s", $others), - notify => Common::Again::Delta['gluster-exec-again'], + notify => $again ? { + false => undef, + default => Common::Again::Delta['gluster-exec-again'], + }, require => [ Service['glusterd'], File["${vardir}/xml.py"], # stuck check @@ -254,7 +260,10 @@ define gluster::volume( # 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'], + notify => $again ? { + false => undef, + default => Common::Again::Delta['gluster-exec-again'], + }, require => File["${vardir}/volume/"], } @@ -295,7 +304,10 @@ define gluster::volume( unless => "/usr/sbin/gluster volume status ${name}", # returns false if stopped notify => $shorewall ? { false => undef, - default => Common::Again::Delta['gluster-exec-again'], + default => $again ? { + false => undef, + default => Common::Again::Delta['gluster-exec-again'], + }, }, require => $settled ? { # require if type exists false => undef, @@ -411,7 +423,10 @@ 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'], + notify => $again ? { + false => undef, + default => Common::Again::Delta['gluster-exec-again'], + }, require => [ File["${vardir}/volume/fsm/${name}/"], # easy way to ensure the transition types don't need to diff --git a/puppet-gluster-documentation.pdf b/puppet-gluster-documentation.pdf index ba8ea10..7fcb78a 100644 Binary files a/puppet-gluster-documentation.pdf and b/puppet-gluster-documentation.pdf differ -- cgit