summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions/brick_layout_simple.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/brick_layout_simple.rb')
-rw-r--r--lib/puppet/parser/functions/brick_layout_simple.rb17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/puppet/parser/functions/brick_layout_simple.rb b/lib/puppet/parser/functions/brick_layout_simple.rb
index d91a472..761b58e 100644
--- a/lib/puppet/parser/functions/brick_layout_simple.rb
+++ b/lib/puppet/parser/functions/brick_layout_simple.rb
@@ -34,6 +34,8 @@ module Puppet::Parser::Functions
ENDHEREDOC
+ Puppet::Parser::Functions.function('brick_str_to_hash') # load function
+
# signature: replica, bricks -> bricks
unless args.length == 2
raise Puppet::ParseError, "brick_layout_simple(): wrong number of arguments (#{args.length}; must be 2)"
@@ -52,22 +54,9 @@ module Puppet::Parser::Functions
# TODO: these functions could be in separate puppet files
# eg: Puppet::Parser::Functions.function('myfunc')
# function_myfunc(...)
- def brick_str_to_hash(bricks)
- # this loop converts brick strings to brick dict's...
- result = []
- bricks.each do |x|
- a = x.split(':')
- #assert a.length == 2 # TODO
- p = a[1]
- p = ((p[-1, 1] == '/') ? p : (p+'/')) # endswith
-
- result.push({'host'=> a[0], 'path'=> p})
- end
- return result
- end
collect = {}
- parsed = brick_str_to_hash(bricks)
+ parsed = function_brick_str_to_hash([bricks])
parsed.each do |x|
key = x['host']
val = x['path']