Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Make Exec['again'] optional. As a result puppet-common is optional.
Browse files Browse the repository at this point in the history
Although if you remove all the features, it's not as awesome anymore :)
  • Loading branch information
purpleidea committed Apr 10, 2014
1 parent c1e6e03 commit b5e8342
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.
9 changes: 9 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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).
Expand Down
10 changes: 8 additions & 2 deletions manifests/brick.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
$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
Expand Down Expand Up @@ -405,7 +408,10 @@
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/"],
}
Expand Down
13 changes: 6 additions & 7 deletions manifests/simple.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$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
Expand Down Expand Up @@ -66,13 +67,10 @@

# 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!!
Expand Down Expand Up @@ -175,6 +173,7 @@
bricks => true, # automatic brick collection...
ping => $ping,
start => true,
again => $again,
}
Gluster::Volume <<||>>

Expand Down
25 changes: 20 additions & 5 deletions manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
$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 {
Expand Down Expand Up @@ -230,7 +233,10 @@
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
Expand All @@ -254,7 +260,10 @@
# 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/"],
}

Expand Down Expand Up @@ -295,7 +304,10 @@
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,
Expand Down Expand Up @@ -411,7 +423,10 @@
# 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
Expand Down
Binary file modified puppet-gluster-documentation.pdf
Binary file not shown.

0 comments on commit b5e8342

Please sign in to comment.