Skip to content

Commit 48d89de

Browse files
David Swanlionce
authored andcommitted
(FM-7950) - Implement Puppet Strings
First Pass completed on types and strings Functions from `a` to `m` done as well
1 parent 3741204 commit 48d89de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+7234
-602
lines changed

REFERENCE.md

Lines changed: 6190 additions & 0 deletions
Large diffs are not rendered by default.

lib/puppet/functions/deprecation.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# Function to print deprecation warnings, Logs a warning once for a given key. The uniqueness key - can appear once.
2-
# The msg is the message text including any positional information that is formatted by the user/caller of the method.
3-
# It is affected by the puppet setting 'strict', which can be set to :error (outputs as an error message),
4-
# :off (no message / error is displayed) and :warning (default, outputs a warning) *Type*: String, String.
1+
# @summary
2+
# Function to print deprecation warnings, Logs a warning once for a given key.
3+
#
4+
# The uniqueness key - can appear once.
5+
# The msg is the message text including any positional information that is formatted by the
6+
# user/caller of the method.
7+
# It is affected by the puppet setting 'strict', which can be set to :error
8+
# (outputs as an error message), :off (no message / error is displayed) and :warning
9+
# (default, outputs a warning) *Type*: String, String.
510
#
6-
711
Puppet::Functions.create_function(:deprecation) do
812
dispatch :deprecation do
913
param 'String', :key

lib/puppet/functions/fact.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
# Digs into the facts hash using dot-notation
1+
# @summary
2+
# Digs into the facts hash using dot-notation
23
#
3-
# Example usage:
4+
# Supports the use of dot-notation for referring to structured facts. If a fact requested
5+
# does not exist, returns Undef.
46
#
7+
# @example Example usage:
58
# fact('osfamily')
69
# fact('os.architecture')
710
#
8-
# Array indexing:
9-
#
11+
# @example Array indexing:
1012
# fact('mountpoints."/dev".options.1')
1113
#
12-
# Fact containing a "." in the name:
13-
#
14+
# @example Fact containing a "." in the name:
1415
# fact('vmware."VRA.version"')
1516
#
1617
Puppet::Functions.create_function(:fact) do
18+
# @param [String] fact_name
19+
# The name of the fact to check
20+
#
21+
# @return
22+
# All information retrieved on the given fact_name
1723
dispatch :fact do
1824
param 'String', :fact_name
1925
end

lib/puppet/functions/is_a.rb

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
1-
# Boolean check to determine whether a variable is of a given data type. This is equivalent to the `=~` type checks.
1+
# @summary
2+
# Boolean check to determine whether a variable is of a given data type.
3+
# This is equivalent to the `=~` type checks.
24
#
3-
# @example how to check a data type
5+
# @example Example Usage:
46
# # check a data type
5-
# foo = 3
6-
# $bar = [1,2,3]
7-
# $baz = 'A string!'
7+
# foo = 3
8+
# $bar = [1,2,3]
9+
# $baz = 'A string!'
810
#
9-
# if $foo.is_a(Integer) {
10-
# notify { 'foo!': }
11-
# }
12-
# if $bar.is_a(Array) {
13-
# notify { 'bar!': }
14-
# }
15-
# if $baz.is_a(String) {
16-
# notify { 'baz!': }
17-
# }
11+
# if $foo.is_a(Integer) {
12+
# notify { 'foo!': }
13+
# }
14+
# if $bar.is_a(Array) {
15+
# notify { 'bar!': }
16+
# }
17+
# if $baz.is_a(String) {
18+
# notify { 'baz!': }
19+
# }
1820
#
1921
# See the documentation for "The Puppet Type System" for more information about types.
2022
# See the `assert_type()` function for flexible ways to assert the type of a value.
2123
#
2224
Puppet::Functions.create_function(:is_a) do
25+
# @param value
26+
# The value to be checked
27+
#
28+
# @param type
29+
# The expected type
30+
#
31+
# @return [Boolean]
32+
# Return's `true` or `false`.
2333
dispatch :is_a do
2434
param 'Any', :value
2535
param 'Type', :type

lib/puppet/functions/is_absolute_path.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# @summary
2+
# Wrapper that calls the Puppet 3.x funtion of the same name.
13
Puppet::Functions.create_function(:is_absolute_path) do
4+
# @param scope
5+
# The main value that will be passed to the wrapped method
6+
#
7+
# @param args
8+
# Any additional values that are to be passed to the wrapped method
9+
#
10+
# @return [Boolea]
11+
# A boolean value returned from the called 3.x function.
212
dispatch :deprecation_gen do
313
param 'Any', :scope
414
repeated_param 'Any', :args

lib/puppet/functions/is_array.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# @summary
2+
# Wrapper that calls the Puppet 3.x funtion of the same name.
13
Puppet::Functions.create_function(:is_array) do
4+
# @param scope
5+
# The main value that will be passed to the wrapped method
6+
#
7+
# @param args
8+
# Any additional values that are to be passed to the wrapped method
9+
#
10+
# @return [Boolea]
11+
# A boolean value returned from the called 3.x function.
212
dispatch :deprecation_gen do
313
param 'Any', :scope
414
repeated_param 'Any', :args

lib/puppet/functions/is_bool.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# @summary
2+
# Wrapper that calls the Puppet 3.x funtion of the same name.
13
Puppet::Functions.create_function(:is_bool) do
4+
# @param scope
5+
# The main value that will be passed to the wrapped method
6+
#
7+
# @param args
8+
# Any additional values that are to be passed to the wrapped method
9+
#
10+
# @return [Boolea]
11+
# A boolean value returned from the called 3.x function.
212
dispatch :deprecation_gen do
313
param 'Any', :scope
414
repeated_param 'Any', :args

lib/puppet/functions/is_float.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# @summary
2+
# Wrapper that calls the Puppet 3.x funtion of the same name.
13
Puppet::Functions.create_function(:is_float) do
4+
# @param scope
5+
# The main value that will be passed to the wrapped method
6+
#
7+
# @param args
8+
# Any additional values that are to be passed to the wrapped method
9+
#
10+
# @return [Boolea]
11+
# A boolean value returned from the called 3.x function.
212
dispatch :deprecation_gen do
313
param 'Any', :scope
414
repeated_param 'Any', :args

lib/puppet/functions/is_ip_address.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# @summary
2+
# Wrapper that calls the Puppet 3.x funtion of the same name.
13
Puppet::Functions.create_function(:is_ip_address) do
4+
# @param scope
5+
# The main value that will be passed to the wrapped method
6+
#
7+
# @param args
8+
# Any additional values that are to be passed to the wrapped method
9+
#
10+
# @return [Boolea]
11+
# A boolean value returned from the called 3.x function.
212
dispatch :deprecation_gen do
313
param 'Any', :scope
414
repeated_param 'Any', :args

lib/puppet/functions/is_ipv4_address.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# @summary
2+
# Wrapper that calls the Puppet 3.x funtion of the same name.
13
Puppet::Functions.create_function(:is_ipv4_address) do
4+
# @param scope
5+
# The main value that will be passed to the wrapped method
6+
#
7+
# @param args
8+
# Any additional values that are to be passed to the wrapped method
9+
#
10+
# @return [Boolea]
11+
# A boolean value returned from the called 3.x function.
212
dispatch :deprecation_gen do
313
param 'Any', :scope
414
repeated_param 'Any', :args

0 commit comments

Comments
 (0)