-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfuture_41_optional_notundef_pup-4483.pp
30 lines (24 loc) · 1.31 KB
/
future_41_optional_notundef_pup-4483.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
notice( spew( Optional[String] ))
# 4.0.0: Notice: Scope(Class[main]): [Puppet::Pops::Types::POptionalType]
# [Puppet::Pops::Types::POptionalType]
notice( spew( Optional["hi i'm a string"] ))
# 4.0.0: Error: Evaluation Error: Optional-Type[] arguments must be types. Got String at /Users/nick/Documents/manifests/future_41_optional_notundef_struct_pup-4483.pp:5:24 on node magpie.lan
# 4.1.0: Error: Evaluation Error: Optional-Type[] arguments must be types. Got String at /Users/nick/Documents/manifests/future_41_optional_notundef_struct_pup-4483.pp:5:24 on node magpie.lan
# 4.1.0 at 615843e1a:
# Notice: Scope(Class[main]): [Puppet::Pops::Types::POptionalType]
# [Puppet::Pops::Types::POptionalType]
notice( spew( NotUndef[String] ))
# 4.1.0: Notice: Scope(Class[main]): [Puppet::Pops::Types::PNotUndefType]
# [Puppet::Pops::Types::PNotUndefType]
notice( spew( NotUndef["hi i'm a string"] ))
# 4.1.0: Notice: Scope(Class[main]): [Puppet::Pops::Types::PNotUndefType]
# [Puppet::Pops::Types::PNotUndefType]
# Henrik's example showing that default values from defined types are actually relevant... it's just that defines are lazily evaluated, so you would have to access them from ANOTHER define.
define foo($bar=20) {
notice "bar is $bar"
}
define display {
notify {y: message => "foo[bar] = ${Foo[x][bar]}"}
}
foo{x: }
display{y: }