From 7057c914942eb0fdfd061ad227a5c5ac255d296d Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sat, 8 Mar 2014 01:19:01 -0500 Subject: Small fixes to avoid warnings. --- manifests/simple.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'manifests/simple.pp') diff --git a/manifests/simple.pp b/manifests/simple.pp index 60e6ae4..7a48790 100644 --- a/manifests/simple.pp +++ b/manifests/simple.pp @@ -121,13 +121,13 @@ class gluster::simple( validate_re("${count}", '^\d+$') # ensure this is a positive int 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 %>'), + 0 => inline_template('<%= @brick_params_list.length %>'), default => $count, } - $brick_params_list = $brick_params["${::fqdn}"] 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 %>") + $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 ? { @@ -137,9 +137,9 @@ class gluster::simple( $brick_params_list = $valid_count ? { # TODO: should we use the same pattern for 1 or many ? 1 => ["${::fqdn}:${valid_path}"], - default => split(inline_template("<%= (1..${valid_count}).collect{|i| '${::fqdn}:${valid_path}brick' + i.to_s.rjust(7, '0') + '/' }.join(',') %>"), ','), + 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 %>") + $yaml = inline_template("<%= (0..@valid_count.to_i-1).inject(Hash.new) { |h,i| {@brick_params_list[i] => {}}.merge(h) }.to_yaml %>") } $hash = parseyaml($yaml) -- cgit