Last change
on this file since 30960 was 30960, checked in by davidb, 7 years ago |
Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster
|
File size:
814 bytes
|
Line | |
---|
1 | # Returns the type when passed a value.
|
---|
2 | #
|
---|
3 | # @example how to compare values' types
|
---|
4 | # # compare the types of two values
|
---|
5 | # if type_of($first_value) != type_of($second_value) { fail("first_value and second_value are different types") }
|
---|
6 | # @example how to compare against an abstract type
|
---|
7 | # unless type_of($first_value) <= Numeric { fail("first_value must be Numeric") }
|
---|
8 | # unless type_of{$first_value) <= Collection[1] { fail("first_value must be an Array or Hash, and contain at least one element") }
|
---|
9 | #
|
---|
10 | # See the documentation for "The Puppet Type System" for more information about types.
|
---|
11 | # See the `assert_type()` function for flexible ways to assert the type of a value.
|
---|
12 | #
|
---|
13 | Puppet::Functions.create_function(:type_of) do
|
---|
14 | def type_of(value)
|
---|
15 | Puppet::Pops::Types::TypeCalculator.infer_set(value)
|
---|
16 | end
|
---|
17 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.