From efea94608a3a23275ec540257a6ff0607150b8dc Mon Sep 17 00:00:00 2001 From: Benjamin Merot Date: Tue, 5 Jan 2016 11:57:15 +0100 Subject: [PATCH] Adding checks for setup from scratch As discussed in https://github.com/voxpupuli/puppet-gluster/pull/24#issuecomment-158412322 extra check added to handle creation of volumes from scratch on a Gluster pool. --- manifests/volume.pp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/volume.pp b/manifests/volume.pp index 33cb8617..89235cf8 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -102,13 +102,19 @@ if $binary{ # we need the Gluster binary to do anything! + if $::gluster_peer_list != undef and $::gluster_volume_list != undef { + $minimal_requirements = true + } else { + $minimal_requirements = false + } + if $::gluster_volume_list != undef and member( split( $::gluster_volume_list, ',' ), $title ) { $already_exists = true } else { $already_exists = false } - if $already_exists == false { + if $minimal_requirements and $already_exists == false { # this volume has not yet been created # before we can create it, we need to ensure that all the @@ -167,7 +173,7 @@ } } - } else { + } elsif $already_exists { # this volume exists # our fact lists bricks comma-separated, but we need an array