summaryrefslogtreecommitdiffstats
path: root/manifests
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2014-03-12 09:52:28 -0400
committerJames Shubin <james@shubin.ca>2014-03-16 22:39:08 -0400
commitfbe9e9cb4bd8cc4278eba8e16bc69f009f334d7a (patch)
tree59e93584ca9e1be4182c5c488faf56aa175404cb /manifests
parent7102088482559af60549fcce6194d3365c0605ad (diff)
downloadpuppet-gluster-fbe9e9cb4bd8cc4278eba8e16bc69f009f334d7a.tar.gz
puppet-gluster-fbe9e9cb4bd8cc4278eba8e16bc69f009f334d7a.tar.xz
puppet-gluster-fbe9e9cb4bd8cc4278eba8e16bc69f009f334d7a.zip
Improve brick count input and parsing.
Diffstat (limited to 'manifests')
-rw-r--r--manifests/simple.pp12
1 files changed, 6 insertions, 6 deletions
diff --git a/manifests/simple.pp b/manifests/simple.pp
index dbd43ed..0fa75da 100644
--- a/manifests/simple.pp
+++ b/manifests/simple.pp
@@ -129,21 +129,21 @@ class gluster::simple(
if has_key($brick_params, "${::fqdn}") {
# here some wizardry happens...
$brick_params_list = $brick_params["${::fqdn}"]
- $valid_count = $count ? {
- 0 => inline_template('<%= @brick_params_list.length %>'),
+ $valid_count = "${count}" ? {
+ '0' => inline_template('<%= @brick_params_list.length %>'),
default => $count,
}
validate_array($brick_params_list)
$yaml = inline_template("<%= (0..@valid_count.to_i-1).inject(Hash.new) { |h,i| {'${::fqdn}:${valid_path}brick' + (i+1).to_s.rjust(7, '0') + '/' => ((i < @brick_params_list.length) ? @brick_params_list[i] : {})}.merge(h) }.to_yaml %>")
} else {
# here we base our brick list on the $count variable alone...
- $valid_count = $count ? {
- 0 => 1, # 0 means undefined, so use the default
+ $valid_count = "${count}" ? {
+ '0' => 1, # 0 means undefined, so use the default
default => $count,
}
- $brick_params_list = $valid_count ? {
+ $brick_params_list = "${valid_count}" ? {
# TODO: should we use the same pattern for 1 or many ?
- 1 => ["${::fqdn}:${valid_path}"],
+ '1' => ["${::fqdn}:${valid_path}"],
default => split(inline_template("<%= (1..@valid_count.to_i).collect{|i| '${::fqdn}:${valid_path}brick' + i.to_s.rjust(7, '0') + '/' }.join(',') %>"), ','),
}
$yaml = inline_template("<%= (0..@valid_count.to_i-1).inject(Hash.new) { |h,i| {@brick_params_list[i] => {}}.merge(h) }.to_yaml %>")