forked from nfagerlund/evil-made-manifest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhiera_interpolation.pp
56 lines (40 loc) · 1.86 KB
/
hiera_interpolation.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Can hiera read keys from hashes and stuff when it rec's non-string vars in its scope?
# NOPE, debug output says it found it, but then it just fuckin hangs.
# Tried w/ several forms of quoting and not quoting.
# 13 hashmember: %{"myhash['firstkey']"}
# 14 arraymember: %{myarray[1]}
# What happens when you interpolate something other than a string?
# Resource reference:
# Error: can't convert Puppet::Resource into String at /Users/nick/Documents/manifests/hiera_interpolation.pp:15 on node magpie.lan
# Wrapped exception:
# can't convert Puppet::Resource into String
# Error: can't convert Puppet::Resource into String at /Users/nick/Documents/manifests/hiera_interpolation.pp:15 on node magpie.lan
# Number: works fine.
# Bool:
# Error: can't convert true into String at /Users/nick/Documents/manifests/hiera_interpolation.pp:26 on node magpie.lan
# Wrapped exception:
# can't convert true into String
# Error: can't convert true into String at /Users/nick/Documents/manifests/hiera_interpolation.pp:26 on node magpie.lan
# Undef:
# Error: can't convert Symbol into String at /Users/nick/Documents/manifests/hiera_interpolation.pp:31 on node magpie.lan
# Wrapped exception:
# can't convert Symbol into String
# Error: can't convert Symbol into String at /Users/nick/Documents/manifests/hiera_interpolation.pp:31 on node magpie.lan
# Complete array or hash:
# Totally predictable blow-up.
# Okay, the converse -- what happens when Hiera returns something odd?
# Bools
# Handled just fine
# Numbers
# Handled just fine.
# Arrays
# come to think of it I've already tested all that.
# Symbols
# Fail totally.
# $myhash = { firstkey => 'firstvalue', secondkey => 'secondvalue' }
# $myarray = ['first', 'second']
# notice( hiera( arraymember ) )
# notice( $myhash['secondkey'] )
$arbitrary_type = [one, two]
notice( spew( hiera( odd_thing ) ) )
notice( hiera( odd_thing ) )