summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-09-20 14:52:19 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-09-20 14:52:19 +0200
commite8ea1687887da18b287a6bb9b34670619e8692e1 (patch)
tree87118251fdc15daeca6cc099293116db5bf7bd2d
parent60936ce62b99bdd8609e9c9a2d0b6c4088f89f02 (diff)
downloadpuppet.WDORF-e8ea1687887da18b287a6bb9b34670619e8692e1.tar.gz
puppet.WDORF-e8ea1687887da18b287a6bb9b34670619e8692e1.tar.bz2
puppet.WDORF-e8ea1687887da18b287a6bb9b34670619e8692e1.zip
Bundles puppetlabs-stdlib 4.25.1.
-rw-r--r--code/environments/production/modules/stdlib/CHANGELOG.md938
-rw-r--r--code/environments/production/modules/stdlib/CONTRIBUTING.md271
-rw-r--r--code/environments/production/modules/stdlib/Gemfile136
-rw-r--r--code/environments/production/modules/stdlib/LICENSE202
-rw-r--r--code/environments/production/modules/stdlib/MAINTAINERS.md6
-rw-r--r--code/environments/production/modules/stdlib/NOTICE23
-rw-r--r--code/environments/production/modules/stdlib/README.md2844
-rw-r--r--code/environments/production/modules/stdlib/README_DEVELOPER.markdown35
-rw-r--r--code/environments/production/modules/stdlib/README_SPECS.markdown7
-rw-r--r--code/environments/production/modules/stdlib/RELEASE_PROCESS.markdown24
-rw-r--r--code/environments/production/modules/stdlib/Rakefile4
-rw-r--r--code/environments/production/modules/stdlib/appveyor.yml57
-rw-r--r--code/environments/production/modules/stdlib/checksums.json566
-rw-r--r--code/environments/production/modules/stdlib/examples/file_line.pp9
-rw-r--r--code/environments/production/modules/stdlib/examples/has_interface_with.pp9
-rw-r--r--code/environments/production/modules/stdlib/examples/has_ip_address.pp3
-rw-r--r--code/environments/production/modules/stdlib/examples/has_ip_network.pp3
-rw-r--r--code/environments/production/modules/stdlib/examples/init.pp1
-rw-r--r--code/environments/production/modules/stdlib/lib/facter/facter_dot_d.rb194
-rw-r--r--code/environments/production/modules/stdlib/lib/facter/package_provider.rb21
-rw-r--r--code/environments/production/modules/stdlib/lib/facter/pe_version.rb61
-rw-r--r--code/environments/production/modules/stdlib/lib/facter/puppet_settings.rb42
-rw-r--r--code/environments/production/modules/stdlib/lib/facter/root_home.rb44
-rw-r--r--code/environments/production/modules/stdlib/lib/facter/service_provider.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/facter/util/puppet_settings.rb16
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb32
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/fact.rb57
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_a.rb32
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_absolute_path.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_array.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_bool.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_float.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_ip_address.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv4_address.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv6_address.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_numeric.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/is_string.rb17
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/length.rb14
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/sprintf_hash.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/to_json.rb21
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/to_json_pretty.rb38
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/to_yaml.rb21
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/type_of.rb19
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_absolute_path.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_array.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_bool.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_hash.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_integer.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_ip_address.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv4_address.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv6_address.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_legacy.rb62
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_numeric.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_re.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_slength.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/functions/validate_string.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/abs.rb33
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2array.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2bool.rb53
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/assert_private.rb27
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/base64.rb67
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/basename.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2num.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2str.rb43
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/camelcase.rb31
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/capitalize.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/ceiling.rb25
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/chomp.rb31
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/chop.rb33
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/clamp.rb28
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/concat.rb39
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/convert_base.rb36
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/count.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb47
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb57
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete.rb42
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_at.rb45
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_regex.rb43
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb34
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_values.rb26
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/deprecation.rb19
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/difference.rb34
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig.rb15
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig44.rb65
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/dirname.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/dos2unix.rb15
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/downcase.rb30
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/empty.rb23
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/enclose_ipv6.rb41
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb50
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb46
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resources.rb50
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/flatten.rb31
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/floor.rb25
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb35
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb59
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_uuid.rb86
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/getparam.rb36
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/getvar.rb35
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/glob.rb25
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/grep.rb30
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb69
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb22
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb22
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_key.rb28
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/hash.rb38
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/intersection.rb31
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_absolute_path.rb54
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_array.rb21
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_bool.rb21
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb51
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_email_address.rb19
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_float.rb27
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_hash.rb20
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_integer.rb43
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb30
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv4_address.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv6_address.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb21
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb74
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_string.rb28
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/join.rb39
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb53
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/keys.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/load_module_metadata.rb25
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadjson.rb32
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb32
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/lstrip.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/max.rb23
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/member.rb57
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/merge.rb37
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/min.rb23
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/num2bool.rb41
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/parsejson.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb28
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick.rb27
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick_default.rb36
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/prefix.rb50
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/private.rb16
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/pry.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/pw_hash.rb62
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/range.rb84
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/regexpescape.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/reject.rb30
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/reverse.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/round.rb32
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/rstrip.rb28
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/seeded_rand.rb24
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_escape.rb27
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_join.rb29
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_split.rb23
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/shuffle.rb42
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/size.rb44
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/sort.rb25
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/squeeze.rb31
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2bool.rb43
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb30
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/strftime.rb105
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/strip.rb35
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/suffix.rb51
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/swapcase.rb36
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/time.rb48
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb33
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/try_get_value.rb56
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/type.rb18
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/type3x.rb49
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/union.rb27
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/unique.rb51
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/unix2dos.rb15
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/upcase.rb43
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/uriescape.rb32
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb54
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_array.rb36
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb86
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb34
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb66
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_domain_name.rb42
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_email_address.rb34
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb36
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_integer.rb137
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_ip_address.rb53
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb51
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb52
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_numeric.rb99
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_re.rb53
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb71
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_string.rb42
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_x509_rsa_key_pair.rb48
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/values.rb37
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/values_at.rb89
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/parser/functions/zip.rb37
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/provider/file_line/ruby.rb171
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/type/anchor.rb46
-rw-r--r--code/environments/production/modules/stdlib/lib/puppet/type/file_line.rb192
-rw-r--r--code/environments/production/modules/stdlib/locales/config.yaml26
-rw-r--r--code/environments/production/modules/stdlib/locales/ja/puppetlabs-stdlib.po26
-rw-r--r--code/environments/production/modules/stdlib/locales/puppetlabs-stdlib.pot23
-rw-r--r--code/environments/production/modules/stdlib/manifests/init.pp18
-rw-r--r--code/environments/production/modules/stdlib/manifests/stages.pp43
-rw-r--r--code/environments/production/modules/stdlib/metadata.json108
-rw-r--r--code/environments/production/modules/stdlib/readmes/README_ja_JP.md2844
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/abs_spec.rb27
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/anchor_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/any2array_spec.rb45
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/base64_spec.rb16
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/bool2num_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/build_csv.rb89
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/capitalize_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/ceiling_spec.rb37
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/chomp_spec.rb19
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/chop_spec.rb41
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/clamp_spec.rb38
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/concat_spec.rb52
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/count_spec.rb27
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/deep_merge_spec.rb18
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/defined_with_params_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/delete_at_spec.rb17
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/delete_spec.rb17
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/delete_undef_values_spec.rb17
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/delete_values_spec.rb23
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/deprecation_spec.rb92
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/difference_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/dirname_spec.rb39
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/downcase_spec.rb37
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/empty_spec.rb51
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/ensure_resource_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/flatten_spec.rb37
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/floor_spec.rb37
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/fqdn_rand_string_spec.rb64
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/fqdn_rotate_spec.rb62
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/get_module_path_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/getparam_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/getvar_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/grep_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/has_interface_with_spec.rb52
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/has_ip_address_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/has_ip_network_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/has_key_spec.rb39
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/hash_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/intersection_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_a_spec.rb27
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_array_spec.rb65
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_bool_spec.rb79
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_domain_name_spec.rb81
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_float_spec.rb84
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_function_available_spec.rb56
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_hash_spec.rb61
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_integer_spec.rb93
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_ip_address_spec.rb78
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_ipv4_address_spec.rb50
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_ipv6_address_spec.rb64
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_mac_address_spec.rb36
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_numeric_spec.rb93
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/is_string_spec.rb111
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/join_keys_to_values_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/join_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/keys_spec.rb21
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/loadjson_spec.rb48
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/loadyaml_spec.rb52
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/lstrip_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/max_spec.rb18
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/member_spec.rb57
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/merge_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/min_spec.rb18
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/nodesets/centos-7-x64.yml10
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/nodesets/debian-8-x64.yml10
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/nodesets/default.yml10
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/nodesets/docker/centos-7.yml12
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/nodesets/docker/debian-8.yml11
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/nodesets/docker/ubuntu-14.04.yml12
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/num2bool_spec.rb76
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/parsejson_spec.rb50
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/parseyaml_spec.rb52
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/pick_default_spec.rb51
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/pick_spec.rb42
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/prefix_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/pw_hash_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/range_spec.rb34
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/reject_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/reverse_spec.rb21
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/rstrip_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/shuffle_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/size_spec.rb53
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/sort_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/squeeze_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/str2bool_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/str2saltedsha512_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/strftime_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/strip_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/suffix_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/swapcase_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/time_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/to_bytes_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/try_get_value_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/type3x_spec.rb27
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/type_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/union_spec.rb23
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/unique_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/upcase_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/uriescape_spec.rb21
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_absolute_path_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_array_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_augeas_spec.rb61
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_bool_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_cmd_spec.rb50
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_hash_spec.rb36
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_ipv4_address_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_ipv6_address_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_re_spec.rb46
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_slength_spec.rb70
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/validate_string_spec.rb42
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/values_at_spec.rb71
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/values_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/acceptance/zip_spec.rb71
-rw-r--r--code/environments/production/modules/stdlib/spec/fixtures/dscacheutil/root8
-rw-r--r--code/environments/production/modules/stdlib/spec/fixtures/lsuser/root2
-rw-r--r--code/environments/production/modules/stdlib/spec/fixtures/test/manifests/base32.pp6
-rw-r--r--code/environments/production/modules/stdlib/spec/fixtures/test/manifests/base64.pp6
-rw-r--r--code/environments/production/modules/stdlib/spec/fixtures/test/manifests/deftype.pp4
-rw-r--r--code/environments/production/modules/stdlib/spec/fixtures/test/manifests/ensure_resources.pp4
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/abs_spec.rb45
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/any2array_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/any2bool_spec.rb41
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/assert_private_spec.rb41
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/base64_spec.rb60
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/basename_spec.rb19
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/bool2num_spec.rb14
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/bool2str_spec.rb16
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/camelcase_spec.rb17
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/capitalize_spec.rb15
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/ceiling_spec.rb12
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/chomp_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/chop_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/clamp_spec.rb16
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/concat_spec.rb28
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/convert_base_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/count_spec.rb23
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/deep_merge_spec.rb58
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/defined_with_params_spec.rb72
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/delete_at_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/delete_regex_spec.rb56
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/delete_spec.rb79
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/delete_undef_values_spec.rb58
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/delete_values_spec.rb45
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/deprecation_spec.rb63
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/difference_spec.rb23
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/dig44_spec.rb128
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/dig_spec.rb12
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/dirname_spec.rb18
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/dos2unix_spec.rb47
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/downcase_spec.rb15
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/empty_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/ensure_packages_spec.rb72
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/ensure_resource_spec.rb137
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/ensure_resources_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/flatten_spec.rb15
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/floor_spec.rb12
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/fqdn_rand_string_spec.rb67
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/fqdn_rotate_spec.rb74
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/fqdn_uuid_spec.rb12
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/get_module_path_spec.rb49
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/getparam_spec.rb34
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/getvar_spec.rb36
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/glob_spec.rb11
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/grep_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/has_interface_with_spec.rb39
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/has_ip_address_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/has_ip_network_spec.rb21
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/has_key_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/hash_spec.rb15
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/intersection_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_a_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_array_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_bool_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_domain_name_spec.rb43
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_email_address_spec.rb14
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_float_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_function_available_spec.rb9
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_hash_spec.rb11
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_integer_spec.rb46
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_ip_address_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_ipv4_address_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_ipv6_address_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_mac_address_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_numeric_spec.rb46
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/is_string_spec.rb45
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/join_keys_to_values_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/join_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/keys_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/length_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/load_module_metadata_spec.rb47
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/loadjson_spec.rb69
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/loadyaml_spec.rb39
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/lstrip_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/max_spec.rb21
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/member_spec.rb23
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/merge_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/min_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/num2bool_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/parsejson_spec.rb66
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/parseyaml_spec.rb83
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/pick_default_spec.rb26
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/pick_spec.rb17
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/prefix_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/private_spec.rb52
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/pw_hash_spec.rb79
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/range_spec.rb157
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/regexpescape_spec.rb41
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/reject_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/reverse_spec.rb33
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/round_spec.rb14
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/rstrip_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/seeded_rand_spec.rb58
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/shell_escape_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/shell_join_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/shell_split_spec.rb33
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/shuffle_spec.rb38
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/size_spec.rb38
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/sort_spec.rb33
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/sprintf_hash_spec.rb33
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/squeeze_spec.rb50
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/str2bool_spec.rb23
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/str2saltedsha512_spec.rb26
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/strftime_spec.rb26
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/strip_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/suffix_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/swapcase_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/time_spec.rb21
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/to_bytes_spec.rb70
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/to_json_pretty_spec.rb16
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/to_json_spec.rb22
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/to_yaml_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/try_get_value_spec.rb108
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/type3x_spec.rb41
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/type_of_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/type_spec.rb42
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/union_spec.rb25
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/unique_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/unix2dos_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/upcase_spec.rb26
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/uriescape_spec.rb36
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_absolute_path_spec.rb72
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_array_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_augeas_spec.rb75
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_bool_spec.rb36
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_cmd_spec.rb41
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_domain_name_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_email_address_spec.rb23
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_hash_spec.rb38
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_integer_spec.rb101
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_ip_address_spec.rb64
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_ipv4_address_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_ipv6_address_spec.rb59
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_legacy_spec.rb68
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_numeric_spec.rb100
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_re_spec.rb56
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_slength_spec.rb81
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_string_spec.rb33
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/validate_x509_rsa_key_pair_spec.rb181
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/values_at_spec.rb54
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/values_spec.rb24
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/zip_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb8
-rw-r--r--code/environments/production/modules/stdlib/spec/monkey_patches/publicize_methods.rb10
-rw-r--r--code/environments/production/modules/stdlib/spec/spec_helper.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/spec_helper_acceptance.rb54
-rw-r--r--code/environments/production/modules/stdlib/spec/spec_helper_local.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/support/shared_data.rb38
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/absolute_path_spec.rb64
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/array_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/base32_spec.rb53
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/base64_spec.rb38
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/bool_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/compat__ip_address.rb38
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/compat__ipv4_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/compat__ipv6_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/filemode_spec.rb46
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/filesource_spec.rb59
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/float_spec.rb26
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/fqdn_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/hash_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/host_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/httpsurl_spec.rb41
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/httpurl_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/integer_spec.rb29
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_nosubnet_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v4_nosubnet_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v4_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v6_alternative_spec.rb28
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v6_compressed_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v6_full_spec.rb28
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v6_nosubnet_alternative_spec.rb28
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v6_nosubnet_compressed_spec.rb31
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v6_nosubnet_full_spec.rb28
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ip_address_v6_spec.rb32
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ipv4_spec.rb20
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/ipv6_spec.rb50
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/numeric_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/port__privileged_spec.rb39
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/port__unprivileged_spec.rb40
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/port_spec.rb39
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/string_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/unixpath_spec.rb44
-rw-r--r--code/environments/production/modules/stdlib/spec/type_aliases/windowspath_spec.rb45
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb30
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/facter/package_provider_spec.rb43
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/facter/pe_version_spec.rb88
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/facter/root_home_spec.rb67
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/facter/service_provider_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb35
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/puppet/parser/functions/enclose_ipv6_spec.rb68
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/puppet/parser/functions/is_absolute_path_spec.rb87
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb258
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec_alter.rb374
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec_use_cases.rb135
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb9
-rw-r--r--code/environments/production/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb111
-rw-r--r--code/environments/production/modules/stdlib/types/absolutepath.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/base32.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/base64.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/compat/absolute_path.pp7
-rw-r--r--code/environments/production/modules/stdlib/types/compat/array.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/compat/bool.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/compat/float.pp19
-rw-r--r--code/environments/production/modules/stdlib/types/compat/hash.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/compat/integer.pp23
-rw-r--r--code/environments/production/modules/stdlib/types/compat/ip_address.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/compat/ipv4.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/compat/ipv6.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/compat/numeric.pp23
-rw-r--r--code/environments/production/modules/stdlib/types/compat/re.pp3
-rw-r--r--code/environments/production/modules/stdlib/types/compat/string.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/ensure/service.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/filemode.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/filesource.pp9
-rw-r--r--code/environments/production/modules/stdlib/types/fqdn.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/host.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/httpsurl.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/httpurl.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address.pp4
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/nosubnet.pp4
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v4.pp4
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v4/cidr.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v4/nosubnet.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6.pp6
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6/alternative.pp9
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6/compressed.pp10
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6/full.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6/nosubnet.pp5
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6/nosubnet/alternative.pp9
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6/nosubnet/compressed.pp10
-rw-r--r--code/environments/production/modules/stdlib/types/ip/address/v6/nosubnet/full.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/ip_address.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/ipv4.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/ipv6.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/mac.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/port.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/port/privileged.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/port/unprivileged.pp1
-rw-r--r--code/environments/production/modules/stdlib/types/unixpath.pp2
-rw-r--r--code/environments/production/modules/stdlib/types/windowspath.pp1
565 files changed, 28317 insertions, 0 deletions
diff --git a/code/environments/production/modules/stdlib/CHANGELOG.md b/code/environments/production/modules/stdlib/CHANGELOG.md
new file mode 100644
index 0000000..4d198b3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/CHANGELOG.md
@@ -0,0 +1,938 @@
+# Change log
+
+All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](http://semver.org).
+## Supported Release 4.25.1
+### Summary
+
+This is a patch which includes a roll up of small fixes. In Puppet 5.5.0 `flatten()`, `length(),` `empty(),` `join(),` `keys(),` and `values()` are now built into Puppet. Please note that the Puppet implementation of the functions will take precedence over the functions in 'puppetlabs-stdlib'.
+
+#### Fixed
+- Remove unneeded execute permission from test files.
+- Puppet 5.5.0 function deprecation [MODULES-6894](https://tickets.puppetlabs.com/browse/MODULES-6894).
+
+## Supported Release 4.25.0
+### Summary
+
+This is quite a feature heavy release, it makes this module PDK-compliant for easier maintenance and includes a roll up of maintenance changes.
+
+#### Added
+- PDK conversion [MODULES-6332](https://tickets.puppetlabs.com/browse/MODULES-6332).
+- Update `join_keys_to_values` with an undef statement.
+- Type alias `Stdlib::Fqdn` matches paths on a fully qualified domain name.
+- Type alias `Stdlib::Host` matches a valid host, this can be a valid 'ipv4', 'ipv6' or 'fqdn'.
+- Type alias `Stdlib::Port` matches a valid TCP/UDP Port number.
+- Type alias `Stdlib::Filesource` matches paths valid values for the source parameter of the puppet file type.
+- Type alias `Stdlib::IP::Address` matches any IP address, including both IPv4 and IPv6 addresses,
+- Type alias `Stdlib::IP::Address::V4` matches any string consisting of a valid IPv4 address, this is extended by 'CIDR' and 'nosubnet'.
+- Type alias `Stdlib::IP::Address::V6` matches any string consisting of a valid IPv6 address, this is extended by 'Full', 'Alternate' and 'Compressed'.
+- Type alias `Stdlib::IP::Address::V6::Nosubnet`matches any string consisting of a valid IPv6 address with no subnet, this is extended by 'Full', 'Alternate' and 'Compressed'.
+- Type alias `Stdlib::Port` matches a valid TCP/UDP Port number this is then extended to 'Privileged' which are ports less than 1024 and 'Unprivileged' which are ports greater than 1024.
+
+## Supported Release 4.24.0
+### Summary
+
+This release includes a roll up of minor changes and a new feature which provides the ability to skip undef values `to_json_pretty()`.
+We have also reverted a change that was previously made and resulted in breaking compatibility with Ruby 1.8.7.
+
+#### Added
+- Ability to skip undef values in `to_json_pretty()`.
+- Fix type3x function in stdlib ([MODULES-6216](https://tickets.puppet.com/browse/MODULES-6216))
+
+#### Changed
+- Indentation for `sync.yml` was fixed.
+- Updated type alias tests and dropped superfluous wrapper classes
+- Revert to old ruby 1.X style of hash ([MODULES-6139](https://tickets.puppet.com/browse/MODULES-6139))
+- `rubocop.yml` not managed by msync ([MODULES-6201](https://tickets.puppet.com/browse/MODULES-6201))
+
+## Supported Release 4.23.0
+### Summary
+
+This release is in order to implement Rubocop changes throughout the module.
+
+#### Added
+- Standard and translated readme's have been updated.
+- Rubocop has been implemented in the module and a wide variety of changes have been made to the code.
+- Modulesync changes have been merged into the code.
+
+#### Fixed
+- Minor fix to the readme.
+
+## Supported Release 4.22.0
+### Summary
+
+This is a clean release in preparation of putting the module through the rubocop process.
+
+#### Added
+- Support has been added for Debian 9
+- 'Stdlib::Mode type' has been added to the module.
+- A type for 'ensure' has been added to the service resources.
+- A new function 'sprintf_hash' has been added to allow the use of named references.
+
+#### Removed
+- Support has been removed for: RedHat 4, CentOS 4, OracleLinux 4, Scientific 4, SLES 10 SP4, Windows Server 2003, Windows Server 2003 R2 and Windows 8.
+
+#### Fixed
+- The 'ruby_spec.rb' test file has been altered s that it properly checks results.
+- Example syntax in 'file_line.rb' has been fixed.
+
+## Supported Release 4.21.0
+### Summary
+
+This is a small feature release that includes a revamped, albeit backwards-compatible file_line type.
+
+#### Added
+- `replace_all_matches_not_matching_line` parameter in file_line
+- additional tests and documentation for file_line
+
+#### Removed
+- duplicate spec test for absolute_path
+
+#### Fixed
+- Unixpath type to allow "/" as valid path
+- file_line behavior that caused infinite appending of `line` to a file ([MODULES-5651](https://tickets.puppet.com/browse/MODULES-5651))
+
+## Supported Release 4.20.0
+### Summary
+
+This release adds new functions and updated README translations.
+
+#### Added
+- `to_json`, `to_json_pretty`, and `to_yaml` functions
+- new Japanese README translations
+
+#### Fixed
+- compatibility issue with older versions of Puppet and the `pw_hash` function ([MODULES-5546](https://tickets.puppet.com/browse/MODULES-5546))
+
+#### Removed
+- support for EOL platform Debian 6 (Squeeze)
+
+## Supported Release 4.19.0
+### Summary
+
+This release adds new functions and better documentation/fixes for existing functions with a noteworthy fix for file_line.
+
+#### Added
+- Add validate_domain_name function
+- Add the round function
+- Add type for MAC address
+- Add support for sensitive data type to pw_hash ([MODULES-4908](https://tickets.puppet.com/browse/MODULES-4908))
+- Add new function, fact() (FACT-932)
+
+#### Fixed
+- Fixes for the file_line provider ([MODULES-5003](https://tickets.puppet.com/browse/MODULES-5003))
+- Add documentation for email functions ([MODULES-5382](https://tickets.puppet.com/browse/MODULES-5382))
+- unique function is deprecated for puppet version > 5. (FM-6239)
+- Fix headers in CHANGELOG.md so that headers render correctly
+- ensure_packages, converge ensure values 'present' and 'installed'
+
+#### Changed
+- Removes listed support for EOL Ubuntu versions
+
+## Supported Release 4.18.0
+### Summary
+
+Small release that reverts the Puppet version requirement lower bound to again include Puppet 2.7+ and bumps the upper bound to now include Puppet 5.
+
+#### Fixed
+- Reverts lower bound of Puppet requirement to 2.7.20
+
+## Supported Release 4.17.1
+### Summary
+
+Small release to address a bug (PUP-7650). Also pushes the Puppet version compatibility to 4.7.0.
+
+#### Bugfixes
+- (MODULES-5095) Workaround for PUP-7650
+- (FM-6197) Formatting fixes for file_line resource
+
+
+## Supported Release 4.17.0
+### Summary
+This release adds support for internationalization. It also contains Japanese translations for the README, summary and description of the metadata.json and major cleanups in the README. Additional folders have been introduced called locales and readmes where translation files can be found. A number of features and bug fixes are also included in this release. It also adds a new function `glob()` for expanding file lists. Also works around an issue that appeared in puppet 4.6.0 involving types being declared multiple times.
+
+#### Features
+- Addition of POT file / folder structure for i18n.
+- Addition of Internationalized READMEs.
+- `glob()` function
+
+### Fixed
+- Occasional duplicate type definitions when using `defined_with_params()`
+- `file_line` encoding issue on ruby 1.8 (unsupported)
+- Huge readme refresh
+
+## Supported Release 4.16.0
+### Summary
+
+This release sees a massive update to all unit tests to test UTF8 characters. There are also multiple cleanups in preparation for internationalization. Alongside this, improvements to ipv6 support, a new length function compatible with Puppet 4, and an update to path types. Also contains multiple bug fixes around functionality and tests.
+
+#### Features
+- Addition of coverage in all unit tests for functions, data and resource types for UTF8 for i18n.
+- All strings within the readme and functions that are split over two lines have been combined in preparation for i18n parser/decorator.
+- Improvement on the ipv6 support for type - Improves regex to catch some valid (but lesser known) ipv6 strings, mostly those which are a mix of ipv6 strings and embedded ipv6 numbers.
+- Adds a new parameter `encoding` to allow non UTF-8 files to specify a file encoding. This prevents receiving the error message "invalid byte sequence in UTF-8" when special characters that are not UTF-8 encoded appear in the input stream, such as the copyright symbol.
+- Addition of the new length function. Returns the length of a given string, array or hash. To eventually replace the deprecated size() function as can handle the new type functionality introduced in Puppet 4.
+- Permit double slash in absolute/Unix path types.
+
+#### Bugfixes
+- Fix unsupported data type error with rspec-puppet master.
+- Now allows test module metadata.json to be read by Puppet.
+- Fix acceptance test failure "Hiera is not a class".
+- Removal of unsupported platforms and future parser setting in acceptance tests.
+- Regex for tuple checking has been loosened.
+- Ensure_packages function - Now only tries to apply the resource if not defined.
+- (MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compat.
+- Adds comments to warn for UTF8 incompatibility of the functions that may not be compatible with UTF8 with Ruby < 2.4.0.
+
+## Supported Release 4.15.0
+### Summary
+
+This release introduces multiple new functions, a new fact and the addition of Ubuntu Xenial support. Also includes a bugfix and documentation update.
+
+#### Features
+- Addition of puppet_server fact to return agents server.
+- Addition of a pry function.
+- Addition of tests for ensure_resources.
+- Addition of FQDN UUID generation function.
+- Addition of Ubuntu Xenial to OS Support.
+
+#### Bugfixes
+- Ensure_packages now works with Ruby < 2.0.
+- Updated the documentation of str2bool function.
+
+## Supported Release 4.14.0
+### Summary
+
+Adds several new features and updates, especially around refining the deprecation and validate_legacy functions. Also includes a Gemfile update around an issue with parallel_tests dependancy for different versions of Ruby.
+
+#### Features
+- Deprecation function now uses puppet stacktrace if available.
+- join_key_to_values function now handles array values. If values are arrays, multiple keys are added for each element.
+- Updated Gemfile to deal with parallel_tests Ruby dependancy (MODULES-3983).
+- Updated/Fixed ipv4 regex validator (MODULES-3980).
+- Deprecation clarification added to README.
+
+#### Bugfixes
+- README typo fixes.
+- Use .dup to duplicate classes for modification (MODULES-3829).
+- Fixes spec failures that were caused by a change in the tested error message in validate_legacy_spec.
+- Broken link to validate_legacy docs fixed.
+- Updates deprecation tests to include future parser.
+
+## Supported Release 4.13.1
+### Summary
+
+This bugfix release addresses the `undefined method 'optional_repeated_param'` error messages seen by users of puppet 3.7.
+
+It also improves the user experience around function deprecations by emitting one warning per function(-name) instead of only one deprecation overall. This allows users to identify all deprecated functions used in one agent run, with less back-and-forth.
+
+#### Bugfixes
+
+* Emit deprecations warnings for each function, instead of once per process. (MODULES-3961)
+* Use a universally available API for the v4 deprecation stubs of `is_*` and `validate_*`. (MODULES-3962)
+* Make `getvar()` compatible to ruby 1.8.7. (MODULES-3969)
+* Add v4 deprecation stubs for the `is_` counterparts of the deprecated functions to emit the deprecations warnings in all cases.
+
+
+## Supported Release 4.13.0
+### Summary
+
+This version of stdlib deprecates a whole host of functions, and provides stepping stones to move to Puppet 4 type validations. Be sure to check out the new `deprecation()` and `validate_legacy()` functions to migrate off the deprecated v3-style data validations.
+
+Many thanks to all community contributors: bob, Dmitry Ilyin, Dominic Cleal, Joris, Joseph Yaworski, Loic Antoine-Gombeaud, Maksym Melnychok, Michiel Brandenburg, Nate Potter, Romain Tartière, Stephen Benjamin, and Steve Moore, as well as anyone contributing in the code review process and by submitting issues.
+
+Special thanks to [Voxpupuli's](https://voxpupuli.org/) Igor Galić for donating the puppet-tea types to kickstart this part of stdlib.
+
+
+#### Deprecations
+* `validate_absolute_path`, `validate_array`, `validate_bool`, `validate_hash`, `validate_integer`, `validate_ip_address`, `validate_ipv4_address`, `validate_ipv6_address`, `validate_numeric`, `validate_re`, `validate_slength`, `validate_string`, and their `is_` counter parts are now deprecated on Puppet 4. See the `validate_legacy()` description in the README for help on migrating away from those functions.
+* The `dig` function is provided by core puppet since 4.5.0 with slightly different calling convention. The stdlib version can still be accessed as `dig44` for now.
+
+
+#### Features
+* Add Puppet 4 data types for Unix, and Windows paths, and URLs.
+* Add `deprecation` function to warn users of functionality that will be removed soon.
+* Add `validate_legacy` function to help with migrating to Puppet 4 data types.
+
+* Add `any2bool` function, a combination of of `string2bool` and `num2bool`.
+* Add `delete_regex` function to delete array elements matching a regular expression.
+* Add `puppet_environmentpath` fact to expose the `environmentpath` setting.
+* Add `regexpescape` function to safely insert arbitrary strings into regular expressions.
+* Add `shell_escape`, `shell_join`, and `shell_split` functions for safer working with shell scripts..
+
+* The `delete` function now also accepts regular expressions as search term.
+* The `loadyaml` function now accepts a default value, which is returned when there is an error loading the file.
+
+#### Bugfixes
+* Fix `file_line.match_for_absence` implementation and description to actually work. (MODULES-3590)
+* Fix `getparam` so that it can now also return `false`. (MODULES-3933)
+* Fix the fixture setup for testing and adjust `load_module_metadata` and `loadjson` tests.
+* Fix `defined_with_params` to handle `undef` correctly on all puppet versions. (PUP-6422, MODULES-3543)
+* Fix `file_line.path` validation to use puppet's built in `absolute_path?` matcher.
+
+#### Minor Improvements
+* README changes: improved descriptions of `deep_merge`, `delete`, `ensure_packages`, `file_line.after`, `range`, and `validate_numeric`.
+* The `getvar` function now returns nil in all situations where the variable is not found.
+* Update the `dig44` function with better `undef`, `nil`, and `false` handling.
+* Better wording on `str2bool` argument validation error message.
+
+
+### Known issues
+* The `validate_legacy` function relies on internal APIs from Puppet 4.4.0 (PE 2016.1) onwards, and doesn't work on earlier versions.
+* Puppet 4.5.0 (PE 2016.2) has a number of improvements around data types - especially error handling - that make working with them much nicer.
+
+## Supported Release 4.12.0
+### Summary
+
+This release provides several new functions, bugfixes, modulesync changes, and some documentation updates.
+
+#### Features
+- Adds `clamp`. This function keeps values within a specified range.
+- Adds `validate_x509_rsa_key_pair`. This function validates an x509 RSA certificate and key pair.
+- Adds `dig`. This function performs a deep lookup in nested hashes or arrays.
+- Extends the `base64` support to fit `rfc2045` and `rfc4648`.
+- Adds `is_ipv6_address` and `is_ipv4_address`. These functions validate the specified ipv4 or ipv6 addresses.
+- Adds `enclose_ipv6`. This function encloses IPv6 addresses in square brackets.
+- Adds `ensure_resources`. This function takes a list of resources and creates them if they do not exist.
+- Extends `suffix` to support applying a suffix to keys in a hash.
+- Apply modulesync changes.
+- Add validate_email_address function.
+
+#### Bugfixes
+- Fixes `fqdn_rand_string` tests, since Puppet 4.4.0 and later have a higher `fqdn_rand` ceiling.
+- (MODULES-3152) Adds a check to `package_provider` to prevent failures if Gem is not installed.
+- Fixes to README.md.
+- Fixes catch StandardError rather than the gratuitous Exception
+- Fixes file_line attribute validation.
+- Fixes concat with Hash arguments.
+
+## Supported Release 4.11.0
+### Summary
+
+Provides a validate_absolute_paths and Debian 8 support. There is a fix to the is_package_provider fact and a test improvement.
+
+#### Features
+- Adds new parser called is_absolute_path
+- Supports Debian 8
+
+#### Bugfixes
+- Allow package_provider fact to resolve on PE 3.x
+
+#### Improvements
+- ensures that the test passes independently of changes to rubygems for ensure_resource
+
+## 2015-12-15 - Supported Release 4.10.0
+### Summary
+
+Includes the addition of several new functions and considerable improvements to the existing functions, tests and documentation. Includes some bug fixes which includes compatibility, test and fact issues.
+
+#### Features
+- Adds service_provider fact
+- Adds is_a() function
+- Adds package_provider fact
+- Adds validate_ip_address function
+- Adds seeded_rand function
+
+#### Bugfixes
+- Fix backwards compatibility from an improvement to the parseyaml function
+- Renaming of load_module_metadata test to include _spec.rb
+- Fix root_home fact on AIX 5.x, now '-c' rather than '-C'
+- Fixed Gemfile to work with ruby 1.8.7
+
+#### Improvements
+- (MODULES-2462) Improvement of parseyaml function
+- Improvement of str2bool function
+- Improvement to readme
+- Improvement of intersection function
+- Improvement of validate_re function
+- Improved speed on Facter resolution of service_provider
+- empty function now handles numeric values
+- Package_provider now prevents deprecation warning about the allow_virtual parameter
+- load_module_metadata now succeeds on empty file
+- Check added to ensure puppetversion value is not nil
+- Improvement to bool2str to return a string of choice using boolean
+- Improvement to naming convention in validate_ipv4_address function
+
+## Supported Release 4.9.1
+### Summary
+
+Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
+
+## 2015-09-08 - Supported Release 4.9.0
+### Summary
+
+This release adds new features including the new functions dos2unix, unix2dos, try_get_value, convert_base as well as other features and improvements.
+
+#### Features
+- (MODULES-2370) allow `match` parameter to influence `ensure => absent` behavior
+- (MODULES-2410) Add new functions dos2unix and unix2dos
+- (MODULE-2456) Modify union to accept more than two arrays
+- Adds a convert_base function, which can convert numbers between bases
+- Add a new function "try_get_value"
+
+#### Bugfixes
+- n/a
+
+#### Improvements
+- (MODULES-2478) Support root_home fact on AIX through "lsuser" command
+- Acceptance test improvements
+- Unit test improvements
+- Readme improvements
+
+## 2015-08-10 - Supported Release 4.8.0
+### Summary
+This release adds a function for reading metadata.json from any module, and expands file\_line's abilities.
+
+#### Features
+- New parameter `replace` on `file_line`
+- New function `load_module_metadata()` to load metadata.json and return the content as a hash.
+- Added hash support to `size()`
+
+#### Bugfixes
+- Fix various docs typos
+- Fix `file_line` resource on puppet < 3.3
+
+## 2015-06-22 - Supported Release 4.7.0
+### Summary
+
+Adds Solaris 12 support along with improved Puppet 4 support. There are significant test improvements, and some minor fixes.
+
+#### Features
+- Add support for Solaris 12
+
+#### Bugfixes
+- Fix for AIO Puppet 4
+- Fix time for ruby 1.8.7
+- Specify rspec-puppet version
+- range() fix for typeerror and missing functionality
+- Fix pw_hash() on JRuby < 1.7.17
+- fqdn_rand_string: fix argument error message
+- catch and rescue from looking up non-existent facts
+- Use puppet_install_helper, for Puppet 4
+
+#### Improvements
+- Enforce support for Puppet 4 testing
+- fqdn_rotate/fqdn_rand_string acceptance tests and implementation
+- Simplify mac address regex
+- validate_integer, validate_numeric: explicitely reject hashes in arrays
+- Readme edits
+- Remove all the pops stuff for rspec-puppet
+- Sync via modulesync
+- Add validate_slength optional 3rd arg
+- Move tests directory to examples directory
+
+## 2015-04-14 - Supported Release 4.6.0
+### Summary
+
+Adds functions and function argument abilities, and improves compatibility with the new puppet parser
+
+#### Features
+- MODULES-444: `concat()` can now take more than two arrays
+- `basename()` added to have Ruby File.basename functionality
+- `delete()` can now take an array of items to remove
+- `prefix()` can now take a hash
+- `upcase()` can now take a hash or array of upcaseable things
+- `validate_absolute_path()` can now take an array
+- `validate_cmd()` can now use % in the command to embed the validation file argument in the string
+- MODULES-1473: deprecate `type()` function in favor of `type3x()`
+- MODULES-1473: Add `type_of()` to give better type information on future parser
+- Deprecate `private()` for `assert_private()` due to future parser
+- Adds `ceiling()` to take the ceiling of a number
+- Adds `fqdn_rand_string()` to generate random string based on fqdn
+- Adds `pw_hash()` to generate password hashes
+- Adds `validate_integer()`
+- Adds `validate_numeric()` (like `validate_integer()` but also accepts floats)
+
+#### Bugfixes
+- Fix seeding of `fqdn_rotate()`
+- `ensure_resource()` is more verbose on debug mode
+- Stricter argument checking for `dirname()`
+- Fix `is_domain_name()` to better match RFC
+- Fix `uriescape()` when called with array
+- Fix `file_line` resource when using the `after` attribute with `match`
+
+## 2015-01-14 - Supported Release 4.5.1
+### Summary
+
+This release changes the temporary facter_dot_d cache locations outside of the /tmp directory due to a possible security vunerability. CVE-2015-1029
+
+#### Bugfixes
+- Facter_dot_d cache will now be stored in puppet libdir instead of tmp
+
+## 2014-12-15 - Supported Release 4.5.0
+### Summary
+
+This release improves functionality of the member function and adds improved future parser support.
+
+#### Features
+- MODULES-1329: Update member() to allow the variable to be an array.
+- Sync .travis.yml, Gemfile, Rakefile, and CONTRIBUTING.md via modulesync
+
+#### Bugfixes
+- Fix range() to work with numeric ranges with the future parser
+- Accurately express SLES support in metadata.json (was missing 10SP4 and 12)
+- Don't require `line` to match the `match` parameter
+
+## 2014-11-10 - Supported Release 4.4.0
+### Summary
+This release has an overhauled readme, new private manifest function, and fixes many future parser bugs.
+
+#### Features
+- All new shiny README
+- New `private()` function for making private manifests (yay!)
+
+#### Bugfixes
+- Code reuse in `bool2num()` and `zip()`
+- Fix many functions to handle `generate()` no longer returning a string on new puppets
+- `concat()` no longer modifies the first argument (whoops)
+- strict variable support for `getvar()`, `member()`, `values_at`, and `has_interface_with()`
+- `to_bytes()` handles PB and EB now
+- Fix `tempfile` ruby requirement for `validate_augeas()` and `validate_cmd()`
+- Fix `validate_cmd()` for windows
+- Correct `validate_string()` docs to reflect non-handling of `undef`
+- Fix `file_line` matching on older rubies
+
+
+## 2014-07-15 - Supported Release 4.3.2
+### Summary
+
+This release merely updates metadata.json so the module can be uninstalled and
+upgraded via the puppet module command.
+
+## 2014-07-14 - Supported Release 4.3.1
+### Summary
+This supported release updates the metadata.json to work around upgrade behavior of the PMT.
+
+#### Bugfixes
+- Synchronize metadata.json with PMT-generated metadata to pass checksums
+
+## 2014-06-27 - Supported Release 4.3.0
+### Summary
+This release is the first supported release of the stdlib 4 series. It remains
+backwards-compatible with the stdlib 3 series. It adds two new functions, one bugfix, and many testing updates.
+
+#### Features
+- New `bool2str()` function
+- New `camelcase()` function
+
+#### Bugfixes
+- Fix `has_interface_with()` when interfaces fact is nil
+
+## 2014-06-04 - Release 4.2.2
+### Summary
+
+This release adds PE3.3 support in the metadata and fixes a few tests.
+
+## 2014-05-08 - Release - 4.2.1
+### Summary
+This release moves a stray symlink that can cause problems.
+
+## 2014-05-08 - Release - 4.2.0
+### Summary
+This release adds many new functions and fixes, and continues to be backwards compatible with stdlib 3.x
+
+#### Features
+- New `base64()` function
+- New `deep_merge()` function
+- New `delete_undef_values()` function
+- New `delete_values()` function
+- New `difference()` function
+- New `intersection()` function
+- New `is_bool()` function
+- New `pick_default()` function
+- New `union()` function
+- New `validate_ipv4_address` function
+- New `validate_ipv6_address` function
+- Update `ensure_packages()` to take an option hash as a second parameter.
+- Update `range()` to take an optional third argument for range step
+- Update `validate_slength()` to take an optional third argument for minimum length
+- Update `file_line` resource to take `after` and `multiple` attributes
+
+#### Bugfixes
+- Correct `is_string`, `is_domain_name`, `is_array`, `is_float`, and `is_function_available` for parsing odd types such as bools and hashes.
+- Allow facts.d facts to contain `=` in the value
+- Fix `root_home` fact on darwin systems
+- Fix `concat()` to work with a second non-array argument
+- Fix `floor()` to work with integer strings
+- Fix `is_integer()` to return true if passed integer strings
+- Fix `is_numeric()` to return true if passed integer strings
+- Fix `merge()` to work with empty strings
+- Fix `pick()` to raise the correct error type
+- Fix `uriescape()` to use the default URI.escape list
+- Add/update unit & acceptance tests.
+
+
+## 2014-03-04 - Supported Release - 3.2.1
+### Summary
+This is a supported release
+
+#### Bugfixes
+- Fixed `is_integer`/`is_float`/`is_numeric` for checking the value of arithmatic expressions.
+
+#### Known bugs
+* No known bugs
+
+---
+
+##### 2013-05-06 - Jeff McCune <jeff@puppetlabs.com> - 4.1.0
+
+ * (#20582) Restore facter\_dot\_d to stdlib for PE users (3b887c8)
+ * (maint) Update Gemfile with GEM\_FACTER\_VERSION (f44d535)
+
+##### 2013-05-06 - Alex Cline <acline@us.ibm.com> - 4.1.0
+
+ * Terser method of string to array conversion courtesy of ethooz. (d38bce0)
+
+##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
+
+ * Refactor ensure\_resource expectations (b33cc24)
+
+##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
+
+ * Changed str-to-array conversion and removed abbreviation. (de253db)
+
+##### 2013-05-03 - Alex Cline <acline@us.ibm.com> 4.1.0
+
+ * (#20548) Allow an array of resource titles to be passed into the ensure\_resource function (e08734a)
+
+##### 2013-05-02 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.1.0
+
+ * Add a dirname function (2ba9e47)
+
+##### 2013-04-29 - Mark Smith-Guerrero <msmithgu@gmail.com> - 4.1.0
+
+ * (maint) Fix a small typo in hash() description (928036a)
+
+##### 2013-04-12 - Jeff McCune <jeff@puppetlabs.com> - 4.0.2
+
+ * Update user information in gemspec to make the intent of the Gem clear.
+
+##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.1
+
+ * Fix README function documentation (ab3e30c)
+
+##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * stdlib 4.0 drops support with Puppet 2.7
+ * stdlib 4.0 preserves support with Puppet 3
+
+##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * Add ability to use puppet from git via bundler (9c5805f)
+
+##### 2013-04-10 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * (maint) Make stdlib usable as a Ruby GEM (e81a45e)
+
+##### 2013-04-10 - Erik Dalén <dalen@spotify.com> - 4.0.0
+
+ * Add a count function (f28550e)
+
+##### 2013-03-31 - Amos Shapira <ashapira@atlassian.com> - 4.0.0
+
+ * (#19998) Implement any2array (7a2fb80)
+
+##### 2013-03-29 - Steve Huff <shuff@vecna.org> - 4.0.0
+
+ * (19864) num2bool match fix (8d217f0)
+
+##### 2013-03-20 - Erik Dalén <dalen@spotify.com> - 4.0.0
+
+ * Allow comparisons of Numeric and number as String (ff5dd5d)
+
+##### 2013-03-26 - Richard Soderberg <rsoderberg@mozilla.com> - 4.0.0
+
+ * add suffix function to accompany the prefix function (88a93ac)
+
+##### 2013-03-19 - Kristof Willaert <kristof.willaert@gmail.com> - 4.0.0
+
+ * Add floor function implementation and unit tests (0527341)
+
+##### 2012-04-03 - Eric Shamow <eric@puppetlabs.com> - 4.0.0
+
+ * (#13610) Add is\_function\_available to stdlib (961dcab)
+
+##### 2012-12-17 - Justin Lambert <jlambert@eml.cc> - 4.0.0
+
+ * str2bool should return a boolean if called with a boolean (5d5a4d4)
+
+##### 2012-10-23 - Uwe Stuehler <ustuehler@team.mobile.de> - 4.0.0
+
+ * Fix number of arguments check in flatten() (e80207b)
+
+##### 2013-03-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * Add contributing document (96e19d0)
+
+##### 2013-03-04 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
+
+ * Add missing documentation for validate\_augeas and validate\_cmd to README.markdown (a1510a1)
+
+##### 2013-02-14 - Joshua Hoblitt <jhoblitt@cpan.org> - 4.0.0
+
+ * (#19272) Add has\_element() function (95cf3fe)
+
+##### 2013-02-07 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
+
+ * validate\_cmd(): Use Puppet::Util::Execution.execute when available (69248df)
+
+##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
+
+ * Add validate\_augeas function (3a97c23)
+
+##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
+
+ * Add validate\_cmd function (6902cc5)
+
+##### 2013-01-14 - David Schmitt <david@dasz.at> - 4.0.0
+
+ * Add geppetto project definition (b3fc0a3)
+
+##### 2013-01-02 - Jaka Hudoklin <jakahudoklin@gmail.com> - 4.0.0
+
+ * Add getparam function to get defined resource parameters (20e0e07)
+
+##### 2013-01-05 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * (maint) Add Travis CI Support (d082046)
+
+##### 2012-12-04 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
+
+ * Clarify that stdlib 3 supports Puppet 3 (3a6085f)
+
+##### 2012-11-30 - Erik Dalén <dalen@spotify.com> - 4.0.0
+
+ * maint: style guideline fixes (7742e5f)
+
+##### 2012-11-09 - James Fryman <james@frymanet.com> - 4.0.0
+
+ * puppet-lint cleanup (88acc52)
+
+##### 2012-11-06 - Joe Julian <me@joejulian.name> - 4.0.0
+
+ * Add function, uriescape, to URI.escape strings. Redmine #17459 (fd52b8d)
+
+##### 2012-09-18 - Chad Metcalf <chad@wibidata.com> - 3.2.0
+
+ * Add an ensure\_packages function. (8a8c09e)
+
+##### 2012-11-23 - Erik Dalén <dalen@spotify.com> - 3.2.0
+
+ * (#17797) min() and max() functions (9954133)
+
+##### 2012-05-23 - Peter Meier <peter.meier@immerda.ch> - 3.2.0
+
+ * (#14670) autorequire a file\_line resource's path (dfcee63)
+
+##### 2012-11-19 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
+
+ * Add join\_keys\_to\_values function (ee0f2b3)
+
+##### 2012-11-17 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
+
+ * Extend delete function for strings and hashes (7322e4d)
+
+##### 2012-08-03 - Gary Larizza <gary@puppetlabs.com> - 3.2.0
+
+ * Add the pick() function (ba6dd13)
+
+##### 2012-03-20 - Wil Cooley <wcooley@pdx.edu> - 3.2.0
+
+ * (#13974) Add predicate functions for interface facts (f819417)
+
+##### 2012-11-06 - Joe Julian <me@joejulian.name> - 3.2.0
+
+ * Add function, uriescape, to URI.escape strings. Redmine #17459 (70f4a0e)
+
+##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 3.1.1
+
+ * (maint) Fix spec failures resulting from Facter API changes (97f836f)
+
+##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 3.1.0
+
+ * Add PE facts to stdlib (cdf3b05)
+
+##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.1
+
+ * Fix accidental removal of facts\_dot\_d.rb in 3.0.0 release
+
+##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.0
+
+ * stdlib 3.0 drops support with Puppet 2.6
+ * stdlib 3.0 preserves support with Puppet 2.7
+
+##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 3.0.0
+
+ * Add function ensure\_resource and defined\_with\_params (ba789de)
+
+##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 3.0.0
+
+ * (#2157) Remove facter\_dot\_d for compatibility with external facts (f92574f)
+
+##### 2012-04-10 - Chris Price <chris@puppetlabs.com> - 3.0.0
+
+ * (#13693) moving logic from local spec\_helper to puppetlabs\_spec\_helper (85f96df)
+
+##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 2.5.1
+
+ * (maint) Fix spec failures resulting from Facter API changes (97f836f)
+
+##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 2.5.0
+
+ * Add PE facts to stdlib (cdf3b05)
+
+##### 2012-08-15 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Explicitly load functions used by ensure\_resource (9fc3063)
+
+##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Add better docs about duplicate resource failures (97d327a)
+
+##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Handle undef for parameter argument (4f8b133)
+
+##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 2.5.0
+
+ * Add function ensure\_resource and defined\_with\_params (a0cb8cd)
+
+##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
+
+ * Disable tests that fail on 2.6.x due to #15912 (c81496e)
+
+##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
+
+ * (Maint) Fix mis-use of rvalue functions as statements (4492913)
+
+##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
+
+ * Add .rspec file to repo root (88789e8)
+
+##### 2012-06-07 - Chris Price <chris@puppetlabs.com> - 2.4.0
+
+ * Add support for a 'match' parameter to file\_line (a06c0d8)
+
+##### 2012-08-07 - Erik Dalén <dalen@spotify.com> - 2.4.0
+
+ * (#15872) Add to\_bytes function (247b69c)
+
+##### 2012-07-19 - Jeff McCune <jeff@puppetlabs.com> - 2.4.0
+
+ * (Maint) use PuppetlabsSpec::PuppetInternals.scope (master) (deafe88)
+
+##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 2.4.0
+
+ * (#2157) Make facts\_dot\_d compatible with external facts (5fb0ddc)
+
+##### 2012-03-16 - Steve Traylen <steve.traylen@cern.ch> - 2.4.0
+
+ * (#13205) Rotate array/string randomley based on fqdn, fqdn\_rotate() (fef247b)
+
+##### 2012-05-22 - Peter Meier <peter.meier@immerda.ch> - 2.3.3
+
+ * fix regression in #11017 properly (f0a62c7)
+
+##### 2012-05-10 - Jeff McCune <jeff@puppetlabs.com> - 2.3.3
+
+ * Fix spec tests using the new spec\_helper (7d34333)
+
+##### 2012-05-10 - Puppet Labs <support@puppetlabs.com> - 2.3.2
+
+ * Make file\_line default to ensure => present (1373e70)
+ * Memoize file\_line spec instance variables (20aacc5)
+ * Fix spec tests using the new spec\_helper (1ebfa5d)
+ * (#13595) initialize\_everything\_for\_tests couples modules Puppet ver (3222f35)
+ * (#13439) Fix MRI 1.9 issue with spec\_helper (15c5fd1)
+ * (#13439) Fix test failures with Puppet 2.6.x (665610b)
+ * (#13439) refactor spec helper for compatibility with both puppet 2.7 and master (82194ca)
+ * (#13494) Specify the behavior of zero padded strings (61891bb)
+
+##### 2012-03-29 Puppet Labs <support@puppetlabs.com> - 2.1.3
+
+* (#11607) Add Rakefile to enable spec testing
+* (#12377) Avoid infinite loop when retrying require json
+
+##### 2012-03-13 Puppet Labs <support@puppetlabs.com> - 2.3.1
+
+* (#13091) Fix LoadError bug with puppet apply and puppet\_vardir fact
+
+##### 2012-03-12 Puppet Labs <support@puppetlabs.com> - 2.3.0
+
+* Add a large number of new Puppet functions
+* Backwards compatibility preserved with 2.2.x
+
+##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.2.1
+
+* Documentation only release for the Forge
+
+##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.1.2
+
+* Documentation only release for PE 2.0.x
+
+##### 2011-11-08 Puppet Labs <support@puppetlabs.com> - 2.2.0
+
+* #10285 - Refactor json to use pson instead.
+* Maint - Add watchr autotest script
+* Maint - Make rspec tests work with Puppet 2.6.4
+* #9859 - Add root\_home fact and tests
+
+##### 2011-08-18 Puppet Labs <support@puppetlabs.com> - 2.1.1
+
+* Change facts.d paths to match Facter 2.0 paths.
+* /etc/facter/facts.d
+* /etc/puppetlabs/facter/facts.d
+
+##### 2011-08-17 Puppet Labs <support@puppetlabs.com> - 2.1.0
+
+* Add R.I. Pienaar's facts.d custom facter fact
+* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are
+ automatically loaded now.
+
+##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 2.0.0
+
+* Rename whole\_line to file\_line
+* This is an API change and as such motivating a 2.0.0 release according to semver.org.
+
+##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.1.0
+
+* Rename append\_line to whole\_line
+* This is an API change and as such motivating a 1.1.0 release.
+
+##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.0.0
+
+* Initial stable release
+* Add validate\_array and validate\_string functions
+* Make merge() function work with Ruby 1.8.5
+* Add hash merging function
+* Add has\_key function
+* Add loadyaml() function
+* Add append\_line native
+
+##### 2011-06-21 Jeff McCune <jeff@puppetlabs.com> - 0.1.7
+
+* Add validate\_hash() and getvar() functions
+
+##### 2011-06-15 Jeff McCune <jeff@puppetlabs.com> - 0.1.6
+
+* Add anchor resource type to provide containment for composite classes
+
+##### 2011-06-03 Jeff McCune <jeff@puppetlabs.com> - 0.1.5
+
+* Add validate\_bool() function to stdlib
+
+##### 0.1.4 2011-05-26 Jeff McCune <jeff@puppetlabs.com>
+
+* Move most stages after main
+
+##### 0.1.3 2011-05-25 Jeff McCune <jeff@puppetlabs.com>
+
+* Add validate\_re() function
+
+##### 0.1.2 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
+
+* Update to add annotated tag
+
+##### 0.1.1 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
+
+* Add stdlib::stages class with a standard set of stages
diff --git a/code/environments/production/modules/stdlib/CONTRIBUTING.md b/code/environments/production/modules/stdlib/CONTRIBUTING.md
new file mode 100644
index 0000000..1a9fb3a
--- /dev/null
+++ b/code/environments/production/modules/stdlib/CONTRIBUTING.md
@@ -0,0 +1,271 @@
+# Contributing to Puppet modules
+
+So you want to contribute to a Puppet module: Great! Below are some instructions to get you started doing
+that very thing while setting expectations around code quality as well as a few tips for making the
+process as easy as possible.
+
+### Table of Contents
+
+1. [Getting Started](#getting-started)
+1. [Commit Checklist](#commit-checklist)
+1. [Submission](#submission)
+1. [More about commits](#more-about-commits)
+1. [Testing](#testing)
+ - [Running Tests](#running-tests)
+ - [Writing Tests](#writing-tests)
+1. [Get Help](#get-help)
+
+## Getting Started
+
+- Fork the module repository on GitHub and clone to your workspace
+
+- Make your changes!
+
+## Commit Checklist
+
+### The Basics
+
+- [x] my commit is a single logical unit of work
+
+- [x] I have checked for unnecessary whitespace with "git diff --check"
+
+- [x] my commit does not include commented out code or unneeded files
+
+### The Content
+
+- [x] my commit includes tests for the bug I fixed or feature I added
+
+- [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality
+
+- [x] my code passes existing test suites
+
+### The Commit Message
+
+- [x] the first line of my commit message includes:
+
+ - [x] an issue number (if applicable), e.g. "(MODULES-xxxx) This is the first line"
+
+ - [x] a short description (50 characters is the soft limit, excluding ticket number(s))
+
+- [x] the body of my commit message:
+
+ - [x] is meaningful
+
+ - [x] uses the imperative, present tense: "change", not "changed" or "changes"
+
+ - [x] includes motivation for the change, and contrasts its implementation with the previous behavior
+
+## Submission
+
+### Pre-requisites
+
+- Make sure you have a [GitHub account](https://github.com/join)
+
+- [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for.
+
+### Push and PR
+
+- Push your changes to your fork
+
+- [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization
+
+## More about commits
+
+ 1. Make separate commits for logically separate changes.
+
+ Please break your commits down into logically consistent units
+ which include new or changed tests relevant to the rest of the
+ change. The goal of doing this is to make the diff easier to
+ read for whoever is reviewing your code. In general, the easier
+ your diff is to read, the more likely someone will be happy to
+ review it and get it into the code base.
+
+ If you are going to refactor a piece of code, please do so as a
+ separate commit from your feature or bug fix changes.
+
+ We also really appreciate changes that include tests to make
+ sure the bug is not re-introduced, and that the feature is not
+ accidentally broken.
+
+ Describe the technical detail of the change(s). If your
+ description starts to get too long, that is a good sign that you
+ probably need to split up your commit into more finely grained
+ pieces.
+
+ Commits which plainly describe the things which help
+ reviewers check the patch and future developers understand the
+ code are much more likely to be merged in with a minimum of
+ bike-shedding or requested changes. Ideally, the commit message
+ would include information, and be in a form suitable for
+ inclusion in the release notes for the version of Puppet that
+ includes them.
+
+ Please also check that you are not introducing any trailing
+ whitespace or other "whitespace errors". You can do this by
+ running "git diff --check" on your changes before you commit.
+
+ 2. Sending your patches
+
+ To submit your changes via a GitHub pull request, we _highly_
+ recommend that you have them on a topic branch, instead of
+ directly on "master".
+ It makes things much easier to keep track of, especially if
+ you decide to work on another thing before your first change
+ is merged in.
+
+ GitHub has some pretty good
+ [general documentation](http://help.github.com/) on using
+ their site. They also have documentation on
+ [creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
+
+ In general, after pushing your topic branch up to your
+ repository on GitHub, you can switch to the branch in the
+ GitHub UI and click "Pull Request" towards the top of the page
+ in order to open a pull request.
+
+ 3. Update the related JIRA issue.
+
+ If there is a JIRA issue associated with the change you
+ submitted, then you should update the ticket to include the
+ location of your branch, along with any other commentary you
+ may wish to make.
+
+# Testing
+
+## Getting Started
+
+Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages,
+or Gems, are required to build, develop, and test this software.
+
+Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to
+install all dependencies needed for this project in the project root by running
+
+```shell
+% bundle install --path .bundle/gems
+Fetching gem metadata from https://rubygems.org/........
+Fetching gem metadata from https://rubygems.org/..
+Using rake (10.1.0)
+Using builder (3.2.2)
+-- 8><-- many more --><8 --
+Using rspec-system-puppet (2.2.0)
+Using serverspec (0.6.3)
+Using rspec-system-serverspec (1.0.0)
+Using bundler (1.3.5)
+Your bundle is complete!
+Use `bundle show [gemname]` to see where a bundled gem is installed.
+```
+
+NOTE: some systems may require you to run this command with sudo.
+
+If you already have those gems installed, make sure they are up-to-date:
+
+```shell
+% bundle update
+```
+
+## Running Tests
+
+With all dependencies in place and up-to-date, run the tests:
+
+### Unit Tests
+
+```shell
+% bundle exec rake spec
+```
+
+This executes all the [rspec tests](http://rspec-puppet.com/) in the directories defined [here](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/699d9fbca1d2489bff1736bb254bb7b7edb32c74/lib/puppetlabs_spec_helper/rake_tasks.rb#L17) and so on.
+rspec tests may have the same kind of dependencies as the module they are testing. Although the module defines these dependencies in its [metadata.json](./metadata.json),
+rspec tests define them in [.fixtures.yml](./fixtures.yml).
+
+### Acceptance Tests
+
+Some Puppet modules also come with acceptance tests, which use [beaker][]. These tests spin up a virtual machine under
+[VirtualBox](https://www.virtualbox.org/), controlled with [Vagrant](http://www.vagrantup.com/), to simulate scripted test
+scenarios. In order to run these, you need both Virtualbox and Vagrant installed on your system.
+
+Run the tests by issuing the following command
+
+```shell
+% bundle exec rake spec_clean
+% bundle exec rspec spec/acceptance
+```
+
+This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
+install Puppet, copy this module, and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
+and then run all the tests under [spec/acceptance](./spec/acceptance).
+
+## Writing Tests
+
+### Unit Tests
+
+When writing unit tests for Puppet, [rspec-puppet][] is your best friend. It provides tons of helper methods for testing your manifests against a
+catalog (e.g. contain_file, contain_package, with_params, etc). It would be ridiculous to try and top rspec-puppet's [documentation][rspec-puppet_docs]
+but here's a tiny sample:
+
+Sample manifest:
+
+```puppet
+file { "a test file":
+ ensure => present,
+ path => "/etc/sample",
+}
+```
+
+Sample test:
+
+```ruby
+it 'does a thing' do
+ expect(subject).to contain_file("a test file").with({:path => "/etc/sample"})
+end
+```
+
+### Acceptance Tests
+
+Writing acceptance tests for Puppet involves [beaker][] and its cousin [beaker-rspec][]. A common pattern for acceptance tests is to create a test manifest, apply it
+twice to check for idempotency or errors, then run expectations.
+
+```ruby
+it 'does an end-to-end thing' do
+ pp = <<-EOF
+ file { 'a test file':
+ ensure => present,
+ path => "/etc/sample",
+ content => "test string",
+ }
+
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+
+end
+
+describe file("/etc/sample") do
+ it { is_expected.to contain "test string" }
+end
+
+```
+
+# If you have commit access to the repository
+
+Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge
+in your changes. The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that
+all changes go through a code review process.**
+
+The record of someone performing the merge is the record that they performed the code review. Again, this should be someone other than the author of the topic branch.
+
+# Get Help
+
+### On the web
+* [Puppet help messageboard](http://puppet.com/community/get-help)
+* [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing)
+* [General GitHub documentation](http://help.github.com/)
+* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
+
+### On chat
+* Slack (slack.puppet.com) #forge-modules, #puppet-dev, #windows, #voxpupuli
+* IRC (freenode) #puppet-dev, #voxpupuli
+
+
+[rspec-puppet]: http://rspec-puppet.com/
+[rspec-puppet_docs]: http://rspec-puppet.com/documentation/
+[beaker]: https://github.com/puppetlabs/beaker
+[beaker-rspec]: https://github.com/puppetlabs/beaker-rspec
diff --git a/code/environments/production/modules/stdlib/Gemfile b/code/environments/production/modules/stdlib/Gemfile
new file mode 100644
index 0000000..37597a3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/Gemfile
@@ -0,0 +1,136 @@
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
+
+def location_for(place_or_version, fake_version = nil)
+ if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
+ [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
+ elsif place_or_version =~ %r{\Afile:\/\/(.*)}
+ ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
+ else
+ [place_or_version, { require: false }]
+ end
+end
+
+def gem_type(place_or_version)
+ if place_or_version =~ %r{\Agit[:@]}
+ :git
+ elsif !place_or_version.nil? && place_or_version.start_with?('file:')
+ :file
+ else
+ :gem
+ end
+end
+
+ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
+minor_version = ruby_version_segments[0..1].join('.')
+
+group :development do
+ gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
+ gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
+ gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
+ gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
+ gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "puppet-blacksmith", '~> 3.4', require: false
+end
+group :system_tests do
+ gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.13')
+ gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
+ gem "beaker-pe", require: false
+ gem "beaker-hostgenerator"
+ gem "beaker-rspec"
+end
+
+puppet_version = ENV['PUPPET_GEM_VERSION']
+puppet_type = gem_type(puppet_version)
+facter_version = ENV['FACTER_GEM_VERSION']
+hiera_version = ENV['HIERA_GEM_VERSION']
+
+def puppet_older_than?(version)
+ puppet_version = ENV['PUPPET_GEM_VERSION']
+ !puppet_version.nil? &&
+ Gem::Version.correct?(puppet_version) &&
+ Gem::Requirement.new("< #{version}").satisfied_by?(Gem::Version.new(puppet_version.dup))
+end
+
+gems = {}
+
+gems['puppet'] = location_for(puppet_version)
+
+# If facter or hiera versions have been specified via the environment
+# variables, use those versions. If not, and if the puppet version is < 3.5.0,
+# use known good versions of both for puppet < 3.5.0.
+if facter_version
+ gems['facter'] = location_for(facter_version)
+elsif puppet_type == :gem && puppet_older_than?('3.5.0')
+ gems['facter'] = ['>= 1.6.11', '<= 1.7.5', require: false]
+end
+
+if hiera_version
+ gems['hiera'] = location_for(ENV['HIERA_GEM_VERSION'])
+elsif puppet_type == :gem && puppet_older_than?('3.5.0')
+ gems['hiera'] = ['>= 1.0.0', '<= 1.3.0', require: false]
+end
+
+if Gem.win_platform? && (puppet_type != :gem || puppet_older_than?('3.5.0'))
+ # For Puppet gems < 3.5.0 (tested as far back as 3.0.0) on Windows
+ if puppet_type == :gem
+ gems['ffi'] = ['1.9.0', require: false]
+ gems['minitar'] = ['0.5.4', require: false]
+ gems['win32-eventlog'] = ['0.5.3', '<= 0.6.5', require: false]
+ gems['win32-process'] = ['0.6.5', '<= 0.7.5', require: false]
+ gems['win32-security'] = ['~> 0.1.2', '<= 0.2.5', require: false]
+ gems['win32-service'] = ['0.7.2', '<= 0.8.8', require: false]
+ else
+ gems['ffi'] = ['~> 1.9.0', require: false]
+ gems['minitar'] = ['~> 0.5.4', require: false]
+ gems['win32-eventlog'] = ['~> 0.5', '<= 0.6.5', require: false]
+ gems['win32-process'] = ['~> 0.6', '<= 0.7.5', require: false]
+ gems['win32-security'] = ['~> 0.1', '<= 0.2.5', require: false]
+ gems['win32-service'] = ['~> 0.7', '<= 0.8.8', require: false]
+ end
+
+ gems['win32-dir'] = ['~> 0.3', '<= 0.4.9', require: false]
+
+ if RUBY_VERSION.start_with?('1.')
+ gems['win32console'] = ['1.3.2', require: false]
+ # sys-admin was removed in Puppet 3.7.0 and doesn't compile under Ruby 2.x
+ gems['sys-admin'] = ['1.5.6', require: false]
+ end
+
+ # Puppet < 3.7.0 requires these.
+ # Puppet >= 3.5.0 gem includes these as requirements.
+ # The following versions are tested to work with 3.0.0 <= puppet < 3.7.0.
+ gems['win32-api'] = ['1.4.8', require: false]
+ gems['win32-taskscheduler'] = ['0.2.2', require: false]
+ gems['windows-api'] = ['0.4.3', require: false]
+ gems['windows-pr'] = ['1.2.3', require: false]
+elsif Gem.win_platform?
+ # If we're using a Puppet gem on Windows which handles its own win32-xxx gem
+ # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
+ gems['win32-dir'] = ['<= 0.4.9', require: false]
+ gems['win32-eventlog'] = ['<= 0.6.5', require: false]
+ gems['win32-process'] = ['<= 0.7.5', require: false]
+ gems['win32-security'] = ['<= 0.2.5', require: false]
+ gems['win32-service'] = ['<= 0.8.8', require: false]
+end
+
+gems.each do |gem_name, gem_params|
+ gem gem_name, *gem_params
+end
+
+# Evaluate Gemfile.local and ~/.gemfile if they exist
+extra_gemfiles = [
+ "#{__FILE__}.local",
+ File.join(Dir.home, '.gemfile'),
+]
+
+extra_gemfiles.each do |gemfile|
+ if File.file?(gemfile) && File.readable?(gemfile)
+ eval(File.read(gemfile), binding)
+ end
+end
+# vim: syntax=ruby
diff --git a/code/environments/production/modules/stdlib/LICENSE b/code/environments/production/modules/stdlib/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/code/environments/production/modules/stdlib/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/code/environments/production/modules/stdlib/MAINTAINERS.md b/code/environments/production/modules/stdlib/MAINTAINERS.md
new file mode 100644
index 0000000..e8004a5
--- /dev/null
+++ b/code/environments/production/modules/stdlib/MAINTAINERS.md
@@ -0,0 +1,6 @@
+## Maintenance
+
+Maintainers:
+ - Puppet Forge Modules Team `forge-modules |at| puppet |dot| com`
+
+Tickets: https://tickets.puppet.com/browse/MODULES. Make sure to set component to `stdlib`.
diff --git a/code/environments/production/modules/stdlib/NOTICE b/code/environments/production/modules/stdlib/NOTICE
new file mode 100644
index 0000000..3c8c03a
--- /dev/null
+++ b/code/environments/production/modules/stdlib/NOTICE
@@ -0,0 +1,23 @@
+stdlib puppet module
+
+Copyright (C) 2011-2016 Puppet Labs, Inc.
+
+and some parts:
+
+Copyright (C) 2011 Krzysztof Wilczynski
+
+
+Puppet Labs can be contacted at: info@puppetlabs.com
+
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/code/environments/production/modules/stdlib/README.md b/code/environments/production/modules/stdlib/README.md
new file mode 100644
index 0000000..ee77698
--- /dev/null
+++ b/code/environments/production/modules/stdlib/README.md
@@ -0,0 +1,2844 @@
+# stdlib
+
+#### Table of Contents
+
+1. [Module Description - What the module does and why it is useful](#module-description)
+1. [Setup - The basics of getting started with stdlib](#setup)
+1. [Usage - Configuration options and additional functionality](#usage)
+1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
+ 1. [Classes](#classes)
+ 1. [Defined Types](#defined-types)
+ 1. [Data Types](#data-types)
+ 1. [Facts](#facts)
+ 1. [Functions](#functions)
+1. [Limitations - OS compatibility, etc.](#limitations)
+1. [Development - Guide for contributing to the module](#development)
+1. [Contributors](#contributors)
+
+
+## Module Description
+
+This module provides a standard library of resources for Puppet modules. Puppet modules make heavy use of this standard library. The stdlib module adds the following resources to Puppet:
+
+ * Stages
+ * Facts
+ * Functions
+ * Defined types
+ * Data types
+ * Providers
+
+> *Note:* As of version 3.7, Puppet Enterprise no longer includes the stdlib module. If you're running Puppet Enterprise, you should install the most recent release of stdlib for compatibility with Puppet modules.
+
+## Setup
+
+[Install](https://docs.puppet.com/puppet/latest/modules_installing.html) the stdlib module to add the functions, facts, and resources of this standard library to Puppet.
+
+If you are authoring a module that depends on stdlib, be sure to [specify dependencies](https://docs.puppet.com/puppet/latest/modules_metadata.html#specifying-dependencies) in your metadata.json.
+
+## Usage
+
+Most of stdlib's features are automatically loaded by Puppet. To use standardized run stages in Puppet, declare this class in your manifest with `include stdlib`.
+
+When declared, stdlib declares all other classes in the module. The only other class currently included in the module is `stdlib::stages`.
+
+The `stdlib::stages` class declares various run stages for deploying infrastructure, language runtimes, and application layers. The high level stages are (in order):
+
+ * setup
+ * main
+ * runtime
+ * setup_infra
+ * deploy_infra
+ * setup_app
+ * deploy_app
+ * deploy
+
+Sample usage:
+
+```puppet
+node default {
+ include stdlib
+ class { java: stage => 'runtime' }
+}
+```
+
+## Reference
+
+* [Public classes](#public-classes)
+* [Private classes](#private-classes)
+* [Defined types](#defined-types)
+* [Data types](#data-types)
+* [Facts](#facts)
+* [Functions](#functions)
+
+### Classes
+
+#### Public classes
+
+The `stdlib` class has no parameters.
+
+#### Private classes
+
+* `stdlib::stages`: Manages a standard set of run stages for Puppet.
+
+### Defined types
+
+#### `file_line`
+
+Ensures that a given line is contained within a file. The implementation matches the full line, including whitespace at the beginning and end. If the line is not contained in the given file, Puppet appends the line to the end of the file to ensure the desired state. Multiple resources can be declared to manage multiple lines in the same file.
+
+Example:
+
+```puppet
+file_line { 'sudo_rule':
+ path => '/etc/sudoers',
+ line => '%sudo ALL=(ALL) ALL',
+}
+
+file_line { 'sudo_rule_nopw':
+ path => '/etc/sudoers',
+ line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',
+}
+```
+
+In the example above, Puppet ensures that both of the specified lines are contained in the file `/etc/sudoers`.
+
+Match Example:
+
+```puppet
+file_line { 'bashrc_proxy':
+ ensure => present,
+ path => '/etc/bashrc',
+ line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128',
+ match => '^export\ HTTP_PROXY\=',
+}
+```
+
+In the example above, `match` looks for a line beginning with 'export' followed by 'HTTP_PROXY' and replaces it with the value in line.
+
+Match Example:
+
+```puppet
+file_line { 'bashrc_proxy':
+ ensure => present,
+ path => '/etc/bashrc',
+ line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128',
+ match => '^export\ HTTP_PROXY\=',
+ append_on_no_match => false,
+}
+```
+
+In this code example, `match` looks for a line beginning with export followed by 'HTTP_PROXY' and replaces it with the value in line. If a match is not found, then no changes are made to the file.
+
+Examples of `ensure => absent`:
+
+This type has two behaviors when `ensure => absent` is set.
+
+The first is to set `match => ...` and `match_for_absence => true`. Match looks for a line beginning with 'export', followed by 'HTTP_PROXY', and then deletes it. If multiple lines match, an error is raised unless the `multiple => true` parameter is set.
+
+The `line => ...` parameter in this example would be accepted but ignored.
+
+For example:
+
+```puppet
+file_line { 'bashrc_proxy':
+ ensure => absent,
+ path => '/etc/bashrc',
+ match => '^export\ HTTP_PROXY\=',
+ match_for_absence => true,
+}
+```
+
+The second way of using `ensure => absent` is to specify a `line => ...` and no match. When ensuring lines are absent, the default behavior is to remove all lines matching. This behavior can't be disabled.
+
+For example:
+
+```puppet
+file_line { 'bashrc_proxy':
+ ensure => absent,
+ path => '/etc/bashrc',
+ line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128',
+}
+```
+
+
+Encoding example:
+
+```puppet
+file_line { "XScreenSaver":
+ ensure => present,
+ path => '/root/XScreenSaver'
+ line => "*lock: 10:00:00",
+ match => '^*lock:',
+ encoding => "iso-8859-1",
+}
+```
+
+Files with special characters that are not valid UTF-8 give the error message "Invalid byte sequence in UTF-8". In this case, determine the correct file encoding and specify it with the `encoding` attribute.
+
+**Autorequires:** If Puppet is managing the file that contains the line being managed, the `file_line` resource autorequires that file.
+
+**Parameters**
+
+All parameters are optional, unless otherwise noted.
+
+##### `after`
+
+Specifies the line after which Puppet adds any new lines using a regular expression. (Existing lines are added in place.)
+
+Values: String containing a regex.
+
+Default value: `undef`.
+
+##### `encoding`
+
+Specifies the correct file encoding.
+
+Values: String specifying a valid Ruby character encoding.
+
+Default: 'UTF-8'.
+
+##### `ensure`: Specifies whether the resource is present.
+
+Values: 'present', 'absent'.
+
+Default value: 'present'.
+
+##### `line`
+
+**Required.**
+
+Sets the line to be added to the file located by the `path` parameter.
+
+Values: String.
+
+##### `match`
+
+Specifies a regular expression to compare against existing lines in the file; if a match is found, it is replaced rather than adding a new line.
+
+Values: String containing a regex.
+
+Default value: `undef`.
+
+
+##### `match_for_absence`
+
+Specifies whether a match should be applied when `ensure => absent`. If set to `true` and match is set, the line that matches is deleted. If set to `false` (the default), match is ignored when `ensure => absent` and the value of `line` is used instead. Ignored when `ensure => present`.
+
+Boolean.
+
+Default value: `false`.
+
+##### `multiple`
+
+Specifies whether `match` and `after` can change multiple lines. If set to `false`, allows file_line to replace only one line and raises an error if more than one will be replaced. If set to `true`, allows file_line to replace one or more lines.
+
+Values: `true`, `false`.
+
+Default value: `false`.
+
+
+##### `name`
+
+Specifies the name to use as the identity of the resource. If you want the resource namevar to differ from the supplied `title` of the resource, specify it with `name`.
+
+Values: String.
+
+Default value: The value of the title.
+
+##### `path`
+
+**Required.**
+
+Specifies the file in which Puppet ensures the line specified by `line`.
+
+Value: String specifying an absolute path to the file.
+
+##### `replace`
+
+Specifies whether the resource overwrites an existing line that matches the `match` parameter when `line` does not otherwise exist.
+
+If set to `false` and a line is found matching the `match` parameter, the line is not placed in the file.
+
+Boolean.
+
+Default value: `true`.
+
+##### `replace_all_matches_not_matching_line`
+
+Replaces all lines matched by `match` parameter, even if `line` already exists in the file.
+
+Default value: `false`.
+
+### Data types
+
+#### `Stdlib::Absolutepath`
+
+A strict absolute path type. Uses a variant of Unixpath and Windowspath types.
+
+Acceptable input examples:
+
+```shell
+/var/log
+```
+
+```shell
+/usr2/username/bin:/usr/local/bin:/usr/bin:.
+```
+
+```shell
+C:\\WINDOWS\\System32
+```
+
+Unacceptable input example:
+
+```shell
+../relative_path
+```
+
+#### `Stdlib::Ensure::Service`
+
+Matches acceptable ensure values for service resources.
+
+Acceptable input examples:
+
+```shell
+stopped
+running
+```
+
+Unacceptable input example:
+
+```shell
+true
+false
+```
+
+#### `Stdlib::Httpsurl`
+
+Matches HTTPS URLs.
+
+Acceptable input example:
+
+```shell
+https://hello.com
+```
+
+Unacceptable input example:
+
+```shell
+httds://notquiteright.org`
+```
+
+#### `Stdlib::Httpurl`
+
+Matches both HTTPS and HTTP URLs.
+
+Acceptable input example:
+
+```shell
+https://hello.com
+
+http://hello.com
+```
+
+Unacceptable input example:
+
+```shell
+httds://notquiteright.org
+```
+
+#### `Stdlib::MAC`
+
+Matches MAC addresses defined in [RFC5342](https://tools.ietf.org/html/rfc5342).
+
+#### `Stdlib::Unixpath`
+
+Matches paths on Unix operating systems.
+
+Acceptable input example:
+
+```shell
+/usr2/username/bin:/usr/local/bin:/usr/bin:
+
+/var/tmp
+```
+
+Unacceptable input example:
+
+```shell
+C:/whatever
+```
+
+#### `Stdlib::Filemode`
+
+Matches valid four digit modes in octal format.
+
+Acceptable input examples:
+
+```shell
+0644
+```
+
+```shell
+1777
+```
+
+Unacceptable input examples:
+
+```shell
+644
+```
+
+```shell
+0999
+```
+
+#### `Stdlib::Windowspath`
+
+Matches paths on Windows operating systems.
+
+Acceptable input example:
+
+```shell
+C:\\WINDOWS\\System32
+
+C:\\
+
+\\\\host\\windows
+```
+
+Valid values: A windows filepath.
+
+#### `Stdlib::Filesource`
+
+Matches paths valid values for the source parameter of the puppet file type.
+
+Acceptable input example:
+
+```shell
+http://example.com
+
+https://example.com
+
+file:///hello/bla
+```
+
+Valid values: A filepath.
+
+#### `Stdlib::Fqdn`
+
+Matches paths on fully qualified domain name.
+
+Acceptable input example:
+
+```shell
+localhost
+
+example.com
+
+www.example.com
+```
+Valid values: Domain name of a server.
+
+#### `Stdlib::Host`
+
+Matches a valid host which could be a valid ipv4, ipv6 or fqdn.
+
+Acceptable input example:
+
+```shell
+localhost
+
+www.example.com
+
+192.0.2.1
+```
+
+Valid values: An IP address or domain name.
+
+#### `Stdlib::Port`
+
+Matches a valid TCP/UDP Port number.
+
+Acceptable input examples:
+
+```shell
+80
+
+443
+
+65000
+```
+
+Valid values: An Integer.
+
+#### `Stdlib::Port::Privileged`
+
+Matches a valid TCP/UDP Privileged port i.e. < 1024.
+
+Acceptable input examples:
+
+```shell
+80
+
+443
+
+1023
+```
+
+Valid values: A number less than 1024.
+
+#### `Stdlib::Port::Unprivileged`
+
+Matches a valid TCP/UDP Privileged port i.e. >= 1024.
+
+Acceptable input examples:
+
+```shell
+1024
+
+1337
+
+65000
+
+```
+
+Valid values: A number more than or equal to 1024.
+
+#### `Stdlib::Base32`
+
+Matches paths a valid base32 string.
+
+Acceptable input example:
+
+```shell
+ASDASDDASD3453453
+
+asdasddasd3453453=
+
+ASDASDDASD3453453==
+```
+
+Valid values: A base32 string.
+
+#### `Stdlib::Base64`
+
+Matches paths a valid base64 string.
+
+Acceptable input example:
+
+```shell
+asdasdASDSADA342386832/746+=
+
+asdasdASDSADA34238683274/6+
+
+asdasdASDSADA3423868327/46+==
+```
+
+Valid values: A base64 string.
+
+#### `Stdlib::Ipv4`
+
+Matches on valid IPv4 addresses.
+
+Acceptable input example:
+
+```shell
+0.0.0.0
+
+192.0.2.1
+
+127.0.0.1
+```
+
+Valid values: An IPv4 address.
+
+#### `Stdlib::Ipv6`
+
+Matches on valid IPv6 addresses.
+
+Acceptable input example:
+
+```shell
+2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+2001:db8::
+
+2001:db8::80
+```
+
+Valid values: An IPv6 address.
+
+#### `Stdlib::Ip_address`
+
+Matches on valid IPv4 or IPv6 addresses.
+
+Acceptable input example:
+
+```shell
+0.0.0.0
+
+127.0.0.1
+
+fe80:0000:0000:0000:0204:61ff:fe9d:f156
+```
+
+Valid values: An IP address.
+
+#### `Stdlib::IP::Address`
+
+Matches any IP address, including both IPv4 and IPv6 addresses. It will match them either with or without an address prefix as used in CIDR format IPv4 addresses.
+
+Examples:
+
+```
+'127.0.0.1' =~ Stdlib::IP::Address # true
+'10.1.240.4/24' =~ Stdlib::IP::Address # true
+'52.10.10.141' =~ Stdlib::IP::Address # true
+'192.168.1' =~ Stdlib::IP::Address # false
+'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address # true
+'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address # true
+```
+
+#### `Stdlib::IP::Address::V4`
+
+Match any string consisting of an IPv4 address in the quad-dotted decimal format, with or without a CIDR prefix. It will not match any abbreviated form (for example, 192.168.1) because these are poorly documented and inconsistently supported.
+
+Examples:
+
+```
+'127.0.0.1' =~ Stdlib::IP::Address::V4 # true
+'10.1.240.4/24' =~ Stdlib::IP::Address::V4 # true
+'192.168.1' =~ Stdlib::IP::Address::V4 # false
+'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V4 # false
+'12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address::V4 # false
+```
+
+Valid values: An IPv4 address.
+
+#### `Stdlib::IP::Address::V6`
+
+Match any string consistenting of an IPv6 address in any of the documented formats in RFC 2373, with or without an address prefix.
+
+Examples:
+
+```
+'127.0.0.1' =~ Stdlib::IP::Address::V6 # false
+'10.1.240.4/24' =~ Stdlib::IP::Address::V6 # false
+'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V6 # true
+'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address::V6 # true
+'FF01::101' =~ Stdlib::IP::Address::V6 # true
+```
+
+Valid values: An IPv6 address.
+
+#### `Stdlib::IP::Address::Nosubnet`
+
+Match the same things as the `Stdlib::IP::Address` alias, except it will not match an address that includes an address prefix (for example, it will match '192.168.0.6' but not '192.168.0.6/24').
+
+Valid values: An IP address with no subnet.
+
+#### `Stdlib::IP::Address::V4::CIDR`
+
+Match an IPv4 address in the CIDR format. It will only match if the address contains an address prefix (for example, it will match '192.168.0.6/24'
+but not '192.168.0.6').
+
+Valid values: An IPv4 address with a CIDR provided eg: '192.186.8.101/105'. This will match anything inclusive of '192.186.8.101' to '192.168.8.105'.
+
+#### `Stdlib::IP::Address::V4::Nosubnet`
+
+Match an IPv4 address only if the address does not contain an address prefix (for example, it will match '192.168.0.6' but not '192.168.0.6/24').
+
+Valid values: An IPv4 address with no subnet.
+
+#### `Stdlib::IP::Address::V6::Full`
+
+Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt), with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
+
+#### `Stdlib::IP::Address::V6::Alternate`
+
+Match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will match addresses with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
+
+#### `Stdlib::IP::Address::V6::Compressed`
+
+Match an IPv6 address which may contain `::` used to compress zeros as documented in section 2.2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will match addresses with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
+
+#### `Stdlib::IP::Address::V6::Nosubnet`
+
+Alias to allow `Stdlib::IP::Address::V6::Nosubnet::Full`, `Stdlib::IP::Address::V6::Nosubnet::Alternate` and `Stdlib::IP::Address::V6::Nosubnet::Compressed`.
+
+#### `Stdlib::IP::Address::V6::Nosubnet::Full`
+
+Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will not match addresses with address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
+
+#### `Stdlib::IP::Address::V6::Nosubnet::Alternate`
+
+Match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will only match addresses without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
+
+#### `Stdlib::IP::Address::V6::Nosubnet::Compressed`
+
+Match an IPv6 address which may contain `::` used to compress zeros as documented in section 2.2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will only match addresses without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
+
+### Facts
+
+#### `package_provider`
+
+Returns the default provider Puppet uses to manage packages on this system.
+
+#### `is_pe`
+
+Returns whether Puppet Enterprise is installed. Does not report anything on platforms newer than PE 3.x.
+
+#### `pe_version`
+
+Returns the version of Puppet Enterprise installed. Does not report anything on platforms newer than PE 3.x.
+
+#### `pe_major_version`
+
+Returns the major version Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.
+
+#### `pe_minor_version`
+
+Returns the minor version of Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.
+
+#### `pe_patch_version`
+
+Returns the patch version of Puppet Enterprise that is installed.
+
+#### `puppet_vardir`
+
+Returns the value of the Puppet vardir setting for the node running Puppet or Puppet agent.
+
+#### `puppet_environmentpath`
+
+Returns the value of the Puppet environment path settings for the node running Puppet or Puppet agent.
+
+#### `puppet_server`
+
+Returns the Puppet agent's `server` value, which is the hostname of the Puppet master with which the agent should communicate.
+
+#### `root_home`
+
+Determines the root home directory.
+
+Determines the root home directory, which depends on your operating system. Generally this is '/root'.
+
+#### `service_provider`
+
+Returns the default provider Puppet uses to manage services on this system
+
+### Functions
+
+#### `abs`
+
+Returns the absolute value of a number. For example, '-34.56' becomes '34.56'.
+
+Argument: A single argument of either an integer or float value.
+
+*Type*: rvalue.
+
+#### `any2array`
+
+Converts any object to an array containing that object. Converts empty argument lists are to empty arrays. Hashes are converted to arrays of alternating keys and values. Arrays are not touched.
+
+*Type*: rvalue.
+
+#### `any2bool`
+
+Converts any object to a Boolean:
+
+* Strings such as 'Y', 'y', '1', 'T', 't', 'TRUE', 'yes', 'true' return `true`.
+* Strings such as '0', 'F', 'f', 'N', 'n', 'FALSE', 'no', 'false' return `false`.
+* Booleans return their original value.
+* A number (or a string representation of a number) greater than 0 returns `true`, otherwise `false`.
+* An undef value returns `false`.
+* Anything else returns `true`.
+
+*Type*: rvalue.
+
+#### `assert_private`
+
+Sets the current class or definition as private. Calling the class or defined type from outside the current module fails.
+
+For example, `assert_private()` called in class `foo::bar` outputs the following message if class is called from outside module `foo`: `Class foo::bar is private.`
+
+To specify the error message you want to use:
+
+```puppet
+assert_private("You're not supposed to do that!")
+```
+
+*Type*: statement.
+
+#### `base64`
+
+Converts a string to and from base64 encoding. Requires an `action` ('encode', 'decode') and either a plain or base64-encoded `string`, and an optional `method` ('default', 'strict', 'urlsafe').
+
+For backward compatibility, `method` is set as `default` if not specified.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+**Examples:**
+
+```puppet
+base64('encode', 'hello')
+base64('encode', 'hello', 'default')
+# return: "aGVsbG8=\n"
+
+base64('encode', 'hello', 'strict')
+# return: "aGVsbG8="
+
+base64('decode', 'aGVsbG8=')
+base64('decode', 'aGVsbG8=\n')
+base64('decode', 'aGVsbG8=', 'default')
+base64('decode', 'aGVsbG8=\n', 'default')
+base64('decode', 'aGVsbG8=', 'strict')
+# return: "hello"
+
+base64('encode', 'https://puppetlabs.com', 'urlsafe')
+# return: "aHR0cHM6Ly9wdXBwZXRsYWJzLmNvbQ=="
+
+base64('decode', 'aHR0cHM6Ly9wdXBwZXRsYWJzLmNvbQ==', 'urlsafe')
+# return: "https://puppetlabs.com"
+```
+
+*Type*: rvalue.
+
+#### `basename`
+
+Returns the `basename` of a path. An optional argument strips the extension. For example:
+
+ * ('/path/to/a/file.ext') returns 'file.ext'
+ * ('relative/path/file.ext') returns 'file.ext'
+ * ('/path/to/a/file.ext', '.ext') returns 'file'
+
+*Type*: rvalue.
+
+#### `bool2num`
+
+Converts a Boolean to a number. Converts values:
+
+* `false`, 'f', '0', 'n', and 'no' to 0.
+* `true`, 't', '1', 'y', and 'yes' to 1.
+
+Argument: a single Boolean or string as an input.
+
+*Type*: rvalue.
+
+#### `bool2str`
+
+Converts a Boolean to a string using optionally supplied arguments. The optional second and third arguments represent what true and false are converted to respectively. If only one argument is given, it is converted from a Boolean to a string containing `true` or `false`.
+
+*Examples:*
+
+```puppet
+bool2str(true) => `true`
+bool2str(true, 'yes', 'no') => 'yes'
+bool2str(false, 't', 'f') => 'f'
+```
+
+Arguments: Boolean.
+
+*Type*: rvalue.
+
+#### `camelcase`
+
+Converts the case of a string or all strings in an array to CamelCase (mixed case).
+
+Arguments: Either an array or string. Returns the same type of argument as it received, but in CamelCase form.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+ *Type*: rvalue.
+
+#### `capitalize`
+
+Capitalizes the first character of a string or array of strings and lowercases the remaining characters of each string.
+
+Arguments: either a single string or an array as an input. *Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+#### `ceiling`
+
+Returns the smallest integer greater than or equal to the argument.
+
+Arguments: A single numeric value.
+
+*Type*: rvalue.
+
+#### `chomp`
+
+Removes the record separator from the end of a string or an array of strings; for example, 'hello\n' becomes 'hello'.
+
+Arguments: a single string or array.
+
+*Type*: rvalue.
+
+#### `chop`
+
+Returns a new string with the last character removed. If the string ends with '\r\n', both characters are removed. Applying `chop` to an empty string returns an empty string. To only remove record separators, use the `chomp` function.
+
+Arguments: A string or an array of strings as input.
+
+*Type*: rvalue.
+
+#### `clamp`
+
+Keeps value within the range [Min, X, Max] by sort based on integer value (parameter order doesn't matter). Strings are converted and compared numerically. Arrays of values are flattened into a list for further handling. For example:
+
+ * `clamp('24', [575, 187])` returns 187.
+ * `clamp(16, 88, 661)` returns 88.
+ * `clamp([4, 3, '99'])` returns 4.
+
+Arguments: strings, arrays, or numerics.
+
+*Type*: rvalue.
+
+#### `concat`
+
+Appends the contents of multiple arrays onto the first array given. For example:
+
+ * `concat(['1','2','3'],'4')` returns ['1','2','3','4'].
+ * `concat(['1','2','3'],'4',['5','6','7'])` returns ['1','2','3','4','5','6','7'].
+
+*Type*: rvalue.
+
+#### `convert_base`
+
+Converts a given integer or base 10 string representing an integer to a specified base, as a string. For example:
+
+ * `convert_base(5, 2)` results in: '101'
+ * `convert_base('254', '16')` results in: 'fe'
+
+#### `count`
+
+If called with only an array, counts the number of elements that are **not** nil or `undef`. If called with a second argument, counts the number of elements in an array that matches the second argument.
+
+*Type*: rvalue.
+
+#### `deep_merge`
+
+Recursively merges two or more hashes together and returns the resulting hash.
+
+```puppet
+$hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+$hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
+$merged_hash = deep_merge($hash1, $hash2)
+```
+
+The resulting hash is equivalent to:
+
+```puppet
+$merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
+```
+
+If there is a duplicate key that is a hash, they are recursively merged. If there is a duplicate key that is not a hash, the key in the rightmost hash takes precedence.
+
+*Type*: rvalue.
+
+#### `defined_with_params`
+
+Takes a resource reference and an optional hash of attributes. Returns `true` if a resource with the specified attributes has already been added to the catalog. Returns `false` otherwise.
+
+```puppet
+user { 'dan':
+ ensure => present,
+}
+
+if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
+ user { 'dan': ensure => present, }
+}
+```
+
+*Type*: rvalue.
+
+#### `delete`
+
+Deletes all instances of a given element from an array, substring from a string, or key from a hash.
+
+For example:
+
+* `delete(['a','b','c','b'], 'b')` returns ['a','c'].
+* `delete('abracadabra', 'bra')` returns 'acada'.
+* `delete({'a' => 1,'b' => 2,'c' => 3},['b','c'])` returns {'a'=> 1}.
+* `delete(['ab', 'b'], 'b')` returns ['ab'].
+
+*Type*: rvalue.
+
+#### `delete_at`
+
+Deletes a determined indexed value from an array.
+
+For example: `delete_at(['a','b','c'], 1)` returns ['a','c'].
+
+*Type*: rvalue.
+
+#### `delete_regex`
+
+Deletes all instances of a given element from an array or hash that match a provided regular expression. A string is treated as a one-item array.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+
+For example
+
+* `delete_regex(['a','b','c','b'], 'b')` returns ['a','c'].
+* `delete_regex({'a' => 1,'b' => 2,'c' => 3},['b','c'])` returns {'a'=> 1}.
+* `delete_regex(['abf', 'ab', 'ac'], '^ab.*')` returns ['ac'].
+* `delete_regex(['ab', 'b'], 'b')` returns ['ab'].
+
+*Type*: rvalue.
+
+#### `delete_values`
+
+Deletes all instances of a given value from a hash.
+
+For example:
+
+* `delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B')` returns {'a'=>'A','c'=>'C','B'=>'D'}
+
+*Type*: rvalue.
+
+#### `delete_undef_values`
+
+Deletes all instances of the `undef` value from an array or hash.
+
+For example:
+
+* `$hash = delete_undef_values({a=>'A', b=>'', c=>`undef`, d => false})` returns {a => 'A', b => '', d => false}.
+
+*Type*: rvalue.
+
+#### `deprecation`
+
+Prints deprecation warnings and logs a warning once for a given key:
+
+```puppet
+deprecation(key, message)
+```
+
+Arguments:
+
+* A string specifying the key: To keep the number of messages low during the lifetime of a Puppet process, only one message per key is logged.
+* A string specifying the message: the text to be logged.
+
+*Type*: Statement.
+
+**Settings that affect `deprecation`**
+
+Other settings in Puppet affect the stdlib `deprecation` function:
+
+* [`disable_warnings`](https://docs.puppet.com/puppet/latest/reference/configuration.html#disablewarnings)
+* [`max_deprecations`](https://docs.puppet.com/puppet/latest/reference/configuration.html#maxdeprecations)
+* [`strict`](https://docs.puppet.com/puppet/latest/reference/configuration.html#strict):
+
+ * `error`: Fails immediately with the deprecation message
+ * `off`: Output emits no messages.
+ * `warning`: Logs all warnings. This is the default setting.
+
+* The environment variable `STDLIB_LOG_DEPRECATIONS`
+
+ Specifies whether or not to log deprecation warnings. This is especially useful for automated tests to avoid flooding your logs before you are ready to migrate.
+
+ This variable is Boolean, with the following effects:
+
+ * `true`: Functions log a warning.
+ * `false`: No warnings are logged.
+ * No value set: Puppet 4 emits warnings, but Puppet 3 does not.
+
+#### `difference`
+
+Returns the difference between two arrays. The returned array is a copy of the original array, removing any items that also appear in the second array.
+
+For example:
+
+* `difference(["a","b","c"],["b","c","d"])` returns ["a"].
+
+*Type*: rvalue.
+
+#### `dig`
+
+**Deprecated:** This function has been replaced with a built-in [`dig`](https://docs.puppet.com/puppet/latest/function.html#dig) function as of Puppet 4.5.0. Use [`dig44()`](#dig44) for backwards compatibility or use the new version.
+
+Retrieves a value within multiple layers of hashes and arrays via an array of keys containing a path. The function goes through the structure by each path component and tries to return the value at the end of the path.
+
+In addition to the required path argument, the function accepts the default argument. It is returned if the path is not correct, if no value was found, or if any other error has occurred.
+
+```ruby
+$data = {
+ 'a' => {
+ 'b' => [
+ 'b1',
+ 'b2',
+ 'b3',
+ ]
+ }
+}
+
+$value = dig($data, ['a', 'b', 2])
+# $value = 'b3'
+
+# with all possible options
+$value = dig($data, ['a', 'b', 2], 'not_found')
+# $value = 'b3'
+
+# using the default value
+$value = dig($data, ['a', 'b', 'c', 'd'], 'not_found')
+# $value = 'not_found'
+```
+
+1. **$data** The data structure we are working with.
+2. **['a', 'b', 2]** The path array.
+3. **'not_found'** The default value. It is returned if nothing is found.
+
+Default value: `undef`.
+
+*Type*: rvalue.
+
+#### `dig44`
+
+Retrieves a value within multiple layers of hashes and arrays via an array of keys containing a path. The function goes through the structure by each path component and tries to return the value at the end of the path.
+
+In addition to the required path argument, the function accepts the default argument. It is returned if the path is incorrect, if no value was found, or if any other error has occurred.
+
+```ruby
+$data = {
+ 'a' => {
+ 'b' => [
+ 'b1',
+ 'b2',
+ 'b3',
+ ]
+ }
+}
+
+$value = dig44($data, ['a', 'b', 2])
+# $value = 'b3'
+
+# with all possible options
+$value = dig44($data, ['a', 'b', 2], 'not_found')
+# $value = 'b3'
+
+# using the default value
+$value = dig44($data, ['a', 'b', 'c', 'd'], 'not_found')
+# $value = 'not_found'
+```
+
+*Type*: rvalue.
+
+1. **$data** The data structure we are working with.
+2. **['a', 'b', 2]** The path array.
+3. **'not_found'** The default value. It will be returned if nothing is found.
+ (optional, defaults to `undef`)
+
+#### `dirname`
+
+Returns the `dirname` of a path. For example, `dirname('/path/to/a/file.ext')` returns '/path/to/a'.
+
+*Type*: rvalue.
+
+#### `dos2unix`
+
+Returns the Unix version of the given string. Very useful when using a File resource with a cross-platform template.
+
+```puppet
+file { $config_file:
+ ensure => file,
+ content => dos2unix(template('my_module/settings.conf.erb')),
+}
+```
+
+See also [unix2dos](#unix2dos).
+
+*Type*: rvalue.
+
+#### `downcase`
+
+Converts the case of a string or of all strings in an array to lowercase.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+*Type*: rvalue.
+
+#### `empty`
+
+**Deprecated:** This function has been replaced with a built-in [`empty`](https://docs.puppet.com/puppet/latest/function.html#empty) function as of Puppet 5.5.0.
+
+Returns `true` if the argument is an array or hash that contains no elements, or an empty string. Returns `false` when the argument is a numerical value.
+
+*Type*: rvalue.
+
+#### `enclose_ipv6`
+
+Takes an array of IP addresses and encloses the ipv6 addresses with square brackets.
+
+*Type*: rvalue.
+
+#### `ensure_packages`
+
+Takes a list of packages in an array or hash and installs them only if they don't already exist. Optionally takes a hash as a second parameter to be passed as the third argument to the `ensure_resource()` or `ensure_resources()` function.
+
+*Type*: statement.
+
+For an array:
+
+```puppet
+ensure_packages(['ksh','openssl'], {'ensure' => 'present'})
+```
+
+For a hash:
+
+```puppet
+ensure_packages({'ksh' => { ensure => '20120801-1' } , 'mypackage' => { source => '/tmp/myrpm-1.0.0.x86_64.rpm', provider => "rpm" }}, {'ensure' => 'present'})
+```
+
+#### `ensure_resource`
+
+Takes a resource type, title, and a hash of attributes that describe the resource(s).
+
+```
+user { 'dan':
+ ensure => present,
+}
+```
+
+This example only creates the resource if it does not already exist:
+
+ `ensure_resource('user', 'dan', {'ensure' => 'present' })`
+
+If the resource already exists, but does not match the specified parameters, this function attempts to recreate the resource, leading to a duplicate resource definition error.
+
+An array of resources can also be passed in, and each will be created with the type and parameters specified if it doesn't already exist.
+
+`ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})`
+
+*Type*: statement.
+
+#### `ensure_resources`
+
+Creates resource declarations from a hash, but doesn't conflict with resources that are already declared.
+
+Specify a resource type and title and a hash of attributes that describe the resource(s).
+
+```puppet
+user { 'dan':
+ gid => 'mygroup',
+ ensure => present,
+}
+
+ensure_resources($user)
+```
+
+Pass in a hash of resources. Any listed resources that don't already exist will be created with the type and parameters specified:
+
+ ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' } , 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
+
+From Hiera backend:
+
+```yaml
+userlist:
+ dan:
+ gid: 'mygroup'
+ uid: '600'
+ alex:
+ gid: 'mygroup'
+```
+
+```puppet
+ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
+```
+
+#### `fact`
+
+Return the value of a given fact. Supports the use of dot-notation for referring to structured facts. If a fact requested does not exist, returns Undef.
+
+Example usage:
+
+```puppet
+fact('kernel')
+fact('osfamily')
+fact('os.architecture')
+```
+
+Array indexing:
+
+```puppet
+$first_processor = fact('processors.models.0')
+$second_processor = fact('processors.models.1')
+```
+
+Fact containing a "." in the fact name:
+
+```puppet
+fact('vmware."VRA.version"')
+```
+
+#### `flatten`
+
+**Deprecated:** This function has been replaced with a built-in [`flatten`](https://docs.puppet.com/puppet/latest/function.html#flatten) function as of Puppet 5.5.0.
+
+Flattens deeply nested arrays and returns a single flat array as a result.
+
+For example, `flatten(['a', ['b', ['c']]])` returns ['a','b','c'].
+
+*Type*: rvalue.
+
+#### `floor`
+
+Returns the largest integer less than or equal to the argument.
+
+Arguments: A single numeric value.
+
+*Type*: rvalue.
+
+#### `fqdn_rand_string`
+
+Generates a random alphanumeric string, combining the `$fqdn` fact and an optional seed for repeatable randomness. Optionally, you can specify a character set for the function (defaults to alphanumeric).
+
+*Usage:*
+
+```puppet
+fqdn_rand_string(LENGTH, [CHARSET], [SEED])
+```
+
+*Examples:*
+
+```puppet
+fqdn_rand_string(10)
+fqdn_rand_string(10, 'ABCDEF!@#$%^')
+fqdn_rand_string(10, '', 'custom seed')
+```
+
+Arguments:
+
+* An integer, specifying the length of the resulting string.
+* Optionally, a string specifying the character set.
+* Optionally, a string specifying the seed for repeatable randomness.
+
+*Type*: rvalue.
+
+#### `fqdn_rotate`
+
+Rotates an array or string a random number of times, combining the `$fqdn` fact and an optional seed for repeatable randomness.
+
+*Usage:*
+
+```puppet
+fqdn_rotate(VALUE, [SEED])
+```
+
+*Examples:*
+
+```puppet
+fqdn_rotate(['a', 'b', 'c', 'd'])
+fqdn_rotate('abcd')
+fqdn_rotate([1, 2, 3], 'custom seed')
+```
+
+*Type*: rvalue.
+
+#### `fqdn_uuid`
+
+Returns a [RFC 4122](https://tools.ietf.org/html/rfc4122) valid version 5 UUID based on an FQDN string under the DNS namespace:
+
+ * fqdn_uuid('puppetlabs.com') returns '9c70320f-6815-5fc5-ab0f-debe68bf764c'
+ * fqdn_uuid('google.com') returns '64ee70a4-8cc1-5d25-abf2-dea6c79a09c8'
+
+*Type*: rvalue.
+
+#### `get_module_path`
+
+Returns the absolute path of the specified module for the current environment.
+
+```puppet
+$module_path = get_module_path('stdlib')
+```
+
+*Type*: rvalue.
+
+#### `getparam`
+
+Returns the value of a resource's parameter.
+
+Arguments: A resource reference and the name of the parameter.
+
+For example, the following returns 'param_value':
+
+```puppet
+define example_resource($param) {
+}
+
+example_resource { "example_resource_instance":
+ param => "param_value"
+}
+
+getparam(Example_resource["example_resource_instance"], "param")
+```
+
+*Type*: rvalue.
+
+#### `getvar`
+
+Looks up a variable in a remote namespace.
+
+For example:
+
+```puppet
+$foo = getvar('site::data::foo')
+# Equivalent to $foo = $site::data::foo
+```
+
+This is useful if the namespace itself is stored in a string:
+
+```puppet
+$datalocation = 'site::data'
+$bar = getvar("${datalocation}::bar")
+# Equivalent to $bar = $site::data::bar
+```
+
+*Type*: rvalue.
+
+#### `glob`
+
+Returns an array of strings of paths matching path patterns.
+
+Arguments: A string or an array of strings specifying path patterns.
+
+```puppet
+$confs = glob(['/etc/**/*.conf', '/opt/**/*.conf'])
+```
+
+*Type*: rvalue.
+
+#### `grep`
+
+Searches through an array and returns any elements that match the provided regular expression.
+
+For example, `grep(['aaa','bbb','ccc','aaaddd'], 'aaa')` returns ['aaa','aaaddd'].
+
+*Type*: rvalue.
+
+#### `has_interface_with`
+
+Returns a Boolean based on kind and value:
+
+ * macaddress
+ * netmask
+ * ipaddress
+ * network
+
+*Examples:*
+
+```puppet
+has_interface_with("macaddress", "x:x:x:x:x:x")
+has_interface_with("ipaddress", "127.0.0.1") => true
+```
+
+If no kind is given, then the presence of the interface is checked:
+
+```puppet
+has_interface_with("lo") => true
+```
+
+*Type*: rvalue.
+
+#### `has_ip_address`
+
+Returns `true` if the client has the requested IP address on some interface. This function iterates through the `interfaces` fact and checks the `ipaddress_IFACE` facts, performing a simple string comparison.
+
+Arguments: A string specifying an IP address.
+
+*Type*: rvalue.
+
+#### `has_ip_network`
+
+Returns `true` if the client has an IP address within the requested network. This function iterates through the `interfaces` fact and checks the `network_IFACE` facts, performing a simple string comparision.
+
+Arguments: A string specifying an IP address.
+
+*Type*: rvalue.
+
+#### `has_key`
+
+Determines if a hash has a certain key value.
+
+*Example*:
+
+```
+$my_hash = {'key_one' => 'value_one'}
+if has_key($my_hash, 'key_two') {
+ notice('we will not reach here')
+}
+if has_key($my_hash, 'key_one') {
+ notice('this will be printed')
+}
+```
+
+*Type*: rvalue.
+
+#### `hash`
+
+Converts an array into a hash.
+
+For example, `hash(['a',1,'b',2,'c',3])` returns {'a'=>1,'b'=>2,'c'=>3}.
+
+*Type*: rvalue.
+
+#### `intersection`
+
+Returns an array an intersection of two.
+
+For example, `intersection(["a","b","c"],["b","c","d"])` returns ["b","c"].
+
+*Type*: rvalue.
+
+#### `is_a`
+
+Boolean check to determine whether a variable is of a given data type. This is equivalent to the `=~` type checks. This function is available only in Puppet 4, or in Puppet 3 with the "future" parser.
+
+```
+foo = 3
+$bar = [1,2,3]
+$baz = 'A string!'
+
+if $foo.is_a(Integer) {
+ notify { 'foo!': }
+}
+if $bar.is_a(Array) {
+ notify { 'bar!': }
+}
+if $baz.is_a(String) {
+ notify { 'baz!': }
+}
+```
+
+* See the [the Puppet type system](https://docs.puppetlabs.com/latest/type.html#about-resource-types) for more information about types.
+* See the [`assert_type()`](https://docs.puppetlabs.com/latest/function.html#asserttype) function for flexible ways to assert the type of a value.
+
+#### `is_absolute_path`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the given path is absolute.
+
+*Type*: rvalue.
+
+#### `is_array`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the variable passed to this function is an array.
+
+*Type*: rvalue.
+
+#### `is_bool`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the variable passed to this function is a Boolean.
+
+*Type*: rvalue.
+
+#### `is_domain_name`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the string passed to this function is a syntactically correct domain name.
+
+*Type*: rvalue.
+
+#### `is_email_address`
+
+Returns true if the string passed to this function is a valid email address.
+
+*Type*: rvalue.
+
+
+#### `is_float`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the variable passed to this function is a float.
+
+*Type*: rvalue.
+
+#### `is_function_available`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Accepts a string as an argument and determines whether the Puppet runtime has access to a function by that name. It returns `true` if the function exists, `false` if not.
+
+*Type*: rvalue.
+
+#### `is_hash`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the variable passed to this function is a hash.
+
+*Type*: rvalue.
+
+#### `is_integer`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the variable returned to this string is an integer.
+
+*Type*: rvalue.
+
+#### `is_ip_address`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the string passed to this function is a valid IP address.
+
+*Type*: rvalue.
+
+#### `is_ipv6_address`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the string passed to this function is a valid IPv6 address.
+
+*Type*: rvalue.
+
+#### `is_ipv4_address`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the string passed to this function is a valid IPv4 address.
+
+*Type*: rvalue.
+
+#### `is_mac_address`
+
+Returns `true` if the string passed to this function is a valid MAC address.
+
+*Type*: rvalue.
+
+#### `is_numeric`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the variable passed to this function is a number.
+
+*Type*: rvalue.
+
+#### `is_string`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Returns `true` if the variable passed to this function is a string.
+
+*Type*: rvalue.
+
+#### `join`
+
+**Deprecated:** This function has been replaced with a built-in [`join`](https://docs.puppet.com/puppet/latest/function.html#join) function as of Puppet 5.5.0.
+
+Joins an array into a string using a separator. For example, `join(['a','b','c'], ",")` results in: "a,b,c".
+
+*Type*: rvalue.
+
+#### `join_keys_to_values`
+
+Joins each key of a hash to that key's corresponding value with a separator, returning the result as strings.
+
+If a value is an array, the key is prefixed to each element. The return value is a flattened array.
+
+For example, `join_keys_to_values({'a'=>1,'b'=>[2,3]}, " is ")` results in ["a is 1","b is 2","b is 3"].
+
+*Type*: rvalue.
+
+#### `keys`
+
+**Deprecated:** This function has been replaced with a built-in [`keys`](https://docs.puppet.com/puppet/latest/function.html#keys) function as of Puppet 5.5.0.
+
+Returns the keys of a hash as an array.
+
+*Type*: rvalue.
+
+#### `length`
+
+**Deprecated:** This function has been replaced with a built-in [`length`](https://docs.puppet.com/puppet/latest/function.html#length) function as of Puppet 5.5.0.
+
+Returns the length of a given string, array or hash. Replaces the deprecated `size()` function.
+
+*Type*: rvalue.
+
+#### `loadyaml`
+
+Loads a YAML file containing an array, string, or hash, and returns the data in the corresponding native data type.
+
+For example:
+
+```puppet
+$myhash = loadyaml('/etc/puppet/data/myhash.yaml')
+```
+
+The second parameter is returned if the file was not found or could not be parsed.
+
+For example:
+
+```puppet
+$myhash = loadyaml('no-file.yaml', {'default'=>'value'})
+```
+
+*Type*: rvalue.
+
+#### `loadjson`
+
+Loads a JSON file containing an array, string, or hash, and returns the data in the corresponding native data type.
+
+For example:
+
+```puppet
+$myhash = loadjson('/etc/puppet/data/myhash.json')
+```
+
+The second parameter is returned if the file was not found or could not be parsed.
+
+For example:
+
+```puppet
+ $myhash = loadjson('no-file.json', {'default'=>'value'})
+ ```
+
+*Type*: rvalue.
+
+#### `load_module_metadata`
+
+Loads the metadata.json of a target module. Can be used to determine module version and authorship for dynamic support of modules.
+
+```puppet
+$metadata = load_module_metadata('archive')
+notify { $metadata['author']: }
+```
+
+When a module's metadata file is absent, the catalog compilation fails. To avoid this failure:
+
+```
+$metadata = load_module_metadata('mysql', true)
+if empty($metadata) {
+ notify { "This module does not have a metadata.json file.": }
+}
+```
+
+*Type*: rvalue.
+
+#### `lstrip`
+
+Strips spaces to the left of a string.
+
+*Type*: rvalue.
+
+#### `max`
+
+Returns the highest value of all arguments. Requires at least one argument.
+
+Arguments: A numeric or a string representing a number.
+
+*Type*: rvalue.
+
+#### `member`
+
+This function determines if a variable is a member of an array. The variable can be a string, an array, or a fixnum.
+
+For example, `member(['a','b'], 'b')` and `member(['a','b','c'], ['b','c'])` return `true`, while `member(['a','b'], 'c')` and `member(['a','b','c'], ['c','d'])` return `false`.
+
+*Note*: This function does not support nested arrays. If the first argument contains nested arrays, it will not recurse through them.
+
+*Type*: rvalue.
+
+#### `merge`
+
+Merges two or more hashes together and returns the resulting hash.
+
+*Example*:
+
+```puppet
+$hash1 = {'one' => 1, 'two' => 2}
+$hash2 = {'two' => 'dos', 'three' => 'tres'}
+$merged_hash = merge($hash1, $hash2)
+# The resulting hash is equivalent to:
+# $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'}
+```
+
+When there is a duplicate key, the key in the rightmost hash takes precedence.
+
+*Type*: rvalue.
+
+#### `min`
+
+Returns the lowest value of all arguments. Requires at least one argument.
+
+Arguments: A numeric or a string representing a number.
+
+*Type*: rvalue.
+
+#### `num2bool`
+
+Converts a number or a string representation of a number into a true Boolean. Zero or anything non-numeric becomes `false`. Numbers greater than 0 become `true`.
+
+*Type*: rvalue.
+
+#### `parsejson`
+
+Converts a string of JSON into the correct Puppet structure (as a hash, array, string, integer, or a combination of such).
+
+Arguments:
+* The JSON string to convert, as a first argument.
+* Optionally, the result to return if conversion fails, as a second error.
+
+*Type*: rvalue.
+
+#### `parseyaml`
+
+Converts a string of YAML into the correct Puppet structure.
+
+Arguments:
+* The YAML string to convert, as a first argument.
+* Optionally, the result to return if conversion fails, as a second error.
+
+*Type*: rvalue.
+
+#### `pick`
+
+From a list of values, returns the first value that is not undefined or an empty string. Takes any number of arguments, and raises an error if all values are undefined or empty.
+
+```puppet
+$real_jenkins_version = pick($::jenkins_version, '1.449')
+```
+
+*Type*: rvalue.
+
+#### `pick_default`
+
+Returns the first value in a list of values. Unlike the `pick()` function, `pick_default()` does not fail if all arguments are empty. This allows it to use an empty value as default.
+
+*Type*: rvalue.
+
+#### `prefix`
+
+Applies a prefix to all elements in an array, or to the keys in a hash.
+
+For example:
+
+* `prefix(['a','b','c'], 'p')` returns ['pa','pb','pc'].
+* `prefix({'a'=>'b','b'=>'c','c'=>'d'}, 'p')` returns {'pa'=>'b','pb'=>'c','pc'=>'d'}.
+
+*Type*: rvalue.
+
+#### `pry`
+
+Invokes a pry debugging session in the current scope object. Useful for debugging manifest code at specific points during a compilation. Should be used only when running `puppet apply` or running a Puppet master in the foreground. Requires the `pry` gem to be installed in Puppet's rubygems.
+
+*Examples:*
+
+```puppet
+pry()
+```
+
+In a pry session, useful commands include:
+
+* Run `catalog` to see the contents currently compiling catalog.
+* Run `cd catalog` and `ls` to see catalog methods and instance variables.
+* Run `@resource_table` to see the current catalog resource table.
+
+#### `pw_hash`
+
+Hashes a password using the crypt function. Provides a hash usable on most POSIX systems.
+
+The first argument to this function is the password to hash. If it is `undef` or an empty string, this function returns `undef`.
+
+The second argument to this function is which type of hash to use. It will be converted into the appropriate crypt(3) hash specifier. Valid hash types are:
+
+|Hash type |Specifier|
+|---------------------|---------|
+|MD5 |1 |
+|SHA-256 |5 |
+|SHA-512 (recommended)|6 |
+
+The third argument to this function is the salt to use.
+
+This function uses the Puppet master's implementation of crypt(3). If your environment contains several different operating systems, ensure that they are compatible before using this function.
+
+*Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+#### `range`
+
+Extrapolates a range as an array when given in the form of '(start, stop)'. For example, `range("0", "9")` returns [0,1,2,3,4,5,6,7,8,9]. Zero-padded strings are converted to integers automatically, so `range("00", "09")` returns [0,1,2,3,4,5,6,7,8,9].
+
+Non-integer strings are accepted:
+
+* `range("a", "c")` returns ["a","b","c"].
+* `range("host01", "host10")` returns ["host01", "host02", ..., "host09", "host10"].
+
+You must explicitly include trailing zeros, or the underlying Ruby function fails.
+
+Passing a third argument causes the generated range to step by that interval. For example:
+
+* `range("0", "9", "2")` returns ["0","2","4","6","8"].
+
+*Type*: rvalue.
+
+#### `regexpescape`
+
+Regexp escape a string or array of strings. Requires either a single string or an array as an input.
+
+*Type*: rvalue.
+
+#### `reject`
+
+Searches through an array and rejects all elements that match the provided regular expression.
+
+For example, `reject(['aaa','bbb','ccc','aaaddd'], 'aaa')` returns ['bbb','ccc'].
+
+*Type*: rvalue.
+
+#### `reverse`
+
+Reverses the order of a string or array.
+
+#### `round`
+
+ Rounds a number to the nearest integer
+
+*Type*: rvalue.
+
+#### `rstrip`
+
+Strips spaces to the right of the string.
+
+*Type*: rvalue.
+
+#### `seeded_rand`
+
+Takes an integer max value and a string seed value and returns a repeatable random integer smaller than max. Similar to `fqdn_rand`, but does not add node specific data to the seed.
+
+*Type*: rvalue.
+
+#### `shell_escape`
+
+Escapes a string so that it can be safely used in a Bourne shell command line. Note that the resulting string should be used unquoted and is not intended for use in either double or single quotes. This function behaves the same as Ruby's `Shellwords.shellescape()` function; see the [Ruby documentation](http://ruby-doc.org/stdlib-2.3.0/libdoc/shellwords/rdoc/Shellwords.html#method-c-shellescape).
+
+For example:
+
+```puppet
+shell_escape('foo b"ar') => 'foo\ b\"ar'
+```
+
+*Type*: rvalue.
+
+#### `shell_join`
+
+Builds a command line string from a given array of strings. Each array item is escaped for Bourne shell. All items are then joined together, with a single space in between. This function behaves the same as Ruby's `Shellwords.shelljoin()` function; see the [Ruby documentation](http://ruby-doc.org/stdlib-2.3.0/libdoc/shellwords/rdoc/Shellwords.html#method-c-shelljoin).
+
+For example:
+
+```puppet
+shell_join(['foo bar', 'ba"z']) => 'foo\ bar ba\"z'
+```
+
+*Type*: rvalue.
+
+#### `shell_split`
+
+Splits a string into an array of tokens. This function behaves the same as Ruby's `Shellwords.shellsplit()` function; see the [ruby documentation](http://ruby-doc.org/stdlib-2.3.0/libdoc/shellwords/rdoc/Shellwords.html#method-c-shellsplit).
+
+*Example:*
+
+```puppet
+shell_split('foo\ bar ba\"z') => ['foo bar', 'ba"z']
+```
+
+*Type*: rvalue.
+
+#### `shuffle`
+
+Randomizes the order of a string or array elements.
+
+*Type*: rvalue.
+
+#### `size`
+
+Returns the number of elements in a string, an array or a hash. This function will be deprecated in a future release. For Puppet 4, use the `length` function.
+
+*Type*: rvalue.
+
+#### `sprintf_hash`
+
+Performs printf-style formatting with named references of text.
+
+The first parameter is a format string describing how to format the rest of the parameters in the hash. See Ruby documentation for [`Kernel::sprintf`](https://ruby-doc.org/core-2.4.2/Kernel.html#method-i-sprintf) for details about this function.
+
+For example:
+
+```puppet
+$output = sprintf_hash('String: %<foo>s / number converted to binary: %<number>b',
+ { 'foo' => 'a string', 'number' => 5 })
+# $output = 'String: a string / number converted to binary: 101'
+```
+
+*Type*: rvalue
+
+#### `sort`
+
+Sorts strings and arrays lexically.
+
+*Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+#### `squeeze`
+
+Replaces consecutive repeats (such as 'aaaa') in a string with a single character. Returns a new string.
+
+*Type*: rvalue.
+
+#### `str2bool`
+
+Converts certain strings to a Boolean. This attempts to convert strings that contain the values '1', 'true', 't', 'y', or 'yes' to `true`. Strings that contain values '0', 'false', 'f', 'n', or 'no', or that are an empty string or undefined are converted to `false`. Any other value causes an error. These checks are case insensitive.
+
+*Type*: rvalue.
+
+#### `str2saltedsha512`
+
+Converts a string to a salted-SHA512 password hash, used for OS X versions 10.7 or greater. Returns a hex version of a salted-SHA512 password hash, which can be inserted into Puppet manifests as a valid password attribute.
+
+*Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+#### `strftime`
+
+Returns formatted time.
+
+For example, `strftime("%s")` returns the time since Unix epoch, and `strftime("%Y-%m-%d")` returns the date.
+
+Arguments: A string specifying the time in `strftime` format. See the Ruby [strftime](https://ruby-doc.org/core-2.1.9/Time.html#method-i-strftime) documentation for details.
+
+*Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+*Format:*
+
+* `%a`: The abbreviated weekday name ('Sun')
+* `%A`: The full weekday name ('Sunday')
+* `%b`: The abbreviated month name ('Jan')
+* `%B`: The full month name ('January')
+* `%c`: The preferred local date and time representation
+* `%C`: Century (20 in 2009)
+* `%d`: Day of the month (01..31)
+* `%D`: Date (%m/%d/%y)
+* `%e`: Day of the month, blank-padded ( 1..31)
+* `%F`: Equivalent to %Y-%m-%d (the ISO 8601 date format)
+* `%h`: Equivalent to %b
+* `%H`: Hour of the day, 24-hour clock (00..23)
+* `%I`: Hour of the day, 12-hour clock (01..12)
+* `%j`: Day of the year (001..366)
+* `%k`: Hour, 24-hour clock, blank-padded ( 0..23)
+* `%l`: Hour, 12-hour clock, blank-padded ( 0..12)
+* `%L`: Millisecond of the second (000..999)
+* `%m`: Month of the year (01..12)
+* `%M`: Minute of the hour (00..59)
+* `%n`: Newline (\n)
+* `%N`: Fractional seconds digits, default is 9 digits (nanosecond)
+ * `%3N`: Millisecond (3 digits)
+ * `%6N`: Microsecond (6 digits)
+ * `%9N`: Nanosecond (9 digits)
+* `%p`: Meridian indicator ('AM' or 'PM')
+* `%P`: Meridian indicator ('am' or 'pm')
+* `%r`: Time, 12-hour (same as %I:%M:%S %p)
+* `%R`: Time, 24-hour (%H:%M)
+* `%s`: Number of seconds since the Unix epoch, 1970-01-01 00:00:00 UTC.
+* `%S`: Second of the minute (00..60)
+* `%t`: Tab character ( )
+* `%T`: Time, 24-hour (%H:%M:%S)
+* `%u`: Day of the week as a decimal, Monday being 1. (1..7)
+* `%U`: Week number of the current year, starting with the first Sunday as the first day of the first week (00..53)
+* `%v`: VMS date (%e-%b-%Y)
+* `%V`: Week number of year according to ISO 8601 (01..53)
+* `%W`: Week number of the current year, starting with the first Monday as the first day of the first week (00..53)
+* `%w`: Day of the week (Sunday is 0, 0..6)
+* `%x`: Preferred representation for the date alone, no time
+* `%X`: Preferred representation for the time alone, no date
+* `%y`: Year without a century (00..99)
+* `%Y`: Year with century
+* `%z`: Time zone as hour offset from UTC (for example +0900)
+* `%Z`: Time zone name
+* `%%`: Literal '%' character
+
+#### `strip`
+
+Removes leading and trailing whitespace from a string or from every string inside an array. For example, `strip(" aaa ")` results in "aaa".
+
+*Type*: rvalue.
+
+#### `suffix`
+
+Applies a suffix to all elements in an array or to all keys in a hash.
+
+For example:
+
+* `suffix(['a','b','c'], 'p')` returns ['ap','bp','cp'].
+* `suffix({'a'=>'b','b'=>'c','c'=>'d'}, 'p')` returns {'ap'=>'b','bp'=>'c','cp'=>'d'}.
+
+*Type*: rvalue.
+
+#### `swapcase`
+
+Swaps the existing case of a string. For example, `swapcase("aBcD")` results in "AbCd".
+
+*Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+#### `time`
+
+Returns the current Unix epoch time as an integer.
+
+For example, `time()` returns something like '1311972653'.
+
+*Type*: rvalue.
+
+#### `to_bytes`
+
+Converts the argument into bytes.
+
+For example, "4 kB" becomes "4096".
+
+Arguments: A single string.
+
+*Type*: rvalue.
+
+#### `to_json`
+
+Converts input into a JSON String.
+
+For example, `{ "key" => "value" }` becomes `{"key":"value"}`.
+
+*Type*: rvalue.
+
+#### `to_json_pretty`
+
+Converts input into a pretty JSON String.
+
+For example, `{ "key" => "value" }` becomes `{\n \"key\": \"value\"\n}`.
+
+*Type*: rvalue.
+
+#### `to_yaml`
+
+Converts input into a YAML String.
+
+For example, `{ "key" => "value" }` becomes `"---\nkey: value\n"`.
+
+*Type*: rvalue.
+
+#### `try_get_value`
+
+**Deprecated:** Replaced by `dig()`.
+
+Retrieves a value within multiple layers of hashes and arrays.
+
+Arguments:
+
+* A string containing a path, as the first argument. Provide this argument as a string of hash keys or array indexes starting with zero and separated by the path separator character (default "/"). This function goes through the structure by each path component and tries to return the value at the end of the path.
+
+* A default argument as a second argument. This argument is returned if the path is not correct, if no value was found, or if any other error has occurred.
+* The path separator character as a last argument.
+
+```ruby
+$data = {
+ 'a' => {
+ 'b' => [
+ 'b1',
+ 'b2',
+ 'b3',
+ ]
+ }
+}
+
+$value = try_get_value($data, 'a/b/2')
+# $value = 'b3'
+
+# with all possible options
+$value = try_get_value($data, 'a/b/2', 'not_found', '/')
+# $value = 'b3'
+
+# using the default value
+$value = try_get_value($data, 'a/b/c/d', 'not_found')
+# $value = 'not_found'
+
+# using custom separator
+$value = try_get_value($data, 'a|b', [], '|')
+# $value = ['b1','b2','b3']
+```
+
+1. **$data** The data structure we are working with.
+2. **'a/b/2'** The path string.
+3. **'not_found'** The default value. It will be returned if nothing is found.
+ (optional, defaults to *`undef`*)
+4. **'/'** The path separator character.
+ (optional, defaults to *'/'*)
+
+*Type*: rvalue.
+
+#### `type3x`
+
+**Deprecated:** This function will be removed in a future release.
+
+Returns a string description of the type of a given value. The type can be a string, array, hash, float, integer, or Boolean. For Puppet 4, use the new type system instead.
+
+Arguments:
+
+* string
+* array
+* hash
+* float
+* integer
+* Boolean
+
+*Type*: rvalue.
+
+#### `type_of`
+
+This function is provided for backwards compatibility, but the built-in [type() function](https://docs.puppet.com/puppet/latest/reference/function.html#type) provided by Puppet is preferred.
+
+Returns the literal type of a given value. Requires Puppet 4. Useful for comparison of types with `<=` such as in `if type_of($some_value) <= Array[String] { ... }` (which is equivalent to `if $some_value =~ Array[String] { ... }`).
+
+*Type*: rvalue.
+
+#### `union`
+
+Returns a union of two or more arrays, without duplicates.
+
+For example, `union(["a","b","c"],["b","c","d"])` returns ["a","b","c","d"].
+
+*Type*: rvalue.
+
+#### `unique`
+
+Removes duplicates from strings and arrays.
+
+For example, `unique("aabbcc")` returns 'abc', and `unique(["a","a","b","b","c","c"])` returns ["a","b","c"].
+
+*Type*: rvalue.
+
+#### `unix2dos`
+
+Returns the DOS version of a given string. Useful when using a File resource with a cross-platform template.
+
+*Type*: rvalue.
+
+```puppet
+file { $config_file:
+ ensure => file,
+ content => unix2dos(template('my_module/settings.conf.erb')),
+}
+```
+
+See also [dos2unix](#dos2unix).
+
+#### `upcase`
+
+Converts an object, array, or hash of objects to uppercase. Objects to be converted must respond to upcase.
+
+For example, `upcase('abcd')` returns 'ABCD'.
+
+*Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+#### `uriescape`
+
+URLEncodes a string or array of strings.
+
+Arguments: Either a single string or an array of strings.
+
+*Type*: rvalue.
+
+*Note:* This function is an implementation of a Ruby class and might not be UTF8 compatible. To ensure compatibility, use this function with Ruby 2.4.0 or greater.
+
+#### `validate_absolute_path`
+
+Validates that a given string represents an absolute path in the filesystem. Works for Windows and Unix style paths.
+
+The following values pass:
+
+```puppet
+$my_path = 'C:/Program Files (x86)/Puppet Labs/Puppet'
+validate_absolute_path($my_path)
+$my_path2 = '/var/lib/puppet'
+validate_absolute_path($my_path2)
+$my_path3 = ['C:/Program Files (x86)/Puppet Labs/Puppet','C:/Program Files/Puppet Labs/Puppet']
+validate_absolute_path($my_path3)
+$my_path4 = ['/var/lib/puppet','/usr/share/puppet']
+validate_absolute_path($my_path4)
+```
+
+The following values fail, causing compilation to terminate:
+
+```puppet
+validate_absolute_path(true)
+validate_absolute_path('../var/lib/puppet')
+validate_absolute_path('var/lib/puppet')
+validate_absolute_path([ 'var/lib/puppet', '/var/foo' ])
+validate_absolute_path([ '/var/lib/puppet', 'var/foo' ])
+$undefined = `undef`
+validate_absolute_path($undefined)
+```
+
+*Type*: statement.
+
+#### `validate_array`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates that all passed values are array data structures. Terminates catalog compilation if any value fails this check.
+
+The following values pass:
+
+```puppet
+$my_array = [ 'one', 'two' ]
+validate_array($my_array)
+```
+
+The following values fail, causing compilation to terminate:
+
+```puppet
+validate_array(true)
+validate_array('some_string')
+$undefined = `undef`
+validate_array($undefined)
+```
+
+*Type*: statement.
+
+#### `validate_augeas`
+
+Validates a string using an Augeas lens.
+
+Arguments:
+
+* The string to test, as the first argument.
+* The name of the Augeas lens to use, as the second argument.
+* Optionally, a list of paths which should **not** be found in the file, as a third argument.
+* Optionally, an error message to raise and show to the user, as a fourth argument.
+
+If Augeas fails to parse the string with the lens, the compilation terminates with a parse error.
+
+The `$file` variable points to the location of the temporary file being tested in the Augeas tree.
+
+For example, to make sure your $passwdcontent never contains user `foo`, include the third argument:
+
+```puppet
+validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo'])
+```
+
+To raise and display an error message, include the fourth argument:
+
+```puppet
+validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas')
+```
+
+*Type*: statement.
+
+#### `validate_bool`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates that all passed values are either `true` or `false`.
+Terminates catalog compilation if any value fails this check.
+
+The following values pass:
+
+```puppet
+$iamtrue = true
+validate_bool(true)
+validate_bool(true, true, false, $iamtrue)
+```
+
+The following values fail, causing compilation to terminate:
+
+```puppet
+$some_array = [ true ]
+validate_bool("false")
+validate_bool("true")
+validate_bool($some_array)
+```
+
+*Type*: statement.
+
+#### `validate_cmd`
+
+Validates a string with an external command.
+
+Arguments:
+* The string to test, as the first argument.
+* The path to a test command, as the second argument. This argument takes a % as a placeholder for the file path (if no % placeholder is given, defaults to the end of the command). If the command is launched against a tempfile containing the passed string, or returns a non-null value, compilation will terminate with a parse error.
+* Optionally, an error message to raise and show to the user, as a third argument.
+
+```puppet
+# Defaults to end of path
+validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content')
+```
+
+```puppet
+# % as file location
+validate_cmd($haproxycontent, '/usr/sbin/haproxy -f % -c', 'Haproxy failed to validate config content')
+```
+
+*Type*: statement.
+
+#### `validate_domain_name`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validate that all values passed are syntactically correct domain names. Aborts catalog compilation if any value fails this check.
+
+The following values pass:
+
+~~~
+$my_domain_name = 'server.domain.tld'
+validate_domain_name($my_domain_name)
+validate_domain_name('domain.tld', 'puppet.com', $my_domain_name)
+~~~
+
+The following values fail, causing compilation to abort:
+
+~~~
+validate_domain_name(1)
+validate_domain_name(true)
+validate_domain_name('invalid domain')
+validate_domain_name('-foo.example.com')
+validate_domain_name('www.example.2com')
+~~~
+
+*Type*: statement.
+
+#### `validate_email_address`
+
+Validate that all values passed are valid email addresses. Fail compilation if any value fails this check.
+
+The following values will pass:
+
+~~~
+$my_email = "waldo@gmail.com"
+validate_email_address($my_email)
+validate_email_address("bob@gmail.com", "alice@gmail.com", $my_email)
+~~~
+
+The following values will fail, causing compilation to abort:
+
+~~~
+$some_array = [ 'bad_email@/d/efdf.com' ]
+validate_email_address($some_array)
+~~~
+
+*Type*: statement.
+
+#### `validate_hash`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates that all passed values are hash data structures. Terminates catalog compilation if any value fails this check.
+
+The following values will pass:
+
+```puppet
+$my_hash = { 'one' => 'two' }
+validate_hash($my_hash)
+```
+
+The following values will fail, causing compilation to terminate:
+
+```puppet
+validate_hash(true)
+validate_hash('some_string')
+$undefined = `undef`
+validate_hash($undefined)
+```
+
+*Type*: statement.
+
+#### `validate_integer`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates an integer or an array of integers. Terminates catalog compilation if any of the checks fail.
+
+Arguments:
+
+* An integer or an array of integers, as the first argument.
+* Optionally, a maximum, as the second argument. (All elements of) the first argument must be equal to or less than this maximum.
+* Optionally, a minimum, as the third argument. (All elements of) the first argument must be equal to or greater than than this maximum.
+
+This function fails if the first argument is not an integer or array of integers, or if the second or third arguments are not convertable to an integer. However, if (and only if) a minimum is given, the second argument may be an empty string or `undef`, which serves as a placeholder to ensure the minimum check.
+
+The following values pass:
+
+```puppet
+validate_integer(1)
+validate_integer(1, 2)
+validate_integer(1, 1)
+validate_integer(1, 2, 0)
+validate_integer(2, 2, 2)
+validate_integer(2, '', 0)
+validate_integer(2, `undef`, 0)
+$foo = `undef`
+validate_integer(2, $foo, 0)
+validate_integer([1,2,3,4,5], 6)
+validate_integer([1,2,3,4,5], 6, 0)
+```
+
+* Plus all of the above, but any combination of values passed as strings ('1' or "1").
+* Plus all of the above, but with (correct) combinations of negative integer values.
+
+The following values fail, causing compilation to terminate:
+
+```puppet
+validate_integer(true)
+validate_integer(false)
+validate_integer(7.0)
+validate_integer({ 1 => 2 })
+$foo = `undef`
+validate_integer($foo)
+validate_integer($foobaridontexist)
+
+validate_integer(1, 0)
+validate_integer(1, true)
+validate_integer(1, '')
+validate_integer(1, `undef`)
+validate_integer(1, , 0)
+validate_integer(1, 2, 3)
+validate_integer(1, 3, 2)
+validate_integer(1, 3, true)
+```
+
+* Plus all of the above, but any combination of values passed as strings (`false` or "false").
+* Plus all of the above, but with incorrect combinations of negative integer values.
+* Plus all of the above, but with non-integer items in arrays or maximum / minimum argument.
+
+*Type*: statement.
+
+#### `validate_ip_address`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates that the argument is an IP address, regardless of whether it is an IPv4 or an IPv6 address. It also validates IP address with netmask.
+
+Arguments: A string specifying an IP address.
+
+The following values will pass:
+
+```puppet
+validate_ip_address('0.0.0.0')
+validate_ip_address('8.8.8.8')
+validate_ip_address('127.0.0.1')
+validate_ip_address('194.232.104.150')
+validate_ip_address('3ffe:0505:0002::')
+validate_ip_address('::1/64')
+validate_ip_address('fe80::a00:27ff:fe94:44d6/64')
+validate_ip_address('8.8.8.8/32')
+```
+
+The following values will fail, causing compilation to terminate:
+
+```puppet
+validate_ip_address(1)
+validate_ip_address(true)
+validate_ip_address(0.0.0.256)
+validate_ip_address('::1', {})
+validate_ip_address('0.0.0.0.0')
+validate_ip_address('3.3.3')
+validate_ip_address('23.43.9.22/64')
+validate_ip_address('260.2.32.43')
+```
+
+
+#### `validate_legacy`
+
+Validates a value against both a specified type and a deprecated validation function. Silently passes if both pass, errors if only one validation passes, and fails if both validations return false.
+
+Arguments:
+
+* The type to check the value against,
+* The full name of the previous validation function,
+* The value to be checked,
+* An unspecified number of arguments needed for the previous validation function.
+
+Example:
+
+```puppet
+validate_legacy('Optional[String]', 'validate_re', 'Value to be validated', ["."])
+```
+
+This function supports updating modules from Puppet 3-style argument validation (using the stdlib `validate_*` functions) to Puppet 4 data types, without breaking functionality for those depending on Puppet 3-style validation.
+
+> Note: This function is compatible only with Puppet 4.4.0 (PE 2016.1) and later.
+
+##### For module users
+
+If you are running Puppet 4, the `validate_legacy` function can help you find and resolve deprecated Puppet 3 `validate_*` functions. These functions are deprecated as of stdlib version 4.13 and will be removed in a future version of stdlib.
+
+Puppet 4 allows improved defined type checking using [data types](https://docs.puppet.com/puppet/latest/reference/lang_data.html). Data types avoid some of the problems with Puppet 3's `validate_*` functions, which were sometimes inconsistent. For example, [validate_numeric](#validate_numeric) unintentionally allowed not only numbers, but also arrays of numbers or strings that looked like numbers.
+
+If you run Puppet 4 and use modules with deprecated `validate_*` functions, you might encounter deprecation messages. The `validate_legacy` function makes these differences visible and makes it easier to move to the clearer Puppet 4 syntax.
+
+The deprecation messages you get can vary, depending on the modules and data that you use. These deprecation messages appear by default only in Puppet 4:
+
+* `Notice: Accepting previously invalid value for target type '<type>'`: This message is informational only. You're using values that are allowed by the new type, but would have been invalid by the old validation function.
+* `Warning: This method is deprecated, please use the stdlib validate_legacy function`: The module has not yet upgraded to `validate_legacy`. Use the [deprecation](#deprecation) options to silence warnings for now, or submit a fix with the module's developer. See the information [for module developers](#for-module-developers) below for how to fix the issue.
+* `Warning: validate_legacy(<function>) expected <type> value, got <actual type>_`: Your code passes a value that was accepted by the Puppet 3-style validation, but will not be accepted by the next version of the module. Most often, you can fix this by removing quotes from numbers or booleans.
+* `Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, validate_legacy(<function>) expected <type> value, got <actual type>`: Your code passes a value that is not acceptable to either the new or the old style validation.
+
+##### For module developers
+
+The `validate_legacy` function helps you move from Puppet 3 style validation to Puppet 4 validation without breaking functionality your module's users depend on.
+
+Moving to Puppet 4 type validation allows much better defined type checking using [data types](https://docs.puppet.com/puppet/latest/reference/lang_data.html). Many of Puppet 3's `validate_*` functions have surprising holes in their validation. For example, [validate_numeric](#validate_numeric) allows not only numbers, but also arrays of numbers or strings that look like numbers, without giving you any control over the specifics.
+
+For each parameter of your classes and defined types, choose a new Puppet 4 data type to use. In most cases, the new data type allows a different set of values than the original `validate_*` function. The situation then looks like this:
+
+| | `validate_` pass | `validate_` fail |
+| ------------ | ---------------- | ---------------- |
+| matches type | pass | pass, notice |
+| fails type | pass, deprecated | fail |
+
+The code after the validation still has to handle all possible values for now, but users of your code can change their manifests to pass only values that match the new type.
+
+For each `validate_*` function in stdlib, there is a matching `Stdlib::Compat::*` type that allows the appropriate set of values. See the documentation in the `types/` directory in the stdlib source code for caveats.
+
+For example, given a class that should accept only numbers, like this:
+
+```puppet
+class example($value) {
+ validate_numeric($value)
+```
+
+the resulting validation code looks like this:
+
+```puppet
+class example(
+ Variant[Stdlib::Compat::Numeric, Numeric] $value
+) {
+ validate_legacy(Numeric, 'validate_numeric', $value)
+```
+
+Here, the type of `$value` is defined as `Variant[Stdlib::Compat::Numeric, Numeric]`, which allows any `Numeric` (the new type), as well as all values previously accepted by `validate_numeric` (through `Stdlib::Compat::Numeric`).
+
+The call to `validate_legacy` takes care of triggering the correct log or fail message for you. It requires the new type, the previous validation function name, and all arguments to that function.
+
+If your module still supported Puppet 3, this is a breaking change. Update your `metadata.json` requirements section to indicate that your module no longer supports Puppet 3, and bump the major version of your module. With this change, all existing tests for your module should still pass. Create additional tests for the new possible values.
+
+As a breaking change, this is also a good time to call [`deprecation`](#deprecation) for any parameters you want to get rid of, or to add additional constraints on your parameters.
+
+After releasing this version, you can release another breaking change release where you remove all compat types and all calls to `validate_legacy`. At that time, you can also go through your code and remove any leftovers dealing with the previously possible values.
+
+Always note such changes in your CHANGELOG and README.
+
+#### `validate_numeric`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates a numeric value, or an array or string of numeric values. Terminates catalog compilation if any of the checks fail.
+
+Arguments:
+
+* A numeric value, or an array or string of numeric values.
+* Optionally, a maximum value. (All elements of) the first argument has to be less or equal to this max.
+* Optionally, a minimum value. (All elements of) the first argument has to be greater or equal to this min.
+
+This function fails if the first argument is not a numeric (Integer or Float) or an array or string of numerics, or if the second and third arguments are not convertable to a numeric. If, and only if, a minimum is given, the second argument can be an empty string or `undef`, which serves as a placeholder to ensure the minimum check.
+
+For passing and failing usage, see [`validate_integer`](#validate-integer). The same values pass and fail, except that `validate_numeric` also allows floating point values.
+
+*Type*: statement.
+
+#### `validate_re`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Performs simple validation of a string against one or more regular expressions.
+
+Arguments:
+
+* The string to test, as the first argument. If this argument is not a string, compilation terminates. Use quotes to force stringification.
+* A stringified regular expression (without the // delimiters) or an array of regular expressions, as the second argument.
+* Optionally, the error message raised and shown to the user, as a third argument.
+
+If none of the regular expressions in the second argument match the string passed in the first argument, compilation terminates with a parse error.
+
+The following strings validate against the regular expressions:
+
+```puppet
+validate_re('one', '^one$')
+validate_re('one', [ '^one', '^two' ])
+```
+
+The following string fails to validate, causing compilation to terminate:
+
+```puppet
+validate_re('one', [ '^two', '^three' ])
+```
+
+To set the error message:
+
+```puppet
+validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7')
+```
+
+To force stringification, use quotes:
+
+ ```
+ validate_re("${::operatingsystemmajrelease}", '^[57]$')
+ ```
+
+*Type*: statement.
+
+#### `validate_slength`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates that a string (or an array of strings) is less than or equal to a specified length
+
+Arguments:
+
+* A string or an array of strings, as a first argument.
+* A numeric value for maximum length, as a second argument.
+* Optionally, a numeric value for minimum length, as a third argument.
+
+ The following values pass:
+
+```puppet
+validate_slength("discombobulate",17)
+validate_slength(["discombobulate","moo"],17)
+validate_slength(["discombobulate","moo"],17,3)
+```
+
+The following values fail:
+
+```puppet
+validate_slength("discombobulate",1)
+validate_slength(["discombobulate","thermometer"],5)
+validate_slength(["discombobulate","moo"],17,10)
+```
+
+*Type*: statement.
+
+#### `validate_string`
+
+**Deprecated:** Will be removed in a future version of stdlib. See [`validate_legacy`](#validate_legacy).
+
+Validates that all passed values are string data structures. Aborts catalog compilation if any value fails this check.
+
+The following values pass:
+
+```puppet
+$my_string = "one two"
+validate_string($my_string, 'three')
+```
+
+The following values fail, causing compilation to terminate:
+
+```puppet
+validate_string(true)
+validate_string([ 'some', 'array' ])
+```
+
+*Note:* validate_string(`undef`) will not fail in this version of the functions API.
+
+Instead, use:
+
+ ```
+ if $var == `undef` {
+ fail('...')
+ }
+ ```
+
+*Type*: statement.
+
+#### `validate_x509_rsa_key_pair`
+
+Validates a PEM-formatted X.509 certificate and private key using OpenSSL.
+Verifies that the certificate's signature was created from the supplied key.
+
+Fails catalog compilation if any value fails this check.
+
+Arguments:
+
+* An X.509 certificate as the first argument.
+* An RSA private key, as the second argument.
+
+```puppet
+validate_x509_rsa_key_pair($cert, $key)
+```
+
+*Type*: statement.
+
+#### `values`
+
+**Deprecated:** This function has been replaced with a built-in [`values`](https://docs.puppet.com/puppet/latest/function.html#values) function as of Puppet 5.5.0.
+
+Returns the values of a given hash.
+
+For example, given `$hash = {'a'=1, 'b'=2, 'c'=3} values($hash)` returns [1,2,3].
+
+*Type*: rvalue.
+
+#### `values_at`
+
+Finds values inside an array based on location.
+
+Arguments:
+
+* The array you want to analyze, as the first argument.
+* Any combination of the following values, as the second argument:
+ * A single numeric index
+ * A range in the form of 'start-stop' (eg. 4-9)
+ * An array combining the above
+
+For example:
+
+* `values_at(['a','b','c'], 2)` returns ['c'].
+* `values_at(['a','b','c'], ["0-1"])` returns ['a','b'].
+* `values_at(['a','b','c','d','e'], [0, "2-3"])` returns ['a','c','d'].
+
+*Type*: rvalue.
+
+#### `zip`
+
+Takes one element from first array given and merges corresponding elements from second array given. This generates a sequence of n-element arrays, where *n* is one more than the count of arguments. For example, `zip(['1','2','3'],['4','5','6'])` results in ["1", "4"], ["2", "5"], ["3", "6"]. *Type*: rvalue.
+
+## Limitations
+
+As of Puppet Enterprise 3.7, the stdlib module is no longer included in PE. PE users should install the most recent release of stdlib for compatibility with Puppet modules.
+
+### Version Compatibility
+
+Versions | Puppet 2.6 | Puppet 2.7 | Puppet 3.x | Puppet 4.x |
+:---------------|:-----:|:---:|:---:|:----:
+**stdlib 2.x** | **yes** | **yes** | no | no
+**stdlib 3.x** | no | **yes** | **yes** | no
+**stdlib 4.x** | no | **yes** | **yes** | no
+**stdlib 4.6+** | no | **yes** | **yes** | **yes**
+**stdlib 5.x** | no | no | **yes** | **yes**
+
+**stdlib 5.x**: When released, stdlib 5.x will drop support for Puppet 2.7.x. Please see [this discussion](https://github.com/puppetlabs/puppetlabs-stdlib/pull/176#issuecomment-30251414).
+
+## Development
+
+Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide](https://docs.puppetlabs.com/forge/contributing.html).
+
+To report or research a bug with any part of this module, please go to
+[http://tickets.puppetlabs.com/browse/MODULES](http://tickets.puppetlabs.com/browse/MODULES).
+
+## Contributors
+
+The list of contributors can be found at: [https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors](https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors).
diff --git a/code/environments/production/modules/stdlib/README_DEVELOPER.markdown b/code/environments/production/modules/stdlib/README_DEVELOPER.markdown
new file mode 100644
index 0000000..04349ed
--- /dev/null
+++ b/code/environments/production/modules/stdlib/README_DEVELOPER.markdown
@@ -0,0 +1,35 @@
+Puppet Specific Facts
+=====================
+
+Facter is meant to stand alone and apart from Puppet. However, Facter often
+runs inside Puppet and all custom facts included in the stdlib module will
+almost always be evaluated in the context of Puppet and Facter working
+together.
+
+Still, we don't want to write custom facts that blow up in the users face if
+Puppet is not loaded in memory. This is often the case if the user runs
+`facter` without also supplying the `--puppet` flag.
+
+Ah! But Jeff, the custom fact won't be in the `$LOAD_PATH` unless the user
+supplies `--facter`! You might say...
+
+Not (always) true I say! If the user happens to have a CWD of
+`<modulepath>/stdlib/lib` then the facts will automatically be evaluated and
+blow up.
+
+In any event, it's pretty easy to write a fact that has no value if Puppet is
+not loaded. Simply do it like this:
+
+ Facter.add(:node_vardir) do
+ setcode do
+ # This will be nil if Puppet is not available.
+ Facter::Util::PuppetSettings.with_puppet do
+ Puppet[:vardir]
+ end
+ end
+ end
+
+The `Facter::Util::PuppetSettings.with_puppet` method accepts a block and
+yields to it only if the Puppet library is loaded. If the Puppet library is
+not loaded, then the method silently returns `nil` which Facter interprets as
+an undefined fact value. The net effect is that the fact won't be set.
diff --git a/code/environments/production/modules/stdlib/README_SPECS.markdown b/code/environments/production/modules/stdlib/README_SPECS.markdown
new file mode 100644
index 0000000..917b631
--- /dev/null
+++ b/code/environments/production/modules/stdlib/README_SPECS.markdown
@@ -0,0 +1,7 @@
+NOTE
+====
+
+This project's specs depend on puppet core, and thus they require the
+`puppetlabs_spec_helper` project. For more information please see the README
+in that project, which can be found here: [puppetlabs spec
+helper](https://github.com/puppetlabs/puppetlabs_spec_helper)
diff --git a/code/environments/production/modules/stdlib/RELEASE_PROCESS.markdown b/code/environments/production/modules/stdlib/RELEASE_PROCESS.markdown
new file mode 100644
index 0000000..0f9328e
--- /dev/null
+++ b/code/environments/production/modules/stdlib/RELEASE_PROCESS.markdown
@@ -0,0 +1,24 @@
+# Contributing to this module #
+
+ * Work in a topic branch
+ * Submit a github pull request
+ * Address any comments / feeback
+ * Merge into master using --no-ff
+
+# Releasing this module #
+
+ * This module adheres to http://semver.org/
+ * Look for API breaking changes using git diff vX.Y.Z..master
+ * If no API breaking changes, the minor version may be bumped.
+ * If there are API breaking changes, the major version must be bumped.
+ * If there are only small minor changes, the patch version may be bumped.
+ * Update the CHANGELOG
+ * Update the Modulefile
+ * Commit these changes with a message along the lines of "Update CHANGELOG and
+ Modulefile for release"
+ * Create an annotated tag with git tag -a vX.Y.Z -m 'version X.Y.Z' (NOTE the
+ leading v as per semver.org)
+ * Push the tag with git push origin --tags
+ * Build a new package with puppet-module or the rake build task if it exists
+ * Publish the new package to the forge
+ * Bonus points for an announcement to puppet-users.
diff --git a/code/environments/production/modules/stdlib/Rakefile b/code/environments/production/modules/stdlib/Rakefile
new file mode 100644
index 0000000..a39cae2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/Rakefile
@@ -0,0 +1,4 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-syntax/tasks/puppet-syntax'
+require 'puppet_blacksmith/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
diff --git a/code/environments/production/modules/stdlib/appveyor.yml b/code/environments/production/modules/stdlib/appveyor.yml
new file mode 100644
index 0000000..5fd5e89
--- /dev/null
+++ b/code/environments/production/modules/stdlib/appveyor.yml
@@ -0,0 +1,57 @@
+version: 1.1.x.{build}
+skip_commits:
+ message: /^\(?doc\)?.*/
+clone_depth: 10
+init:
+ - SET
+ - 'mkdir C:\ProgramData\PuppetLabs\code && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0'
+environment:
+ matrix:
+ -
+ RUBY_VERSION: 24-x64
+ CHECK: syntax lint
+ -
+ RUBY_VERSION: 24-x64
+ CHECK: metadata_lint
+ -
+ RUBY_VERSION: 24-x64
+ CHECK: rubocop
+ -
+ PUPPET_GEM_VERSION: ~> 4.0
+ RUBY_VERSION: 21
+ CHECK: spec
+ -
+ PUPPET_GEM_VERSION: ~> 4.0
+ RUBY_VERSION: 21-x64
+ CHECK: spec
+ -
+ PUPPET_GEM_VERSION: ~> 5.0
+ RUBY_VERSION: 24
+ CHECK: spec
+ -
+ PUPPET_GEM_VERSION: ~> 5.0
+ RUBY_VERSION: 24-x64
+ CHECK: spec
+matrix:
+ fast_finish: true
+install:
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
+ - bundle install --jobs 4 --retry 2 --without system_tests
+ - type Gemfile.lock
+build: off
+test_script:
+ - bundle exec puppet -V
+ - ruby -v
+ - gem -v
+ - bundle -v
+ - bundle exec rake %CHECK%
+notifications:
+ - provider: Email
+ to:
+ - nobody@nowhere.com
+ on_build_success: false
+ on_build_failure: false
+ on_build_status_changed: false
diff --git a/code/environments/production/modules/stdlib/checksums.json b/code/environments/production/modules/stdlib/checksums.json
new file mode 100644
index 0000000..fd78d89
--- /dev/null
+++ b/code/environments/production/modules/stdlib/checksums.json
@@ -0,0 +1,566 @@
+{
+ "CHANGELOG.md": "e51208519c13999f1e9551090c0c4fc6",
+ "CONTRIBUTING.md": "4d17f3c942e7c93d1577cc4438a231e4",
+ "Gemfile": "47f2bb73e730d42a921e7bca4449f5aa",
+ "LICENSE": "3b83ef96387f14655fc854ddc3c6bd57",
+ "MAINTAINERS.md": "b40ec4f2c16145af6f723c2c34bb2ff9",
+ "NOTICE": "b2e552587e5969886fdd60481e8b0351",
+ "README.md": "f0861f0c9c5d5661ed690a9e99c43e3c",
+ "README_DEVELOPER.markdown": "220a8b28521b5c5d2ea87c4ddb511165",
+ "README_SPECS.markdown": "82bb4c6abbb711f40778b162ec0070c1",
+ "RELEASE_PROCESS.markdown": "94b92bc99ac4106ba1a74d5c04e520f9",
+ "Rakefile": "892f5f56e24ac668b998bb74fb18035e",
+ "appveyor.yml": "105dce352be3244a497e667f6b0403c7",
+ "examples/file_line.pp": "d8126b139dd1dce21ff26910d1c5a245",
+ "examples/has_interface_with.pp": "d69d520cf3ff4d0b495480afaca359ef",
+ "examples/has_ip_address.pp": "32f42575e49aa66f0f2398a70ae2a9f4",
+ "examples/has_ip_network.pp": "bfb8db068c58d77c4dd7ae9697536537",
+ "examples/init.pp": "b52fd907330ddbd9c3e070cf39f7b317",
+ "lib/facter/facter_dot_d.rb": "9f65108ecd7b8c5ce9c90ab4cd9d45be",
+ "lib/facter/package_provider.rb": "12d57e65f9b90c13e7808c347fbdc0b0",
+ "lib/facter/pe_version.rb": "245bb8ea121e8a55e1a38668cc480530",
+ "lib/facter/puppet_settings.rb": "d86bacf2b962a4744b701868cda31729",
+ "lib/facter/root_home.rb": "b384092f0470b9e2177edaf546de2ec1",
+ "lib/facter/service_provider.rb": "66cc42526eae631e306b397391f1f01c",
+ "lib/facter/util/puppet_settings.rb": "f69007bcc02031cd772fa7f2dffa3c0c",
+ "lib/puppet/functions/deprecation.rb": "705115a036e0235840db59cf9f4c17fe",
+ "lib/puppet/functions/fact.rb": "5879006198f1f4106acfe13422087d56",
+ "lib/puppet/functions/is_a.rb": "5a61d6a34ef45d7a5490455f334ef48a",
+ "lib/puppet/functions/is_absolute_path.rb": "0806756fc12b1fc752d1b54e81b15832",
+ "lib/puppet/functions/is_array.rb": "4d5c8d6af4e481ebb42f73b6504685c8",
+ "lib/puppet/functions/is_bool.rb": "9ae803c605c5ed057508c6501ef1a47f",
+ "lib/puppet/functions/is_float.rb": "ebe18dc0096233fcd555423761fc29f2",
+ "lib/puppet/functions/is_ip_address.rb": "ab9a1c6172db59cc15023f220853e2f2",
+ "lib/puppet/functions/is_ipv4_address.rb": "dec325b5911ce409b16c643697a13822",
+ "lib/puppet/functions/is_ipv6_address.rb": "f4864fee72c42bd3e40914768fb10f8e",
+ "lib/puppet/functions/is_numeric.rb": "970d785070eaa02bcac3e0589a8d5e7f",
+ "lib/puppet/functions/is_string.rb": "5aa459896fda1782f74752a1d324f048",
+ "lib/puppet/functions/length.rb": "3f6b0510bfe134241e4529d3f1a5318d",
+ "lib/puppet/functions/sprintf_hash.rb": "50fc7c6e57c098b7e6a594e1fd0d9904",
+ "lib/puppet/functions/to_json.rb": "bb6893a3e9eb6c48064c5a3c0bd4a41a",
+ "lib/puppet/functions/to_json_pretty.rb": "61ff20121b4c09987eadf3242b6231cf",
+ "lib/puppet/functions/to_yaml.rb": "0358dfd97b9a051e15046c6842b327be",
+ "lib/puppet/functions/type_of.rb": "4ee9c082047c08b8b1a82bc0bef8fd78",
+ "lib/puppet/functions/validate_absolute_path.rb": "556b0e3de450f03d724747d7d3825309",
+ "lib/puppet/functions/validate_array.rb": "efe329c6c8f65fce1ae2560fa5751530",
+ "lib/puppet/functions/validate_bool.rb": "5516a0f2efb48eeb4460fc713c6f9521",
+ "lib/puppet/functions/validate_hash.rb": "ce99bea6e1ee4da1a67b53b3ce06ce96",
+ "lib/puppet/functions/validate_integer.rb": "c028b299f194c221002ba442077e9209",
+ "lib/puppet/functions/validate_ip_address.rb": "278f3e0ea96b4b31e7b85c13887079b6",
+ "lib/puppet/functions/validate_ipv4_address.rb": "bd015492af1f3c4bef7ac780ae1c7e61",
+ "lib/puppet/functions/validate_ipv6_address.rb": "5144a327b6850ed5b7fb26fa37113353",
+ "lib/puppet/functions/validate_legacy.rb": "789bdef436873b6fcc8205c6d2270e43",
+ "lib/puppet/functions/validate_numeric.rb": "2bd2733f44749e0e56940ceaf5d8e2f8",
+ "lib/puppet/functions/validate_re.rb": "12c3412a7383b1d258dba5d4307e9464",
+ "lib/puppet/functions/validate_slength.rb": "1fc441736085bd0b5c7862f5dc9f839a",
+ "lib/puppet/functions/validate_string.rb": "c0fe867d3b5f8fbcaa3641f0f393a669",
+ "lib/puppet/parser/functions/abs.rb": "176df45128a7b89c9ec6a6c6918d8c30",
+ "lib/puppet/parser/functions/any2array.rb": "60cdb0bdfabff0115e74eda31c5c869b",
+ "lib/puppet/parser/functions/any2bool.rb": "4bafd2903a5e7992b4a8af476f05f46a",
+ "lib/puppet/parser/functions/assert_private.rb": "c61884d43ebdb5ee5a5aa1507165084a",
+ "lib/puppet/parser/functions/base64.rb": "6216cc60b71949724e21b0be4dbac316",
+ "lib/puppet/parser/functions/basename.rb": "6b0dc955024352c8007d175f900dba36",
+ "lib/puppet/parser/functions/bool2num.rb": "bfeeac22e909c76dc5a0d55441f39a27",
+ "lib/puppet/parser/functions/bool2str.rb": "e9e1c441e3b3c51b8b0734d12e9a63a5",
+ "lib/puppet/parser/functions/camelcase.rb": "13f3125b1bcb6ce7794385aea6cbc4c0",
+ "lib/puppet/parser/functions/capitalize.rb": "0a039c4bcd3a73dab80b389332457f0d",
+ "lib/puppet/parser/functions/ceiling.rb": "c4af0da229909c00b2adda7bdd3f0d93",
+ "lib/puppet/parser/functions/chomp.rb": "ebb5eb5e2020ec84c00477777f29b6bc",
+ "lib/puppet/parser/functions/chop.rb": "6a7d4154b326e84e478eb4a17aa55e74",
+ "lib/puppet/parser/functions/clamp.rb": "eeaed011946f4dec98870815e7c1657c",
+ "lib/puppet/parser/functions/concat.rb": "02a6ba0560a005b5f92aec096ce26e09",
+ "lib/puppet/parser/functions/convert_base.rb": "438da17946864b835e38155b8f72a184",
+ "lib/puppet/parser/functions/count.rb": "0241b1bd0bc8de6426b7d077a54f56fe",
+ "lib/puppet/parser/functions/deep_merge.rb": "fae771cff4fc1d6c639bea1672e05c9c",
+ "lib/puppet/parser/functions/defined_with_params.rb": "0e2a92b10efb6c502df6a52f35cf7983",
+ "lib/puppet/parser/functions/delete.rb": "ec0bb949e24d1b9ca6c749af0ab18de9",
+ "lib/puppet/parser/functions/delete_at.rb": "4a6bde67835592dafa48bca7bb8af939",
+ "lib/puppet/parser/functions/delete_regex.rb": "ee86f13f796e61e41c62ee91f8349735",
+ "lib/puppet/parser/functions/delete_undef_values.rb": "247a52c41dc02375b50ac3c1791f4c09",
+ "lib/puppet/parser/functions/delete_values.rb": "0a979383ac73e1bf82278e0eb104842c",
+ "lib/puppet/parser/functions/deprecation.rb": "9f935fec2f9f0d01394292eb6f21bd7d",
+ "lib/puppet/parser/functions/difference.rb": "e3d3006b7f50fc0fad1616ec53f21614",
+ "lib/puppet/parser/functions/dig.rb": "d315de1659a037430fea9623bff323a6",
+ "lib/puppet/parser/functions/dig44.rb": "2317ddee7dbda385e2f964655fe6ad88",
+ "lib/puppet/parser/functions/dirname.rb": "240597e264df02effa454cf9cb8bb9e7",
+ "lib/puppet/parser/functions/dos2unix.rb": "ab2f9f280c616be55f58903948e226a2",
+ "lib/puppet/parser/functions/downcase.rb": "3e6b908548607a55ee426e8be16fb46c",
+ "lib/puppet/parser/functions/empty.rb": "f9dcb1b4cb0abb671294d5283e673ee5",
+ "lib/puppet/parser/functions/enclose_ipv6.rb": "89c728eb11f71ed9390664bad9732328",
+ "lib/puppet/parser/functions/ensure_packages.rb": "a0b4bdc14613d4b8c396b4e02a1aa33d",
+ "lib/puppet/parser/functions/ensure_resource.rb": "2915c77baa0d45531912613dd1cac902",
+ "lib/puppet/parser/functions/ensure_resources.rb": "805d56e894c9dcca2595464fa87a7c56",
+ "lib/puppet/parser/functions/flatten.rb": "54fd2d9d7bc7cd4f9889554da6094dd8",
+ "lib/puppet/parser/functions/floor.rb": "f0a70977110525dc4aa6b109db9ff9e4",
+ "lib/puppet/parser/functions/fqdn_rand_string.rb": "731365381b6a28a196e108329e16c6c2",
+ "lib/puppet/parser/functions/fqdn_rotate.rb": "3925369078084f98f9b527d25cc9e4d2",
+ "lib/puppet/parser/functions/fqdn_uuid.rb": "adbd60dbcc561c8586567a6e58abec82",
+ "lib/puppet/parser/functions/get_module_path.rb": "e141ce049d4ace6d12b50d6b171b029c",
+ "lib/puppet/parser/functions/getparam.rb": "84c7358b24f0a5e45c1ad523c196817e",
+ "lib/puppet/parser/functions/getvar.rb": "835e6b79e209a541e125cdaddefb3396",
+ "lib/puppet/parser/functions/glob.rb": "f8177554be6da357b0822edaa7eb8d14",
+ "lib/puppet/parser/functions/grep.rb": "b2e7e32188a1cb4f1dafa375ba9b8b14",
+ "lib/puppet/parser/functions/has_interface_with.rb": "422015811c5b7c0656b83eaea3b8fdcc",
+ "lib/puppet/parser/functions/has_ip_address.rb": "fc76c9a87145560f58a4ae9a6d9df444",
+ "lib/puppet/parser/functions/has_ip_network.rb": "b1bb1868e6fef95f8ae840d420ab0816",
+ "lib/puppet/parser/functions/has_key.rb": "572f8a648c74c0b774718991a88adc56",
+ "lib/puppet/parser/functions/hash.rb": "5730e6a297b9064c12d3484a2ae31010",
+ "lib/puppet/parser/functions/intersection.rb": "6436444eb8585ee71cfd5bd1e0802026",
+ "lib/puppet/parser/functions/is_absolute_path.rb": "268600b66670a29690be009d45013d42",
+ "lib/puppet/parser/functions/is_array.rb": "0e425e55c8ce9cc5e327d53d114391ba",
+ "lib/puppet/parser/functions/is_bool.rb": "4e021a5143c2c98b31344acceda5fbe2",
+ "lib/puppet/parser/functions/is_domain_name.rb": "1abf04d1d57de6f7f630045c0efe5e4c",
+ "lib/puppet/parser/functions/is_email_address.rb": "d11c644fa1bd73f8e1d36c4f9e67272e",
+ "lib/puppet/parser/functions/is_float.rb": "b95a00f15242e3f26a5cf129db7d31e5",
+ "lib/puppet/parser/functions/is_function_available.rb": "3bb60da5789493da017f84d48ac46f08",
+ "lib/puppet/parser/functions/is_hash.rb": "3f74a7e9b6e47b834c4ad58939c27eab",
+ "lib/puppet/parser/functions/is_integer.rb": "e3480725fccac1c7eba28162dc62393d",
+ "lib/puppet/parser/functions/is_ip_address.rb": "3616dacf58febcd4944945d3c2647efe",
+ "lib/puppet/parser/functions/is_ipv4_address.rb": "7930d25d23d92f0e5cb81f93315cea16",
+ "lib/puppet/parser/functions/is_ipv6_address.rb": "c206564af3a738e504afca2284497d3c",
+ "lib/puppet/parser/functions/is_mac_address.rb": "b75e440d5594b879b70cf034fc52cd51",
+ "lib/puppet/parser/functions/is_numeric.rb": "4bd1a47192ce4040810819789fbf3147",
+ "lib/puppet/parser/functions/is_string.rb": "cf06fecd6147bea77d406a189b649f81",
+ "lib/puppet/parser/functions/join.rb": "aed0b418cc216d86f3beaa5f2302279b",
+ "lib/puppet/parser/functions/join_keys_to_values.rb": "5ad99136e59a68064c24dd2933727c57",
+ "lib/puppet/parser/functions/keys.rb": "d65816215c6c7736bcfe393e7d9d3bf4",
+ "lib/puppet/parser/functions/load_module_metadata.rb": "4972bafc84e5b7ce4a00cbee21aece18",
+ "lib/puppet/parser/functions/loadjson.rb": "b6e43c28dee4a74a7312af41393d09de",
+ "lib/puppet/parser/functions/loadyaml.rb": "9066804fd56894210d4d064aab9df406",
+ "lib/puppet/parser/functions/lstrip.rb": "de231169f63d922b72b754521488bca5",
+ "lib/puppet/parser/functions/max.rb": "3406e6e1da36ed126ca7a359dbbcbb23",
+ "lib/puppet/parser/functions/member.rb": "4f8639d96fbd17cd194224794dd9f279",
+ "lib/puppet/parser/functions/merge.rb": "e867f9f9340d7bf5b85141d2f7ec2392",
+ "lib/puppet/parser/functions/min.rb": "6243d16650b1787f017f587b5be276f3",
+ "lib/puppet/parser/functions/num2bool.rb": "35f42a4339b34d0b1efc6a6c3b2d3b69",
+ "lib/puppet/parser/functions/parsejson.rb": "fee0dc33cd6e18b0d9a5fe8befb66cd2",
+ "lib/puppet/parser/functions/parseyaml.rb": "f4b67d011970c1799bc6fb36a3caf1f2",
+ "lib/puppet/parser/functions/pick.rb": "4a4ba9288a233a4bcdbdc59ecac80be0",
+ "lib/puppet/parser/functions/pick_default.rb": "6b0ccac1913a85e540a3de20c6a88096",
+ "lib/puppet/parser/functions/prefix.rb": "3d268ec646255199ade4b01b719a59ed",
+ "lib/puppet/parser/functions/private.rb": "a1f44a1c32da00aa14f474f4f303be87",
+ "lib/puppet/parser/functions/pry.rb": "970544bf6308b7b6902b936063a45109",
+ "lib/puppet/parser/functions/pw_hash.rb": "07fea662493e5b2ffcf37dbb4c4e74b9",
+ "lib/puppet/parser/functions/range.rb": "60d786031129d4a495a67468d4b5219d",
+ "lib/puppet/parser/functions/regexpescape.rb": "d7d22f987d616f2b5ec9d967f1528f53",
+ "lib/puppet/parser/functions/reject.rb": "31f5f65be6f710d6856ffce75c432271",
+ "lib/puppet/parser/functions/reverse.rb": "3f96ffed2afe4987da5039de2d56f38b",
+ "lib/puppet/parser/functions/round.rb": "287db8b83f3bc6652eb042682f8be698",
+ "lib/puppet/parser/functions/rstrip.rb": "5042d02e81ac59068d87a2b54c784cce",
+ "lib/puppet/parser/functions/seeded_rand.rb": "4f45ef0723411ff8281aaf093f0fabc2",
+ "lib/puppet/parser/functions/shell_escape.rb": "6e51793b8483eb6bfc4be98b438fd47e",
+ "lib/puppet/parser/functions/shell_join.rb": "4fbe23ff73932f65db696f106517887e",
+ "lib/puppet/parser/functions/shell_split.rb": "cb851119ee167ccb12930c53e94333cc",
+ "lib/puppet/parser/functions/shuffle.rb": "6b16497151e961fbdb6e00ec70d6bbe9",
+ "lib/puppet/parser/functions/size.rb": "05cbf180420e3a3e2e5aa5be157c6951",
+ "lib/puppet/parser/functions/sort.rb": "20fa47c2ccde4b37626e8d3995503f02",
+ "lib/puppet/parser/functions/squeeze.rb": "e42e1d5ec9a23443d14ff07512fd695f",
+ "lib/puppet/parser/functions/str2bool.rb": "b82d971cc305a19b26089cc4fd566eb0",
+ "lib/puppet/parser/functions/str2saltedsha512.rb": "d4443e8985b4ce6f6e925c6f46d8456c",
+ "lib/puppet/parser/functions/strftime.rb": "62b13548cc3b28b1609b7b4bd966f666",
+ "lib/puppet/parser/functions/strip.rb": "ec030431f8ec17e285f18a6f60b7f269",
+ "lib/puppet/parser/functions/suffix.rb": "4eff1920b75829e32fb2c2ee4aab8a24",
+ "lib/puppet/parser/functions/swapcase.rb": "d1a53787b35ae9a5a643c49f4e0975a8",
+ "lib/puppet/parser/functions/time.rb": "cd31abf40b4e4e22b9de8b6b27ec1a50",
+ "lib/puppet/parser/functions/to_bytes.rb": "55a65ad70ea78983e7c1d6d565094c1f",
+ "lib/puppet/parser/functions/try_get_value.rb": "b039b960b07a21b935baf6c78fb94612",
+ "lib/puppet/parser/functions/type.rb": "857348edb913cdc4f25b2169994984cf",
+ "lib/puppet/parser/functions/type3x.rb": "22c902213365c39919625d1a33d5abff",
+ "lib/puppet/parser/functions/union.rb": "690e5c15a1e7b95ab4b90ee18eb48f81",
+ "lib/puppet/parser/functions/unique.rb": "e448da2c183c0e19bd6e64bc423a749f",
+ "lib/puppet/parser/functions/unix2dos.rb": "0aa6e66d1c47ca0bb417e248b01f6f1b",
+ "lib/puppet/parser/functions/upcase.rb": "b0ed0e1ada21b9d73a00043146254335",
+ "lib/puppet/parser/functions/uriescape.rb": "f2facfe201658a65a7e81199cdd1bef7",
+ "lib/puppet/parser/functions/validate_absolute_path.rb": "892faf0e74b99b11190ec7fc4b78a893",
+ "lib/puppet/parser/functions/validate_array.rb": "9518be91bab77e56be711d1498d119b9",
+ "lib/puppet/parser/functions/validate_augeas.rb": "c5bbf1bc42b7ea024e48ab12b46f55e9",
+ "lib/puppet/parser/functions/validate_bool.rb": "bea67f1a0f5fc23ee8b632000cfa63db",
+ "lib/puppet/parser/functions/validate_cmd.rb": "dbb22e68eca3f6be63fb49b465b1d611",
+ "lib/puppet/parser/functions/validate_domain_name.rb": "04f4b1d0be9a8a12d278f0b044f78427",
+ "lib/puppet/parser/functions/validate_email_address.rb": "6dc01f14c43fdff19106a2388d01b51a",
+ "lib/puppet/parser/functions/validate_hash.rb": "80f7cfb430818e1497d3b12769d8f9c4",
+ "lib/puppet/parser/functions/validate_integer.rb": "edb176a717c4af6cd50d2d26e4da149d",
+ "lib/puppet/parser/functions/validate_ip_address.rb": "55d0f019803d687bf95bcc64e8751ba5",
+ "lib/puppet/parser/functions/validate_ipv4_address.rb": "94843b876cc92414b29223f7ac3cc3b6",
+ "lib/puppet/parser/functions/validate_ipv6_address.rb": "6c10396f466f64a6f897d1be4291dd4a",
+ "lib/puppet/parser/functions/validate_numeric.rb": "092cce5ed9d3a73319c48cdf9a2a822e",
+ "lib/puppet/parser/functions/validate_re.rb": "df6a2cc342dad63d008ef257fde9038a",
+ "lib/puppet/parser/functions/validate_slength.rb": "b20959e080f36bf320eacb472d125741",
+ "lib/puppet/parser/functions/validate_string.rb": "0239e1697134605a6385ff8c9bdc066b",
+ "lib/puppet/parser/functions/validate_x509_rsa_key_pair.rb": "b16e5ebaeb497e1639c7bf78d61c2b45",
+ "lib/puppet/parser/functions/values.rb": "94ac0ce49d09256677f6adddd40be129",
+ "lib/puppet/parser/functions/values_at.rb": "72d780badb5f600dbd6b9ca3271ee12f",
+ "lib/puppet/parser/functions/zip.rb": "aef1ee868716d07b01e605ae6c4741cc",
+ "lib/puppet/provider/file_line/ruby.rb": "06dd4b2bd0037fcdc8382fcd4214dda3",
+ "lib/puppet/type/anchor.rb": "95867e600863019b08990277c4254cac",
+ "lib/puppet/type/file_line.rb": "208655541a332e54e2d9abac0e328d33",
+ "locales/config.yaml": "d3795b3334faf13674a5d1e3759064ac",
+ "locales/ja/puppetlabs-stdlib.po": "805e5d893d2025ad57da8ec0614a6753",
+ "locales/puppetlabs-stdlib.pot": "23c892ac0683aef4b09aabe0037750ae",
+ "manifests/init.pp": "9560a09f657d7eebbfdb920cefcc1d4f",
+ "manifests/stages.pp": "72eb4fa624474faf23b39e57cf1590bd",
+ "metadata.json": "39391b92fcbbb4effff543a25abe371d",
+ "readmes/README_ja_JP.md": "eb710c5546a02051a8a4b5b182bde556",
+ "spec/acceptance/abs_spec.rb": "68e49c791f4f356278d5fae34b3cd9bf",
+ "spec/acceptance/anchor_spec.rb": "96b18124a8bd485928ef49ac82072789",
+ "spec/acceptance/any2array_spec.rb": "8071bc5d9616d73d29c252ca3f919300",
+ "spec/acceptance/base64_spec.rb": "817503716d7df9052ca3730a8d3fa1f5",
+ "spec/acceptance/bool2num_spec.rb": "b98e3dcca524e9ac2cc08979a566841d",
+ "spec/acceptance/build_csv.rb": "0d4e10040cb934a78c523bebda8a2362",
+ "spec/acceptance/capitalize_spec.rb": "8fb00604f391cb13c85e6e852b404697",
+ "spec/acceptance/ceiling_spec.rb": "b1cfdae5039f6e40be8c81d5bc70f88c",
+ "spec/acceptance/chomp_spec.rb": "b51f86c2957f9882609d3c5b0eac67df",
+ "spec/acceptance/chop_spec.rb": "f097d03666e000251f567ff90fec2cfe",
+ "spec/acceptance/clamp_spec.rb": "35aa8410bbd283546b3325c90c394521",
+ "spec/acceptance/concat_spec.rb": "0432bcd648b43d2b9fe539543cddfadd",
+ "spec/acceptance/count_spec.rb": "67c9f9083e980ab397b3d259367ac201",
+ "spec/acceptance/deep_merge_spec.rb": "a29b282369d829b04784c2b7035a66b0",
+ "spec/acceptance/defined_with_params_spec.rb": "0563530340cb2f802fb44e9840236037",
+ "spec/acceptance/delete_at_spec.rb": "a6bae7649fcfe02eaf58660a81660a9d",
+ "spec/acceptance/delete_spec.rb": "69ff71ade09add15063a1375b49d7ad9",
+ "spec/acceptance/delete_undef_values_spec.rb": "258ca3da1b06afc1e6d8588eed92e8f2",
+ "spec/acceptance/delete_values_spec.rb": "3a15a34628df45f6a2f25ebf14e3e4f1",
+ "spec/acceptance/deprecation_spec.rb": "3298d3fc62c4f18211add9ed273df85f",
+ "spec/acceptance/difference_spec.rb": "e6a0ebbdfffcd374520d40fce11d957b",
+ "spec/acceptance/dirname_spec.rb": "84cad3f9b2bb6d7e36fbf8b8df1be77b",
+ "spec/acceptance/downcase_spec.rb": "4b03b9a33254f5df52a76aa40a2143e5",
+ "spec/acceptance/empty_spec.rb": "b89067b0975336683a38bf20a6a1f036",
+ "spec/acceptance/ensure_resource_spec.rb": "d09c350ba1d0bf7ff14bacf4f1c8e487",
+ "spec/acceptance/flatten_spec.rb": "54da51ee7665de8b56252d20215a3c30",
+ "spec/acceptance/floor_spec.rb": "061f23967d177a6d7d728f59398ff088",
+ "spec/acceptance/fqdn_rand_string_spec.rb": "33d5fa38b5f880157ea69dd25a12a332",
+ "spec/acceptance/fqdn_rotate_spec.rb": "c280ce28ba57b9d67a3e3b1a0c14f342",
+ "spec/acceptance/get_module_path_spec.rb": "cb34a578c336f8572835520425878d5d",
+ "spec/acceptance/getparam_spec.rb": "eaa6149d19c6082d7d6cb7f81c1aa342",
+ "spec/acceptance/getvar_spec.rb": "afe43ffe3e071e0c1d18b679f714fdfc",
+ "spec/acceptance/grep_spec.rb": "b74c67c94d39a49e9ee395a6c5fc9c9d",
+ "spec/acceptance/has_interface_with_spec.rb": "36e2cc57fb3f9044e2b93fa98eb436ab",
+ "spec/acceptance/has_ip_address_spec.rb": "da00303c038e758115e96a0fb65ab9c5",
+ "spec/acceptance/has_ip_network_spec.rb": "c4991bb6905d4aeba6bab1c9f7cc3fa5",
+ "spec/acceptance/has_key_spec.rb": "d4eb28efd599e1eac485bf9f6ca930d3",
+ "spec/acceptance/hash_spec.rb": "0736319571163989e4df71dcff017fd1",
+ "spec/acceptance/intersection_spec.rb": "8bd80ad4ebf9627add63f257bf0674e4",
+ "spec/acceptance/is_a_spec.rb": "ecca7dbb41739ebffcefccc2cb85722d",
+ "spec/acceptance/is_array_spec.rb": "b5baf237a47ace8d53c3748c3432f226",
+ "spec/acceptance/is_bool_spec.rb": "fa53d0fc3486fc6473184105fad31f2e",
+ "spec/acceptance/is_domain_name_spec.rb": "963998fd1d72750dd800c8227fa9354c",
+ "spec/acceptance/is_float_spec.rb": "4f4d179d4e4ca3b6f38ccca6bb855a3f",
+ "spec/acceptance/is_function_available_spec.rb": "83bb5c733cf1dd2c15fa2f3add9ce61e",
+ "spec/acceptance/is_hash_spec.rb": "2bfe3af74c15731b2ab251bbaf386245",
+ "spec/acceptance/is_integer_spec.rb": "f68672a767a6216e3502fc08e61f4a01",
+ "spec/acceptance/is_ip_address_spec.rb": "680bcb2199c16d346a65c29c6042148c",
+ "spec/acceptance/is_ipv4_address_spec.rb": "5bbb9b312267da1a2124558867d0cec3",
+ "spec/acceptance/is_ipv6_address_spec.rb": "05e45351f00b3c4fbfc7ec78bb9f93c6",
+ "spec/acceptance/is_mac_address_spec.rb": "1971ab98b688992efadf80bd6ff5aedd",
+ "spec/acceptance/is_numeric_spec.rb": "a4b6c6d0b4570672f4cf8ecea3324d9f",
+ "spec/acceptance/is_string_spec.rb": "1faf6b5fc01a5924077449b3ecf22cbb",
+ "spec/acceptance/join_keys_to_values_spec.rb": "d8e6a7575e96e33e44ded6c1ef4d329c",
+ "spec/acceptance/join_spec.rb": "a0db319d437e05e97608cea0525d11e2",
+ "spec/acceptance/keys_spec.rb": "5712c1b5fdbb268369923d4f3a7e4a5c",
+ "spec/acceptance/loadjson_spec.rb": "c4a2bebd9648f8843cd394fc78691cb7",
+ "spec/acceptance/loadyaml_spec.rb": "641cee5b4c85bb01033c75bc5cc9678e",
+ "spec/acceptance/lstrip_spec.rb": "61355ba1f6b55cab4f75d9089509d963",
+ "spec/acceptance/max_spec.rb": "fd10617940c2e30cc102aa090f69ae6e",
+ "spec/acceptance/member_spec.rb": "92facc113e77834516361f7e91a6b07a",
+ "spec/acceptance/merge_spec.rb": "a2d398f1b407736d576a01a350a7b378",
+ "spec/acceptance/min_spec.rb": "b90fc74f13e90099e588b8de39bff084",
+ "spec/acceptance/nodesets/centos-7-x64.yml": "a713f3abd3657f0ae2878829badd23cd",
+ "spec/acceptance/nodesets/debian-8-x64.yml": "d2d2977900989f30086ad251a14a1f39",
+ "spec/acceptance/nodesets/default.yml": "b42da5a1ea0c964567ba7495574b8808",
+ "spec/acceptance/nodesets/docker/centos-7.yml": "8a3892807bdd62306ae4774f41ba11ae",
+ "spec/acceptance/nodesets/docker/debian-8.yml": "ac8e871d1068c96de5e85a89daaec6df",
+ "spec/acceptance/nodesets/docker/ubuntu-14.04.yml": "dc42ee922a96908d85b8f0f08203ce58",
+ "spec/acceptance/num2bool_spec.rb": "a1c7ae1ae573238474264f512ceac029",
+ "spec/acceptance/parsejson_spec.rb": "703943409a4942e143a9ee64428137d2",
+ "spec/acceptance/parseyaml_spec.rb": "4c423fec2126c06d73b680ccedb2d92a",
+ "spec/acceptance/pick_default_spec.rb": "74ef7cc0cff5613e2f5bb51860cc78f5",
+ "spec/acceptance/pick_spec.rb": "883435ee18338b44d8a809df948f013a",
+ "spec/acceptance/prefix_spec.rb": "6e3763b5c18208441b21d2f6eae24339",
+ "spec/acceptance/pw_hash_spec.rb": "ec6cc8b96fed721a5fd1053015827070",
+ "spec/acceptance/range_spec.rb": "d875cff37547b97946bebb726918c9d6",
+ "spec/acceptance/reject_spec.rb": "844ab5a15688cf0d4777f78f1ba94513",
+ "spec/acceptance/reverse_spec.rb": "3b1bb403962eedbdbc86f02c396bada0",
+ "spec/acceptance/rstrip_spec.rb": "85a3ba1c3ab9e0fd69c8676de1ff204b",
+ "spec/acceptance/shuffle_spec.rb": "c3541f8e2612d38aa11cb848ba5c2fd6",
+ "spec/acceptance/size_spec.rb": "07d3e1cf5e2e8205e8aeb075d65701b7",
+ "spec/acceptance/sort_spec.rb": "2985f4f244a826ef324fcd327899522f",
+ "spec/acceptance/squeeze_spec.rb": "1f6dd45cab59278b021a3c8ee931a988",
+ "spec/acceptance/str2bool_spec.rb": "875a523687b93ab94169ca06b02d8fc2",
+ "spec/acceptance/str2saltedsha512_spec.rb": "d7552194362956fd86e7be11c49d75e9",
+ "spec/acceptance/strftime_spec.rb": "d7d83f31a8b6968d7e49ed137939b03f",
+ "spec/acceptance/strip_spec.rb": "86a4ceaa1d46de1686cf457e7841e591",
+ "spec/acceptance/suffix_spec.rb": "3fc89836a92965f8093187554099bc5a",
+ "spec/acceptance/swapcase_spec.rb": "9b90e7d7d441e998a7946fb33a7d9edd",
+ "spec/acceptance/time_spec.rb": "b262929e40fb53bbaabca8fda696c5b3",
+ "spec/acceptance/to_bytes_spec.rb": "0907f39eb1815eb766e18d458a44a967",
+ "spec/acceptance/try_get_value_spec.rb": "2dfffd91ac418d5429b32ddb4cdb236c",
+ "spec/acceptance/type3x_spec.rb": "fa30d2d82906b774d69109ad08f963b4",
+ "spec/acceptance/type_spec.rb": "1d55a0ad8635c239a33a1d107bda5404",
+ "spec/acceptance/union_spec.rb": "7fc2a6f6b6c4c2abb625926cd9013cca",
+ "spec/acceptance/unique_spec.rb": "66bf8230e4a8a9ae15a8d2850ceb281b",
+ "spec/acceptance/upcase_spec.rb": "90b5ef5ac39f4748306869bf83031d1f",
+ "spec/acceptance/uriescape_spec.rb": "29ce7eea67a8b400c2f2f6d9e63390f6",
+ "spec/acceptance/validate_absolute_path_spec.rb": "56bcca87397652e38f56c84f3c4865ed",
+ "spec/acceptance/validate_array_spec.rb": "50273b0f02c5c45d52386d501f025712",
+ "spec/acceptance/validate_augeas_spec.rb": "006d3658397e85dd497d7c612cbb3ae5",
+ "spec/acceptance/validate_bool_spec.rb": "448cc97e9b277cea82a6aa15cb40cc88",
+ "spec/acceptance/validate_cmd_spec.rb": "c42681ac8aed0ca83577c0205fec6aa9",
+ "spec/acceptance/validate_hash_spec.rb": "e0c2114c7c365a90230335a2e8d9d817",
+ "spec/acceptance/validate_ipv4_address_spec.rb": "233a114fc42a9a138902531d8b5b2b50",
+ "spec/acceptance/validate_ipv6_address_spec.rb": "215aed228a0c626ee321212534b31264",
+ "spec/acceptance/validate_re_spec.rb": "10eb1f29d0cd62dfafef9f99939cbc81",
+ "spec/acceptance/validate_slength_spec.rb": "6c82dcb830e1d2cf66b60c425e5aa27b",
+ "spec/acceptance/validate_string_spec.rb": "3e4d023775e7b11de5d1deabf4bb4e39",
+ "spec/acceptance/values_at_spec.rb": "25ab415d4a3b2bbbf225f1e3410978dc",
+ "spec/acceptance/values_spec.rb": "7cd9f430afad102cae1feb5d4a6cc743",
+ "spec/acceptance/zip_spec.rb": "fc7b9e42b408d0fe2171b4eabfcfd585",
+ "spec/fixtures/dscacheutil/root": "e1a7622f55f3d1be258c9a5b16b474be",
+ "spec/fixtures/lsuser/root": "2ed657fa157372a81634539bb1a56be8",
+ "spec/fixtures/test/manifests/base32.pp": "2662eb916f3830689f40decfe8fddae8",
+ "spec/fixtures/test/manifests/base64.pp": "935f9c1b4ac741c58b7abd49d3cfb794",
+ "spec/fixtures/test/manifests/deftype.pp": "1f2e86fa39604fdfde8fd20b9ae92813",
+ "spec/fixtures/test/manifests/ensure_resources.pp": "898c473ba5641313294827f4b4845bd6",
+ "spec/functions/abs_spec.rb": "eb9982a88e173ed84926afbbda41452e",
+ "spec/functions/any2array_spec.rb": "3ada6ddbda41b8681ba4b924ce81d422",
+ "spec/functions/any2bool_spec.rb": "903aacf741bdf4f7049cd4ee1d34d673",
+ "spec/functions/assert_private_spec.rb": "c4f0ced23534a74d6478fbd7477003e7",
+ "spec/functions/base64_spec.rb": "5083c40b825f86863cc2950d97d3807b",
+ "spec/functions/basename_spec.rb": "beeae06a6fc449d44352031e4a61e900",
+ "spec/functions/bool2num_spec.rb": "bb82d4eed099e97c5af545cdce3445d6",
+ "spec/functions/bool2str_spec.rb": "286b56a5bab37d4849e10b7f0f9630ed",
+ "spec/functions/camelcase_spec.rb": "1d9ae972915a1c45c8093eda7ea8a1fe",
+ "spec/functions/capitalize_spec.rb": "8d7ed6e2c3a338b17a09e6c891c1215c",
+ "spec/functions/ceiling_spec.rb": "dbda35bf0b2aaffb87ba533454004569",
+ "spec/functions/chomp_spec.rb": "5883602173019b8237aed1624bd40170",
+ "spec/functions/chop_spec.rb": "3e293af75bdc7f72655eadcd9920c95f",
+ "spec/functions/clamp_spec.rb": "8094bc19ff0fe82dfd0a072b654bf318",
+ "spec/functions/concat_spec.rb": "d103f894bdb4a2054b17cb0185a033a1",
+ "spec/functions/convert_base_spec.rb": "534bd90106b2c58f736b897974c5a10a",
+ "spec/functions/count_spec.rb": "55a6ead532b31f2ccfcc7fb7126e34d7",
+ "spec/functions/deep_merge_spec.rb": "134d802b7d39e6523e3a622d2718ec12",
+ "spec/functions/defined_with_params_spec.rb": "b24e3fd629b4d52f1abd1b13f715a9a7",
+ "spec/functions/delete_at_spec.rb": "2a373b50759ef60b3abc569bca50537c",
+ "spec/functions/delete_regex_spec.rb": "5b6cf5e6d94da0d00fd612f4558fc426",
+ "spec/functions/delete_spec.rb": "0cee161af26c8dc4165bf0cfea09ce85",
+ "spec/functions/delete_undef_values_spec.rb": "00ca6e3d2c838b6b12263268c698e0ce",
+ "spec/functions/delete_values_spec.rb": "41003ea949782329513763df34861264",
+ "spec/functions/deprecation_spec.rb": "58094a18d86c44c6caf4cf29863880aa",
+ "spec/functions/difference_spec.rb": "bb86ac651f85148184a04248e21b3073",
+ "spec/functions/dig44_spec.rb": "1d8a681607f745e41499ce87d6ef00f0",
+ "spec/functions/dig_spec.rb": "74f65f4c4f237d9bc122abf5fd862b6b",
+ "spec/functions/dirname_spec.rb": "39b1fbb7cfd05881e21beaf81b667ec4",
+ "spec/functions/dos2unix_spec.rb": "f7f10a39d4d4d42bef7a1bc99d97ea1c",
+ "spec/functions/downcase_spec.rb": "2a5970a27352ebee3bae7b28bb4edacb",
+ "spec/functions/empty_spec.rb": "5b10598d2782eb25b10e4dd9e186aca0",
+ "spec/functions/ensure_packages_spec.rb": "c19f725196a6aee508c25c9c0e1468f4",
+ "spec/functions/ensure_resource_spec.rb": "de9dc96ceefe684e7c785f385136b44a",
+ "spec/functions/ensure_resources_spec.rb": "d8e93e55de05ddb1fce5c242ab21b0a7",
+ "spec/functions/flatten_spec.rb": "8e5fc1ec2c63778e41fda8a86603826b",
+ "spec/functions/floor_spec.rb": "68fdcf9ab8596a83ee00b83e52b2889b",
+ "spec/functions/fqdn_rand_string_spec.rb": "136cf6e77e02b42d79c0e5766779d5d4",
+ "spec/functions/fqdn_rotate_spec.rb": "792ada483512e4d60a3937fd1c8f788f",
+ "spec/functions/fqdn_uuid_spec.rb": "60526a453f556867b369496ca1215a86",
+ "spec/functions/get_module_path_spec.rb": "7c3aa0236a71a77e12698ef7988bec38",
+ "spec/functions/getparam_spec.rb": "807694642f3ebdfafca4c8f0eca4c062",
+ "spec/functions/getvar_spec.rb": "327fc59ca02525d9a6d266957461c32f",
+ "spec/functions/glob_spec.rb": "537139a45aa1acfb605aa0cb6b598b73",
+ "spec/functions/grep_spec.rb": "c79409710df9272306ac1211668dd85f",
+ "spec/functions/has_interface_with_spec.rb": "d484da75727170eb3ff22bbc71394fd1",
+ "spec/functions/has_ip_address_spec.rb": "811d63a9c87a1de43a18d07c8ee5a796",
+ "spec/functions/has_ip_network_spec.rb": "9ec0c0c607a60d2dde3a66fc969e4478",
+ "spec/functions/has_key_spec.rb": "d4d97da7d35a794e72d1bbc5e0a4838f",
+ "spec/functions/hash_spec.rb": "cd394a2a67891c1b8d8666d71ee8ede2",
+ "spec/functions/intersection_spec.rb": "be5f4ab66e9f8567b93c368acb5dbf7c",
+ "spec/functions/is_a_spec.rb": "e657f393cc3572883aa2ab872840f4bf",
+ "spec/functions/is_array_spec.rb": "aa5f9f75714c267f1ea0463412f24285",
+ "spec/functions/is_bool_spec.rb": "46ed9e2d70f68db12799918d88d2d804",
+ "spec/functions/is_domain_name_spec.rb": "0e2cf9c9410827484ee3652591757faf",
+ "spec/functions/is_email_address_spec.rb": "f3e60f28e9d66d7707a434a8edc79900",
+ "spec/functions/is_float_spec.rb": "a89f4bbc747ce7117c6899d8e5e75e83",
+ "spec/functions/is_function_available_spec.rb": "0f46d970fca74c87dbcbbaa588b6dc37",
+ "spec/functions/is_hash_spec.rb": "cec4b5638ea3f871350a055cee98ea11",
+ "spec/functions/is_integer_spec.rb": "aa78c5487a22744feccc74ad1ad7f211",
+ "spec/functions/is_ip_address_spec.rb": "c175629e894671b57ed97f76d7ee495c",
+ "spec/functions/is_ipv4_address_spec.rb": "c10a82ce2b0987cba45916f442759d8c",
+ "spec/functions/is_ipv6_address_spec.rb": "f33842262d74f6fa6ac459f980938ecf",
+ "spec/functions/is_mac_address_spec.rb": "80b7d3346f1b4b487f5f88257fe33bc4",
+ "spec/functions/is_numeric_spec.rb": "e3e3c3541c794d74ae1775ca5996e47d",
+ "spec/functions/is_string_spec.rb": "1b1fd9c63def53fcb519a04952057aa0",
+ "spec/functions/join_keys_to_values_spec.rb": "5b8d4704d1e3aee0a8b9738d1324f7f3",
+ "spec/functions/join_spec.rb": "73b5cde490bf58e28b76d839cd6ef1c7",
+ "spec/functions/keys_spec.rb": "921f060f4b6e0e754f4ff72204e2381e",
+ "spec/functions/length_spec.rb": "bd88fd83eb41377f554b1197210674ca",
+ "spec/functions/load_module_metadata_spec.rb": "fcd21ec96196921526179de3fa5de95d",
+ "spec/functions/loadjson_spec.rb": "4d24fcd02c823ea02eb56e96b223038e",
+ "spec/functions/loadyaml_spec.rb": "b85e7f0425df94bb3356db2e52530d79",
+ "spec/functions/lstrip_spec.rb": "7a6e82653fe4087615bb29e4d8818008",
+ "spec/functions/max_spec.rb": "e12bc75395d63b5c15c830291d2f8afe",
+ "spec/functions/member_spec.rb": "43c3c315d44b793a0da3ed80820d386f",
+ "spec/functions/merge_spec.rb": "48761dac5afc99bd381f76f88927cdb0",
+ "spec/functions/min_spec.rb": "44df74b50984cc4efedca7ac9adeef91",
+ "spec/functions/num2bool_spec.rb": "fe3c3dbec9787622850175db510fe4f0",
+ "spec/functions/parsejson_spec.rb": "2f626614bba7f123fc0704878cad731a",
+ "spec/functions/parseyaml_spec.rb": "1e41204590f35d1cc127efcbdaa8321f",
+ "spec/functions/pick_default_spec.rb": "9c8337fb7dd83df40d01c5977d62b4a7",
+ "spec/functions/pick_spec.rb": "856384e60757e1d94ca3aef161be3d0a",
+ "spec/functions/prefix_spec.rb": "a4d28e657d42a42e06f7bcaf1bba1c08",
+ "spec/functions/private_spec.rb": "689c5821596afd859de6312e8ffb1fea",
+ "spec/functions/pw_hash_spec.rb": "d9bdce271d38ce6ec1d8258e807a7c67",
+ "spec/functions/range_spec.rb": "9d38e84765c4fbd8351211741b493b01",
+ "spec/functions/regexpescape_spec.rb": "80a497405be58e82e849cfb3784dbfd1",
+ "spec/functions/reject_spec.rb": "24c6e7597e73bcef62637cf90d994db9",
+ "spec/functions/reverse_spec.rb": "19829abf65a041a74097cfeb8f9e821a",
+ "spec/functions/round_spec.rb": "62862ca723b0e2406e1ab278b4b8a7a8",
+ "spec/functions/rstrip_spec.rb": "240792c366063a1cf82c51615d3f4316",
+ "spec/functions/seeded_rand_spec.rb": "9ff38a91d988c51ef70149bb902e3a83",
+ "spec/functions/shell_escape_spec.rb": "513534e47818ce650b343985febedf9e",
+ "spec/functions/shell_join_spec.rb": "e47a7b81d864933fa3ed8b03f189019e",
+ "spec/functions/shell_split_spec.rb": "ea446ddf08763b98ca794d4aaf9878ee",
+ "spec/functions/shuffle_spec.rb": "f0415952345da7d4464512728f35e52f",
+ "spec/functions/size_spec.rb": "d3aa74419efba6ec5c4b50ccbd45bf88",
+ "spec/functions/sort_spec.rb": "ae131f00aa9ce2a576243f997e0f12b2",
+ "spec/functions/sprintf_hash_spec.rb": "1b014e8c0a44b935ec0c045e275ad6b3",
+ "spec/functions/squeeze_spec.rb": "3d01142c11d5e7e7e841c23e9a37e458",
+ "spec/functions/str2bool_spec.rb": "d099ca74f02ac231f699e59d7a41bafb",
+ "spec/functions/str2saltedsha512_spec.rb": "815dfb2f7c65f81769c117129e45bf85",
+ "spec/functions/strftime_spec.rb": "e4ff0163ab707966186d7941b0e5f18d",
+ "spec/functions/strip_spec.rb": "c439a03137befdff8dd0ef483bf1ef2c",
+ "spec/functions/suffix_spec.rb": "dac301a98ed47f85c62293ca968066ff",
+ "spec/functions/swapcase_spec.rb": "53e01155bd14271641dc954b02bc06e6",
+ "spec/functions/time_spec.rb": "eaf3f48601278bb250659b05022a2a44",
+ "spec/functions/to_bytes_spec.rb": "dbc093a1a72429a0a67e784ecabc100a",
+ "spec/functions/to_json_pretty_spec.rb": "318892fb8ae3fba91ea3a3f41d563c54",
+ "spec/functions/to_json_spec.rb": "e4fbcd70fb3e0b6890337b6eec51f1f0",
+ "spec/functions/to_yaml_spec.rb": "b151fd564e9f7e8b35b69c6ae46948e1",
+ "spec/functions/try_get_value_spec.rb": "53ab2e553ae441821ad02be3c952a34a",
+ "spec/functions/type3x_spec.rb": "cd85e50dda33d32fb90f08eafb29efd7",
+ "spec/functions/type_of_spec.rb": "ecfeb9d47e54f5aae421f7855853d47a",
+ "spec/functions/type_spec.rb": "3a7a71aed638cacfc3d22573cf66ced6",
+ "spec/functions/union_spec.rb": "237517b051eddffd7afc020eeb53c7a1",
+ "spec/functions/unique_spec.rb": "27af15518c2bc4f6dc3009d563d25144",
+ "spec/functions/unix2dos_spec.rb": "77e6d0e7c703576924981038472c8e4e",
+ "spec/functions/upcase_spec.rb": "3eb2544373f1c474b334dd9b37ae4818",
+ "spec/functions/uriescape_spec.rb": "b88f0575ba928b4f60635de6db77299c",
+ "spec/functions/validate_absolute_path_spec.rb": "09470e989ed56866d380e1fb1e2d81f2",
+ "spec/functions/validate_array_spec.rb": "814b2e7f39ed83d5ff0b822c32462a47",
+ "spec/functions/validate_augeas_spec.rb": "4bf035ec4548a00d42f73643374d6f58",
+ "spec/functions/validate_bool_spec.rb": "0c486955f041d86356d41f86ea0c6bd4",
+ "spec/functions/validate_cmd_spec.rb": "179e570e9aec94c5dcaf337a6b431d20",
+ "spec/functions/validate_domain_name_spec.rb": "611f3b301003d11a6a55e293dc3a8e5c",
+ "spec/functions/validate_email_address_spec.rb": "8bac32b793f1e4264ae32df975d4d893",
+ "spec/functions/validate_hash_spec.rb": "09e78289eac14bdc3389620a4dfc3c8d",
+ "spec/functions/validate_integer_spec.rb": "a82914e1813c10b0ffa432ccf44ef781",
+ "spec/functions/validate_ip_address_spec.rb": "fe5c58a23295a00c55637ee3dcb6470f",
+ "spec/functions/validate_ipv4_address_spec.rb": "b8b6ff3ab6dc9360635f6b3a4d2aaaec",
+ "spec/functions/validate_ipv6_address_spec.rb": "1ebc18a929b989eb4591260a75edb5de",
+ "spec/functions/validate_legacy_spec.rb": "2d93df10c72ec5dde1e6618c02e78d40",
+ "spec/functions/validate_numeric_spec.rb": "ace0a1f0d69c78ced85a02900e6d0f73",
+ "spec/functions/validate_re_spec.rb": "19e0f2589d5a48559efa61cfe308ef1b",
+ "spec/functions/validate_slength_spec.rb": "d0e2b4c6ca7050a39f02c1a3005dcb5f",
+ "spec/functions/validate_string_spec.rb": "7591075ba74d9d69145497ff0ba040ff",
+ "spec/functions/validate_x509_rsa_key_pair_spec.rb": "5d3260fcd331122fc3fb056fe8da5acf",
+ "spec/functions/values_at_spec.rb": "a434a3361626dfcab7adfc92a5a1ea4e",
+ "spec/functions/values_spec.rb": "c55dd25c91a51942dddc7dcffb74d022",
+ "spec/functions/zip_spec.rb": "163a0f62553252a8ef8adc9fc44a3568",
+ "spec/monkey_patches/alias_should_to_must.rb": "52ce6baeefea70b66c80cfdc5dfafddc",
+ "spec/monkey_patches/publicize_methods.rb": "d2ae9210754b0a4eae0d6bf33737fe90",
+ "spec/spec_helper.rb": "6a8493cc89df06740a1f7ed364aed66c",
+ "spec/spec_helper_acceptance.rb": "90ed03c8192a0711a4979af8c6bdc1f9",
+ "spec/spec_helper_local.rb": "5644c5ce611a9e131cf37106e2a8b841",
+ "spec/support/shared_data.rb": "dfe4cbdbe2833d670a89bcdf3163839b",
+ "spec/type_aliases/absolute_path_spec.rb": "5bdfe834183c06b06a406ac4c8a20622",
+ "spec/type_aliases/array_spec.rb": "5a7a5be96ccb1347a5a806ef436064e6",
+ "spec/type_aliases/base32_spec.rb": "3d4394fb10e0cc58f5ed6b11a00cdffc",
+ "spec/type_aliases/base64_spec.rb": "383aa3be600b38a3a7de1e488056262e",
+ "spec/type_aliases/bool_spec.rb": "798d1fb0b43cdc7c560ba8b61fb742e6",
+ "spec/type_aliases/compat__ip_address.rb": "7ee3a1f901e33a5a72632cd390629450",
+ "spec/type_aliases/compat__ipv4_spec.rb": "d091b3dcd1fc3a30fe080d9b53a69014",
+ "spec/type_aliases/compat__ipv6_spec.rb": "08005590462f404047995ec86a80e85c",
+ "spec/type_aliases/filemode_spec.rb": "81b7a8687b9bcf1ddaf5667d95498f19",
+ "spec/type_aliases/filesource_spec.rb": "4b72052c22274c568849c2138b6b44ab",
+ "spec/type_aliases/float_spec.rb": "e566885fdf22399a54450022bfbfd31a",
+ "spec/type_aliases/fqdn_spec.rb": "cc343ee15ae50af90a2a6faa41864111",
+ "spec/type_aliases/hash_spec.rb": "1b8c49a76db8b5ef44f0f0a8e56c5eb3",
+ "spec/type_aliases/host_spec.rb": "418b672c12248267e3aa810b8e9a3832",
+ "spec/type_aliases/httpsurl_spec.rb": "a0aff170decf6659dd5d253f06459ae0",
+ "spec/type_aliases/httpurl_spec.rb": "64e610fd2369f9579d72879ea80634f9",
+ "spec/type_aliases/integer_spec.rb": "8f66ae64602543d65e4b784527bf1463",
+ "spec/type_aliases/ip_address.rb": "064acb87912cb36c8fc0a1f3b5441eef",
+ "spec/type_aliases/ip_address_nosubnet_spec.rb": "9d196b9b9522a91ac2bc3a67ccd02d5f",
+ "spec/type_aliases/ip_address_spec.rb": "ae9c24b0ee7d77b967b93ffb13fb67bb",
+ "spec/type_aliases/ip_address_v4_nosubnet_spec.rb": "c30a31b7bcb92eed728be5fef7b45724",
+ "spec/type_aliases/ip_address_v4_spec.rb": "0aacb3967d4ca3a7f8bc3a17e93f141f",
+ "spec/type_aliases/ip_address_v6_alternative_spec.rb": "17da75c696f406ffbd4829a13828fcc5",
+ "spec/type_aliases/ip_address_v6_compressed_spec.rb": "508f6e102bbc3c7af4bd24df5e640f40",
+ "spec/type_aliases/ip_address_v6_full_spec.rb": "35ff79b1855e77ffff7c38599cfafaa2",
+ "spec/type_aliases/ip_address_v6_nosubnet_alternative_spec.rb": "020fc117a134398818910b41a76094aa",
+ "spec/type_aliases/ip_address_v6_nosubnet_compressed_spec.rb": "f97969e6cdae00e5a1ffbbd71ba7e08e",
+ "spec/type_aliases/ip_address_v6_nosubnet_full_spec.rb": "c5fad1a8e5fee0cfac3ee9f1b5083804",
+ "spec/type_aliases/ip_address_v6_spec.rb": "74a4c54bf8fffc4ebc3e33c12b085640",
+ "spec/type_aliases/ipv4_spec.rb": "7bb8f191690fb67806be4c8349872a3e",
+ "spec/type_aliases/ipv6_spec.rb": "8343f83b863e73348969d0f790a6fb6b",
+ "spec/type_aliases/numeric_spec.rb": "06ae28964dfad6ca60ac59468c33104b",
+ "spec/type_aliases/port__privileged_spec.rb": "531e8567e3251548324088e1cdac29d6",
+ "spec/type_aliases/port__unprivileged_spec.rb": "ec5aa19f8bfb62307617c0e9b002475d",
+ "spec/type_aliases/port_spec.rb": "6fff6e2cfc7b91e49b6dd169629f8a53",
+ "spec/type_aliases/string_spec.rb": "458ac453f5870066824b6a11ec49f9ae",
+ "spec/type_aliases/unixpath_spec.rb": "015ad5050bcbe3b9b633e13525412e48",
+ "spec/type_aliases/windowspath_spec.rb": "946275f885194c3f2fde07b66aa46f4a",
+ "spec/unit/facter/facter_dot_d_spec.rb": "01bd42a343214521b2dc340457f21e5d",
+ "spec/unit/facter/package_provider_spec.rb": "ce3015059cc3b8db3a8129563d08cf40",
+ "spec/unit/facter/pe_version_spec.rb": "8cd3ea8ee24a1fa1c64e27dac0ca7fc7",
+ "spec/unit/facter/root_home_spec.rb": "18f770e2105fbcb634c1a0501f0d2778",
+ "spec/unit/facter/service_provider_spec.rb": "19072e8955ba2f3ef64d452c574354c5",
+ "spec/unit/facter/util/puppet_settings_spec.rb": "d6c856b8da6e1ca4bcf377f4f7c2568e",
+ "spec/unit/puppet/parser/functions/enclose_ipv6_spec.rb": "660badf5fdca469a98e8e2359d6a2825",
+ "spec/unit/puppet/parser/functions/is_absolute_path_spec.rb": "258f55b8c9563bad0aaa9e98df4d6fc6",
+ "spec/unit/puppet/provider/file_line/ruby_spec.rb": "f5aca0856046c760832822816c44c705",
+ "spec/unit/puppet/provider/file_line/ruby_spec_alter.rb": "afa3589fb59f743bb8c2242c294951b2",
+ "spec/unit/puppet/provider/file_line/ruby_spec_use_cases.rb": "13d2c5198ca879f29d70ca230288b1e8",
+ "spec/unit/puppet/type/anchor_spec.rb": "5f67ab4f4a0cfc40cd2fcdb3f148f026",
+ "spec/unit/puppet/type/file_line_spec.rb": "92c3ac78210f730fc2135e012ded86bb",
+ "types/absolutepath.pp": "3ae6f48dd95835df87c5dacea13c88d2",
+ "types/base32.pp": "c1e7d9939641c49af90b07043a52112e",
+ "types/base64.pp": "6e61a5c608ab2147fdf295f97b1052c9",
+ "types/compat/absolute_path.pp": "c500d00e471fa7684abce8c67e2a0a3e",
+ "types/compat/array.pp": "43c41022dd743d55c8e9e82ce3ed741c",
+ "types/compat/bool.pp": "6e0cd7b2a7e1b9efaa0e273937211e58",
+ "types/compat/float.pp": "fd134a0e0e1abd420cec2107780a7afa",
+ "types/compat/hash.pp": "3535d98f0f3eaec44d443190f258e9ba",
+ "types/compat/integer.pp": "d73ad743def0a4e754cbf2e82d5c6b5d",
+ "types/compat/ip_address.pp": "d42c7435de30a469a71b69c45d642da7",
+ "types/compat/ipv4.pp": "962713ea8483c01f2188f87fac1fefa8",
+ "types/compat/ipv6.pp": "bc2c5d46bb49c5180c70c64a8a9ee6ea",
+ "types/compat/numeric.pp": "b9543932cda152dfc2cb7fb554a307f7",
+ "types/compat/re.pp": "70b05d4697e61f9af0c212ba063f395d",
+ "types/compat/string.pp": "b9a179664c85e121aa0277021627d126",
+ "types/ensure/service.pp": "efa28f903420bb9555910c27a9b810e8",
+ "types/filemode.pp": "1776107a2f48cb22131e61f4aaf93750",
+ "types/filesource.pp": "ca652b33c6848e2a6231279fe7cc58d0",
+ "types/fqdn.pp": "f6fb6bf625dab3bd0ab63a1ff7983fb8",
+ "types/host.pp": "69260768a909759bdc31aeaae58d449e",
+ "types/httpsurl.pp": "108225d0273e17d541b239882287ed15",
+ "types/httpurl.pp": "4ba64825b11af75997c59b5acf07c62d",
+ "types/ip/address/nosubnet.pp": "e7c5a338634dfd0eea60cf36092f3fd8",
+ "types/ip/address/v4/cidr.pp": "2f6f69e74d16f08f3e80e2ca3f3dd413",
+ "types/ip/address/v4/nosubnet.pp": "9590ebd639bc47fd25288d32dee5405d",
+ "types/ip/address/v4.pp": "18165fd02c81c08dff234f83d50662a0",
+ "types/ip/address/v6/alternative.pp": "9e82ba1516dc28cab9707066780ca512",
+ "types/ip/address/v6/compressed.pp": "f4d8102d586347ba093a2793271460c5",
+ "types/ip/address/v6/full.pp": "0492b9081ca01bfff8a3d3f07df5c41c",
+ "types/ip/address/v6/nosubnet/alternative.pp": "b9a6cd5a4c2a2e8013022fd4cfd11a3e",
+ "types/ip/address/v6/nosubnet/compressed.pp": "ca2f53bcc3f659d994a6e0d3fe17861e",
+ "types/ip/address/v6/nosubnet/full.pp": "5fa0bb70ed3e72ac52738ba182f22c1c",
+ "types/ip/address/v6/nosubnet.pp": "612651452cd225ade84fe31750d02903",
+ "types/ip/address/v6.pp": "1f3c0aa34dbc083d26f135246c8576eb",
+ "types/ip/address.pp": "9929a758afc9469acbcff0c2050bb0ab",
+ "types/ip_address.pp": "fdede88de3e8322ed265baf0a0e4229e",
+ "types/ipv4.pp": "495e86194de9d4e3c17a0abc195bec91",
+ "types/ipv6.pp": "bec72ad7b5e56ab34b93c61b2e1871a9",
+ "types/mac.pp": "b6b9a7148111578052bdb34e7ef0ce19",
+ "types/port/privileged.pp": "c4ce776dd07a3c8dd3379db8cd49e32a",
+ "types/port/unprivileged.pp": "85359128fa9261fe8bf58c8525574404",
+ "types/port.pp": "b1edd08c4eff860b3ea8bd84cd48ba81",
+ "types/unixpath.pp": "b64a48701e7adfda45d31fd80bee4ad0",
+ "types/windowspath.pp": "4c1eda331ecb43de98c29ed22d0ad448"
+} \ No newline at end of file
diff --git a/code/environments/production/modules/stdlib/examples/file_line.pp b/code/environments/production/modules/stdlib/examples/file_line.pp
new file mode 100644
index 0000000..e628bea
--- /dev/null
+++ b/code/environments/production/modules/stdlib/examples/file_line.pp
@@ -0,0 +1,9 @@
+# This is a simple smoke test
+# of the file_line resource type.
+file { '/tmp/dansfile':
+ ensure => file,
+}
+-> file_line { 'dans_line':
+ line => 'dan is awesome',
+ path => '/tmp/dansfile',
+}
diff --git a/code/environments/production/modules/stdlib/examples/has_interface_with.pp b/code/environments/production/modules/stdlib/examples/has_interface_with.pp
new file mode 100644
index 0000000..a578dd2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/examples/has_interface_with.pp
@@ -0,0 +1,9 @@
+include ::stdlib
+info('has_interface_with(\'lo\'):', has_interface_with('lo'))
+info('has_interface_with(\'loX\'):', has_interface_with('loX'))
+info('has_interface_with(\'ipaddress\', \'127.0.0.1\'):', has_interface_with('ipaddress', '127.0.0.1'))
+info('has_interface_with(\'ipaddress\', \'127.0.0.100\'):', has_interface_with('ipaddress', '127.0.0.100'))
+info('has_interface_with(\'network\', \'127.0.0.0\'):', has_interface_with('network', '127.0.0.0'))
+info('has_interface_with(\'network\', \'128.0.0.0\'):', has_interface_with('network', '128.0.0.0'))
+info('has_interface_with(\'netmask\', \'255.0.0.0\'):', has_interface_with('netmask', '255.0.0.0'))
+info('has_interface_with(\'netmask\', \'256.0.0.0\'):', has_interface_with('netmask', '256.0.0.0'))
diff --git a/code/environments/production/modules/stdlib/examples/has_ip_address.pp b/code/environments/production/modules/stdlib/examples/has_ip_address.pp
new file mode 100644
index 0000000..594143d
--- /dev/null
+++ b/code/environments/production/modules/stdlib/examples/has_ip_address.pp
@@ -0,0 +1,3 @@
+include ::stdlib
+info('has_ip_address(\'192.168.1.256\'):', has_ip_address('192.168.1.256'))
+info('has_ip_address(\'127.0.0.1\'):', has_ip_address('127.0.0.1'))
diff --git a/code/environments/production/modules/stdlib/examples/has_ip_network.pp b/code/environments/production/modules/stdlib/examples/has_ip_network.pp
new file mode 100644
index 0000000..1f1130d
--- /dev/null
+++ b/code/environments/production/modules/stdlib/examples/has_ip_network.pp
@@ -0,0 +1,3 @@
+include ::stdlib
+info('has_ip_network(\'127.0.0.0\'):', has_ip_network('127.0.0.0'))
+info('has_ip_network(\'128.0.0.0\'):', has_ip_network('128.0.0.0'))
diff --git a/code/environments/production/modules/stdlib/examples/init.pp b/code/environments/production/modules/stdlib/examples/init.pp
new file mode 100644
index 0000000..ad27972
--- /dev/null
+++ b/code/environments/production/modules/stdlib/examples/init.pp
@@ -0,0 +1 @@
+include ::stdlib
diff --git a/code/environments/production/modules/stdlib/lib/facter/facter_dot_d.rb b/code/environments/production/modules/stdlib/lib/facter/facter_dot_d.rb
new file mode 100644
index 0000000..5025ed9
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/facter/facter_dot_d.rb
@@ -0,0 +1,194 @@
+# A Facter plugin that loads facts from /etc/facter/facts.d
+# and /etc/puppetlabs/facter/facts.d.
+#
+# Facts can be in the form of JSON, YAML or Text files
+# and any executable that returns key=value pairs.
+#
+# In the case of scripts you can also create a file that
+# contains a cache TTL. For foo.sh store the ttl as just
+# a number in foo.sh.ttl
+#
+# The cache is stored in $libdir/facts_dot_d.cache as a mode
+# 600 file and will have the end result of not calling your
+# fact scripts more often than is needed
+class Facter::Util::DotD
+ require 'yaml'
+
+ def initialize(dir = '/etc/facts.d', cache_file = File.join(Puppet[:libdir], 'facts_dot_d.cache'))
+ @dir = dir
+ @cache_file = cache_file
+ @cache = nil
+ @types = { '.txt' => :txt, '.json' => :json, '.yaml' => :yaml }
+ end
+
+ def entries
+ Dir.entries(@dir).reject { |f| f =~ %r{^\.|\.ttl$} }.sort.map { |f| File.join(@dir, f) }
+ rescue
+ []
+ end
+
+ def fact_type(file)
+ extension = File.extname(file)
+
+ type = @types[extension] || :unknown
+
+ type = :script if type == :unknown && File.executable?(file)
+
+ type
+ end
+
+ def txt_parser(file)
+ File.readlines(file).each do |line|
+ next unless line =~ %r{^([^=]+)=(.+)$}
+ var = Regexp.last_match(1)
+ val = Regexp.last_match(2)
+
+ Facter.add(var) do
+ setcode { val }
+ end
+ end
+ rescue StandardError => e
+ Facter.warn("Failed to handle #{file} as text facts: #{e.class}: #{e}")
+ end
+
+ def json_parser(file)
+ begin
+ require 'json'
+ rescue LoadError
+ retry if require 'rubygems'
+ raise
+ end
+
+ JSON.parse(File.read(file)).each_pair do |f, v|
+ Facter.add(f) do
+ setcode { v }
+ end
+ end
+ rescue StandardError => e
+ Facter.warn("Failed to handle #{file} as json facts: #{e.class}: #{e}")
+ end
+
+ def yaml_parser(file)
+ require 'yaml'
+
+ YAML.load_file(file).each_pair do |f, v|
+ Facter.add(f) do
+ setcode { v }
+ end
+ end
+ rescue StandardError => e
+ Facter.warn("Failed to handle #{file} as yaml facts: #{e.class}: #{e}")
+ end
+
+ def script_parser(file)
+ result = cache_lookup(file)
+ ttl = cache_time(file)
+
+ if result
+ Facter.debug("Using cached data for #{file}")
+ else
+ result = Facter::Util::Resolution.exec(file)
+
+ if ttl > 0
+ Facter.debug("Updating cache for #{file}")
+ cache_store(file, result)
+ cache_save!
+ end
+ end
+
+ result.split("\n").each do |line|
+ next unless line =~ %r{^(.+)=(.+)$}
+ var = Regexp.last_match(1)
+ val = Regexp.last_match(2)
+
+ Facter.add(var) do
+ setcode { val }
+ end
+ end
+ rescue StandardError => e
+ Facter.warn("Failed to handle #{file} as script facts: #{e.class}: #{e}")
+ Facter.debug(e.backtrace.join("\n\t"))
+ end
+
+ def cache_save!
+ cache = load_cache
+ File.open(@cache_file, 'w', 0o600) { |f| f.write(YAML.dump(cache)) }
+ rescue # rubocop:disable Lint/HandleExceptions
+ end
+
+ def cache_store(file, data)
+ load_cache
+
+ @cache[file] = { :data => data, :stored => Time.now.to_i }
+ rescue # rubocop:disable Lint/HandleExceptions
+ end
+
+ def cache_lookup(file)
+ cache = load_cache
+
+ return nil if cache.empty?
+
+ ttl = cache_time(file)
+
+ return nil unless cache[file]
+ now = Time.now.to_i
+
+ return cache[file][:data] if ttl == -1
+ return cache[file][:data] if (now - cache[file][:stored]) <= ttl
+ return nil
+ rescue
+ return nil
+ end
+
+ def cache_time(file)
+ meta = file + '.ttl'
+
+ return File.read(meta).chomp.to_i
+ rescue
+ return 0
+ end
+
+ def load_cache
+ @cache ||= if File.exist?(@cache_file)
+ YAML.load_file(@cache_file)
+ else
+ {}
+ end
+
+ return @cache
+ rescue
+ @cache = {}
+ return @cache
+ end
+
+ def create
+ entries.each do |fact|
+ type = fact_type(fact)
+ parser = "#{type}_parser"
+
+ next unless respond_to?("#{type}_parser")
+ Facter.debug("Parsing #{fact} using #{parser}")
+
+ send(parser, fact)
+ end
+ end
+end
+
+mdata = Facter.version.match(%r{(\d+)\.(\d+)\.(\d+)})
+if mdata
+ (major, minor, _patch) = mdata.captures.map { |v| v.to_i }
+ if major < 2
+ # Facter 1.7 introduced external facts support directly
+ unless major == 1 && minor > 6
+ Facter::Util::DotD.new('/etc/facter/facts.d').create
+ Facter::Util::DotD.new('/etc/puppetlabs/facter/facts.d').create
+
+ # Windows has a different configuration directory that defaults to a vendor
+ # specific sub directory of the %COMMON_APPDATA% directory.
+ if Dir.const_defined? 'COMMON_APPDATA' # rubocop:disable Metrics/BlockNesting : Any attempt to alter this breaks it
+ windows_facts_dot_d = File.join(Dir::COMMON_APPDATA, 'PuppetLabs', 'facter', 'facts.d')
+ Facter::Util::DotD.new(windows_facts_dot_d).create
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/facter/package_provider.rb b/code/environments/production/modules/stdlib/lib/facter/package_provider.rb
new file mode 100644
index 0000000..0aec171
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/facter/package_provider.rb
@@ -0,0 +1,21 @@
+# Fact: package_provider
+#
+# Purpose: Returns the default provider Puppet will choose to manage packages
+# on this system
+#
+# Resolution: Instantiates a dummy package resource and return the provider
+#
+# Caveats:
+#
+require 'puppet/type'
+require 'puppet/type/package'
+
+Facter.add(:package_provider) do
+ setcode do
+ if defined? Gem && Gem::Version.new(Facter.value(:puppetversion).split(' ')[0]) >= Gem::Version.new('3.6')
+ Puppet::Type.type(:package).newpackage(:name => 'dummy', :allow_virtual => 'true')[:provider].to_s
+ else
+ Puppet::Type.type(:package).newpackage(:name => 'dummy')[:provider].to_s
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/facter/pe_version.rb b/code/environments/production/modules/stdlib/lib/facter/pe_version.rb
new file mode 100644
index 0000000..594f9dc
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/facter/pe_version.rb
@@ -0,0 +1,61 @@
+# Fact: is_pe, pe_version, pe_major_version, pe_minor_version, pe_patch_version
+#
+# Purpose: Return various facts about the PE state of the system
+#
+# Resolution: Uses a regex match against puppetversion to determine whether the
+# machine has Puppet Enterprise installed, and what version (overall, major,
+# minor, patch) is installed.
+#
+# Caveats:
+#
+Facter.add('pe_version') do
+ setcode do
+ puppet_ver = Facter.value('puppetversion')
+ if !puppet_ver.nil?
+ pe_ver = puppet_ver.match(%r{Puppet Enterprise (\d+\.\d+\.\d+)})
+ pe_ver[1] if pe_ver
+ else
+ nil
+ end
+ end
+end
+
+Facter.add('is_pe') do
+ setcode do
+ if Facter.value(:pe_version).to_s.empty?
+ false
+ else
+ true
+ end
+ end
+end
+
+Facter.add('pe_major_version') do
+ confine :is_pe => true
+ setcode do
+ pe_version = Facter.value(:pe_version)
+ if pe_version
+ pe_version.to_s.split('.')[0]
+ end
+ end
+end
+
+Facter.add('pe_minor_version') do
+ confine :is_pe => true
+ setcode do
+ pe_version = Facter.value(:pe_version)
+ if pe_version
+ pe_version.to_s.split('.')[1]
+ end
+ end
+end
+
+Facter.add('pe_patch_version') do
+ confine :is_pe => true
+ setcode do
+ pe_version = Facter.value(:pe_version)
+ if pe_version
+ pe_version.to_s.split('.')[2]
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/facter/puppet_settings.rb b/code/environments/production/modules/stdlib/lib/facter/puppet_settings.rb
new file mode 100644
index 0000000..b932189
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/facter/puppet_settings.rb
@@ -0,0 +1,42 @@
+# These facter facts return the value of the Puppet vardir and environment path
+# settings for the node running puppet or puppet agent. The intent is to
+# enable Puppet modules to automatically have insight into a place where they
+# can place variable data, or for modules running on the puppet master to know
+# where environments are stored.
+#
+# The values should be directly usable in a File resource path attribute.
+#
+begin
+ require 'facter/util/puppet_settings'
+rescue LoadError => e
+ # puppet apply does not add module lib directories to the $LOAD_PATH (See
+ # #4248). It should (in the future) but for the time being we need to be
+ # defensive which is what this rescue block is doing.
+ rb_file = File.join(File.dirname(__FILE__), 'util', 'puppet_settings.rb')
+ load rb_file if File.exist?(rb_file) || raise(e)
+end
+
+# These will be nil if Puppet is not available.
+Facter.add(:puppet_vardir) do
+ setcode do
+ Facter::Util::PuppetSettings.with_puppet do
+ Puppet[:vardir]
+ end
+ end
+end
+
+Facter.add(:puppet_environmentpath) do
+ setcode do
+ Facter::Util::PuppetSettings.with_puppet do
+ Puppet[:environmentpath]
+ end
+ end
+end
+
+Facter.add(:puppet_server) do
+ setcode do
+ Facter::Util::PuppetSettings.with_puppet do
+ Puppet[:server]
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/facter/root_home.rb b/code/environments/production/modules/stdlib/lib/facter/root_home.rb
new file mode 100644
index 0000000..d4add7b
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/facter/root_home.rb
@@ -0,0 +1,44 @@
+# A facter fact to determine the root home directory.
+# This varies on PE supported platforms and may be
+# reconfigured by the end user.
+module Facter::Util::RootHome
+ class << self
+ def returnt_root_home
+ root_ent = Facter::Util::Resolution.exec('getent passwd root')
+ # The home directory is the sixth element in the passwd entry
+ # If the platform doesn't have getent, root_ent will be nil and we should
+ # return it straight away.
+ root_ent && root_ent.split(':')[5]
+ end
+ end
+end
+
+Facter.add(:root_home) do
+ setcode { Facter::Util::RootHome.returnt_root_home }
+end
+
+Facter.add(:root_home) do
+ confine :kernel => :darwin
+ setcode do
+ str = Facter::Util::Resolution.exec('dscacheutil -q user -a name root')
+ hash = {}
+ str.split("\n").each do |pair|
+ key, value = pair.split(%r{:})
+ hash[key] = value
+ end
+ hash['dir'].strip
+ end
+end
+
+Facter.add(:root_home) do
+ confine :kernel => :aix
+ root_home = nil
+ setcode do
+ str = Facter::Util::Resolution.exec('lsuser -c -a home root')
+ str && str.split("\n").each do |line|
+ next if line =~ %r{^#}
+ root_home = line.split(%r{:})[1]
+ end
+ root_home
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/facter/service_provider.rb b/code/environments/production/modules/stdlib/lib/facter/service_provider.rb
new file mode 100644
index 0000000..a117921
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/facter/service_provider.rb
@@ -0,0 +1,17 @@
+# Fact: service_provider
+#
+# Purpose: Returns the default provider Puppet will choose to manage services
+# on this system
+#
+# Resolution: Instantiates a dummy service resource and return the provider
+#
+# Caveats:
+#
+require 'puppet/type'
+require 'puppet/type/service'
+
+Facter.add(:service_provider) do
+ setcode do
+ Puppet::Type.type(:service).newservice(:name => 'dummy')[:provider].to_s
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/facter/util/puppet_settings.rb b/code/environments/production/modules/stdlib/lib/facter/util/puppet_settings.rb
new file mode 100644
index 0000000..d12e92c
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/facter/util/puppet_settings.rb
@@ -0,0 +1,16 @@
+# A method to evaluate a Facter code block if puppet is loaded.
+module Facter::Util::PuppetSettings
+ # This method is intended to provide a convenient way to evaluate a
+ # Facter code block only if Puppet is loaded. This is to account for the
+ # situation where the fact happens to be in the load path, but Puppet is
+ # not loaded for whatever reason. Perhaps the user is simply running
+ # facter without the --puppet flag and they happen to be working in a lib
+ # directory of a module.
+ def self.with_puppet
+ Module.const_get('Puppet')
+ rescue NameError
+ nil
+ else
+ yield
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb
new file mode 100644
index 0000000..af6109d
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb
@@ -0,0 +1,32 @@
+# Function to print deprecation warnings, Logs a warning once for a given key. The uniqueness key - can appear once.
+# The msg is the message text including any positional information that is formatted by the user/caller of the method.
+# It is affected by the puppet setting 'strict', which can be set to :error (outputs as an error message),
+# :off (no message / error is displayed) and :warning (default, outputs a warning) *Type*: String, String.
+#
+
+Puppet::Functions.create_function(:deprecation) do
+ dispatch :deprecation do
+ param 'String', :key
+ param 'String', :message
+ end
+
+ def deprecation(key, message)
+ if defined? Puppet::Pops::PuppetStack.stacktrace
+ stacktrace = Puppet::Pops::PuppetStack.stacktrace()
+ file = stacktrace[0]
+ line = stacktrace[1]
+ message = "#{message} at #{file}:#{line}"
+ end
+ # depending on configuration setting of strict
+ case Puppet.settings[:strict]
+ when :off # rubocop:disable Lint/EmptyWhen : Is required to prevent false errors
+ # do nothing
+ when :error
+ raise("deprecation. #{key}. #{message}")
+ else
+ unless ENV['STDLIB_LOG_DEPRECATIONS'] == 'false'
+ Puppet.deprecation_warning(message, key)
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/fact.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/fact.rb
new file mode 100644
index 0000000..48736ad
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/fact.rb
@@ -0,0 +1,57 @@
+# Digs into the facts hash using dot-notation
+#
+# Example usage:
+#
+# fact('osfamily')
+# fact('os.architecture')
+#
+# Array indexing:
+#
+# fact('mountpoints."/dev".options.1')
+#
+# Fact containing a "." in the name:
+#
+# fact('vmware."VRA.version"')
+#
+Puppet::Functions.create_function(:fact) do
+ dispatch :fact do
+ param 'String', :fact_name
+ end
+
+ def to_dot_syntax(array_path)
+ array_path.map { |string|
+ string.include?('.') ? %("#{string}") : string
+ }.join('.')
+ end
+
+ def fact(fact_name)
+ facts = closure_scope['facts']
+
+ # Transform the dot-notation string into an array of paths to walk. Make
+ # sure to correctly extract double-quoted values containing dots as single
+ # elements in the path.
+ path = fact_name.scan(%r{([^."]+)|(?:")([^"]+)(?:")}).map { |x| x.compact.first }
+
+ walked_path = []
+ path.reduce(facts) do |d, k|
+ return nil if d.nil? || k.nil?
+
+ if d.is_a?(Array)
+ begin
+ result = d[Integer(k)]
+ rescue ArgumentError => e # rubocop:disable Lint/UselessAssignment : Causes errors if assigment is removed.
+ Puppet.warning("fact request for #{fact_name} returning nil: '#{to_dot_syntax(walked_path)}' is an array; cannot index to '#{k}'")
+ result = nil
+ end
+ elsif d.is_a?(Hash)
+ result = d[k]
+ else
+ Puppet.warning("fact request for #{fact_name} returning nil: '#{to_dot_syntax(walked_path)}' is not a collection; cannot walk to '#{k}'")
+ result = nil
+ end
+
+ walked_path << k
+ result
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_a.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_a.rb
new file mode 100644
index 0000000..24b9744
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_a.rb
@@ -0,0 +1,32 @@
+# Boolean check to determine whether a variable is of a given data type. This is equivalent to the `=~` type checks.
+#
+# @example how to check a data type
+# # check a data type
+# foo = 3
+# $bar = [1,2,3]
+# $baz = 'A string!'
+#
+# if $foo.is_a(Integer) {
+# notify { 'foo!': }
+# }
+# if $bar.is_a(Array) {
+# notify { 'bar!': }
+# }
+# if $baz.is_a(String) {
+# notify { 'baz!': }
+# }
+#
+# See the documentation for "The Puppet Type System" for more information about types.
+# See the `assert_type()` function for flexible ways to assert the type of a value.
+#
+Puppet::Functions.create_function(:is_a) do
+ dispatch :is_a do
+ param 'Any', :value
+ param 'Type', :type
+ end
+
+ def is_a(value, type) # rubocop:disable Style/PredicateName : Used in to many other places to rename at this time, attempting to refactor caused Rubocop to crash.
+ # See puppet's lib/puppet/pops/evaluator/evaluator_impl.rb eval_MatchExpression
+ Puppet::Pops::Types::TypeCalculator.instance?(type, value)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_absolute_path.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_absolute_path.rb
new file mode 100644
index 0000000..c9d92eb
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_absolute_path.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_absolute_path) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_absolute_path', 'This method is deprecated, please use match expressions with Stdlib::Compat::Absolute_Path instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_absolute_path', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_array.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_array.rb
new file mode 100644
index 0000000..fdc60dd
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_array.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_array) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_array', 'This method is deprecated, please use match expressions with Stdlib::Compat::Array instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_array', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_bool.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_bool.rb
new file mode 100644
index 0000000..1672f0a
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_bool.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_bool) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_bool', 'This method is deprecated, please use match expressions with Stdlib::Compat::Bool instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_bool', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_float.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_float.rb
new file mode 100644
index 0000000..03e94d3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_float.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_float) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_float', 'This method is deprecated, please use match expressions with Stdlib::Compat::Float instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_float', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_ip_address.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_ip_address.rb
new file mode 100644
index 0000000..1ab67e7
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_ip_address.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_ip_address) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_ip_address', 'This method is deprecated, please use match expressions with Stdlib::Compat::Ip_address instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_ip_address', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv4_address.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv4_address.rb
new file mode 100644
index 0000000..034f9ba
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv4_address.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_ipv4_address) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_ipv4_address', 'This method is deprecated, please use match expressions with Stdlib::Compat::Ipv4 instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_ipv4_address', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv6_address.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv6_address.rb
new file mode 100644
index 0000000..c8fb3ab
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_ipv6_address.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_ipv6_address) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_ipv4_address', 'This method is deprecated, please use match expressions with Stdlib::Compat::Ipv6 instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_ipv6_address', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_numeric.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_numeric.rb
new file mode 100644
index 0000000..79a6bbf
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_numeric.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_numeric) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_numeric', 'This method is deprecated, please use match expressions with Stdlib::Compat::Numeric instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_numeric', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/is_string.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/is_string.rb
new file mode 100644
index 0000000..a32216c
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/is_string.rb
@@ -0,0 +1,17 @@
+Puppet::Functions.create_function(:is_string) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'is_string', 'This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.')
+ scope.send('function_is_string', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/length.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/length.rb
new file mode 100644
index 0000000..8cd43e5
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/length.rb
@@ -0,0 +1,14 @@
+# A function to eventually replace the old size() function for stdlib - The original size function did not handle Puppets new type capabilities, so this function is a Puppet 4 compatible solution.
+Puppet::Functions.create_function(:length) do
+ dispatch :length do
+ param 'Variant[String,Array,Hash]', :value
+ end
+ def length(value)
+ if value.is_a?(String)
+ result = value.length
+ elsif value.is_a?(Array) || value.is_a?(Hash)
+ result = value.size
+ end
+ result
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/sprintf_hash.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/sprintf_hash.rb
new file mode 100644
index 0000000..2536bc9
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/sprintf_hash.rb
@@ -0,0 +1,29 @@
+# Uses sprintf with named references.
+#
+# The first parameter is format string describing how the rest of the parameters in the hash
+# should be formatted. See the documentation for the `Kernel::sprintf` function in Ruby for
+# all the details.
+#
+# In the given argument hash with parameters, all keys are converted to symbols so they work
+# with the `sprintf` function.
+#
+# @example Format a string and number
+# $output = sprintf_hash('String: %<foo>s / number converted to binary: %<number>b',
+# { 'foo' => 'a string', 'number' => 5 })
+# # $output = 'String: a string / number converted to binary: 101'
+#
+Puppet::Functions.create_function(:sprintf_hash) do
+ # @param format The format to use.
+ # @param arguments Hash with parameters.
+ # @return The formatted string.
+ dispatch :sprintf_hash do
+ param 'String', :format
+ param 'Hash', :arguments
+ # Disabled for now. This gives issues on puppet 4.7.1.
+ # return_type 'String'
+ end
+
+ def sprintf_hash(format, arguments)
+ Kernel.sprintf(format, Hash[arguments.map { |(k, v)| [k.to_sym, v] }])
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/to_json.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/to_json.rb
new file mode 100644
index 0000000..782d695
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/to_json.rb
@@ -0,0 +1,21 @@
+# Take a data structure and output it as JSON
+#
+# @example how to output JSON
+# # output json to a file
+# file { '/tmp/my.json':
+# ensure => file,
+# content => to_json($myhash),
+# }
+#
+#
+require 'json'
+
+Puppet::Functions.create_function(:to_json) do
+ dispatch :to_json do
+ param 'Any', :data
+ end
+
+ def to_json(data)
+ data.to_json
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/to_json_pretty.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/to_json_pretty.rb
new file mode 100644
index 0000000..a7a1458
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/to_json_pretty.rb
@@ -0,0 +1,38 @@
+# Take a data structure and output it as pretty JSON
+#
+# @example how to output pretty JSON
+# # output pretty json to a file
+# file { '/tmp/my.json':
+# ensure => file,
+# content => to_json_pretty($myhash),
+# }
+#
+# @example how to output pretty JSON skipping over keys with undef values
+# # output pretty JSON to a file skipping over undef values
+# file { '/tmp/my.json':
+# ensure => file,
+# content => to_json_pretty({
+# param_one => 'value',
+# param_two => undef,
+# }),
+# }
+#
+require 'json'
+
+Puppet::Functions.create_function(:to_json_pretty) do
+ dispatch :to_json_pretty do
+ param 'Variant[Hash, Array]', :data
+ optional_param 'Boolean', :skip_undef
+ end
+
+ def to_json_pretty(data, skip_undef = false)
+ if skip_undef
+ if data.is_a? Array
+ data = data.reject { |value| value.nil? }
+ elsif data.is_a? Hash
+ data = data.reject { |_, value| value.nil? }
+ end
+ end
+ JSON.pretty_generate(data) << "\n"
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/to_yaml.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/to_yaml.rb
new file mode 100644
index 0000000..fdd7370
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/to_yaml.rb
@@ -0,0 +1,21 @@
+# Take a data structure and output it as YAML
+#
+# @example how to output YAML
+# # output yaml to a file
+# file { '/tmp/my.yaml':
+# ensure => file,
+# content => to_yaml($myhash),
+# }
+#
+#
+require 'yaml'
+
+Puppet::Functions.create_function(:to_yaml) do
+ dispatch :to_yaml do
+ param 'Any', :data
+ end
+
+ def to_yaml(data)
+ data.to_yaml
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/type_of.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/type_of.rb
new file mode 100644
index 0000000..5bed6d5
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/type_of.rb
@@ -0,0 +1,19 @@
+# Returns the type when passed a value.
+#
+# @example how to compare values' types
+# # compare the types of two values
+# if type_of($first_value) != type_of($second_value) { fail("first_value and second_value are different types") }
+# @example how to compare against an abstract type
+# unless type_of($first_value) <= Numeric { fail("first_value must be Numeric") }
+# unless type_of{$first_value) <= Collection[1] { fail("first_value must be an Array or Hash, and contain at least one element") }
+#
+# See the documentation for "The Puppet Type System" for more information about types.
+# See the `assert_type()` function for flexible ways to assert the type of a value.
+#
+# The built-in type() function in puppet is generally preferred over this function
+# this function is provided for backwards compatibility.
+Puppet::Functions.create_function(:type_of) do
+ def type_of(value)
+ Puppet::Pops::Types::TypeCalculator.infer_set(value)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_absolute_path.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_absolute_path.rb
new file mode 100644
index 0000000..44f600f
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_absolute_path.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_absolute_path) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_absolute_path', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Absolute_Path. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_absolute_path', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_array.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_array.rb
new file mode 100644
index 0000000..2bedd3f
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_array.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_array) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_array', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Array. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_array', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_bool.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_bool.rb
new file mode 100644
index 0000000..907eed3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_bool.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_bool) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_bool', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_bool', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_hash.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_hash.rb
new file mode 100644
index 0000000..c6a61a4
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_hash.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_hash) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_hash', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Hash. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_hash', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_integer.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_integer.rb
new file mode 100644
index 0000000..487dcf7
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_integer.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_integer) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_integer', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Integer. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_integer', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ip_address.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ip_address.rb
new file mode 100644
index 0000000..68e7f7f
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ip_address.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_ip_address) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_ip_address', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_ip_address', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv4_address.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv4_address.rb
new file mode 100644
index 0000000..caeeaca
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv4_address.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_ipv4_address) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_ipv4_address', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Ipv4_Address. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_ipv4_address', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv6_address.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv6_address.rb
new file mode 100644
index 0000000..c035357
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_ipv6_address.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_ipv6_address) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff
+ # -c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_ipv6_address', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Ipv6_address. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_ipv6_address', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_legacy.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_legacy.rb
new file mode 100644
index 0000000..21646ad
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_legacy.rb
@@ -0,0 +1,62 @@
+Puppet::Functions.create_function(:validate_legacy) do
+ # The function checks a value against both the target_type (new) and the previous_validation function (old).
+
+ dispatch :validate_legacy do
+ param 'Any', :scope
+ param 'Type', :target_type
+ param 'String', :function_name
+ param 'Any', :value
+ repeated_param 'Any', :args
+ end
+
+ dispatch :validate_legacy_s do
+ param 'Any', :scope
+ param 'String', :type_string
+ param 'String', :function_name
+ param 'Any', :value
+ repeated_param 'Any', :args
+ end
+
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff-
+ # c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def validate_legacy_s(scope, type_string, *args)
+ t = Puppet::Pops::Types::TypeParser.new.parse(type_string, scope)
+ validate_legacy(scope, t, *args)
+ end
+
+ def validate_legacy(scope, target_type, function_name, value, *prev_args)
+ if assert_type(target_type, value)
+ if previous_validation(scope, function_name, value, *prev_args)
+ # Silently passes
+ else
+ Puppet.notice("Accepting previously invalid value for target type '#{target_type}'")
+ end
+ else
+ inferred_type = Puppet::Pops::Types::TypeCalculator.infer_set(value)
+ error_msg = Puppet::Pops::Types::TypeMismatchDescriber.new.describe_mismatch("validate_legacy(#{function_name})", target_type, inferred_type)
+ if previous_validation(scope, function_name, value, *prev_args)
+ call_function('deprecation', 'validate_legacy', error_msg)
+ else
+ call_function('fail', error_msg)
+ end
+ end
+ end
+
+ def previous_validation(scope, function_name, value, *prev_args)
+ # Call the previous validation function and catch any errors. Return true if no errors are thrown.
+
+ scope.send("function_#{function_name}".to_s, [value, *prev_args])
+ true
+ rescue Puppet::ParseError
+ false
+ end
+
+ def assert_type(type, value)
+ Puppet::Pops::Types::TypeCalculator.instance?(type, value)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_numeric.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_numeric.rb
new file mode 100644
index 0000000..3adb0a8
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_numeric.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_numeric) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff-
+ # c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_numeric', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Numeric. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_numeric', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_re.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_re.rb
new file mode 100644
index 0000000..d357aab
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_re.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_re) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff-
+ # c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_re', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Pattern[]. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_re', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_slength.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_slength.rb
new file mode 100644
index 0000000..ad6f7b3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_slength.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_slength) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff-
+ # c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_slength', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with String[]. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_slength', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/functions/validate_string.rb b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_string.rb
new file mode 100644
index 0000000..a908c19
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/functions/validate_string.rb
@@ -0,0 +1,18 @@
+Puppet::Functions.create_function(:validate_string) do
+ dispatch :deprecation_gen do
+ param 'Any', :scope
+ repeated_param 'Any', :args
+ end
+ # Workaround PUP-4438 (fixed: https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08#diff-
+ # c937cc584953271bb3d3b3c2cb141790R221) to support puppet < 4.1.0 and puppet < 3.8.1.
+ def call(scope, *args)
+ manipulated_args = [scope] + args
+ self.class.dispatcher.dispatch(self, scope, manipulated_args)
+ end
+
+ def deprecation_gen(scope, *args)
+ call_function('deprecation', 'validate_string', 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README.')
+ scope.send('function_validate_string', args)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/abs.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/abs.rb
new file mode 100644
index 0000000..84bef8c
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/abs.rb
@@ -0,0 +1,33 @@
+#
+# abs.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:abs, :type => :rvalue, :doc => <<-DOC
+ Returns the absolute value of a number, for example -34.56 becomes
+ 34.56. Takes a single integer and float value as an argument.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "abs(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ if value.is_a?(String)
+ if value =~ %r{^-?(?:\d+)(?:\.\d+){1}$}
+ value = value.to_f
+ elsif value =~ %r{^-?\d+$}
+ value = value.to_i
+ else
+ raise(Puppet::ParseError, 'abs(): Requires float or integer to work with')
+ end
+ end
+
+ # We have numeric value to handle ...
+ result = value.abs
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2array.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2array.rb
new file mode 100644
index 0000000..510c2d5
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2array.rb
@@ -0,0 +1,29 @@
+#
+# any2array.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:any2array, :type => :rvalue, :doc => <<-DOC
+ This converts any object to an array containing that object. Empty argument
+ lists are converted to an empty array. Arrays are left untouched. Hashes are
+ converted to arrays of alternating keys and values.
+ DOC
+ ) do |arguments|
+
+ if arguments.empty?
+ return []
+ end
+
+ return arguments unless arguments.length == 1
+ return arguments[0] if arguments[0].is_a?(Array)
+ if arguments[0].is_a?(Hash)
+ result = []
+ arguments[0].each do |key, value|
+ result << key << value
+ end
+ return result
+ end
+ return arguments
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2bool.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2bool.rb
new file mode 100644
index 0000000..9eb634d
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/any2bool.rb
@@ -0,0 +1,53 @@
+#
+# any2bool.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:any2bool, :type => :rvalue, :doc => <<-DOC
+ This converts 'anything' to a boolean. In practise it does the following:
+
+ * Strings such as Y,y,1,T,t,TRUE,yes,'true' will return true
+ * Strings such as 0,F,f,N,n,FALSE,no,'false' will return false
+ * Booleans will just return their original value
+ * Number (or a string representation of a number) > 0 will return true, otherwise false
+ * undef will return false
+ * Anything else will return true
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "any2bool(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ # If argument is already Boolean, return it
+ if !!arguments[0] == arguments[0] # rubocop:disable Style/DoubleNegation : Could not find a better way to check if a boolean
+ return arguments[0]
+ end
+
+ arg = arguments[0]
+
+ if arg.nil?
+ return false
+ end
+
+ if arg == :undef
+ return false
+ end
+
+ valid_float = begin
+ !!Float(arg) # rubocop:disable Style/DoubleNegation : Could not find a better way to check if a boolean
+ rescue
+ false
+ end
+
+ if arg.is_a?(Numeric)
+ return function_num2bool([arguments[0]])
+ end
+
+ if arg.is_a?(String)
+ return function_num2bool([arguments[0]]) if valid_float
+ return function_str2bool([arguments[0]])
+ end
+
+ return true
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/assert_private.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/assert_private.rb
new file mode 100644
index 0000000..9cdebb9
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/assert_private.rb
@@ -0,0 +1,27 @@
+#
+# assert_private.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:assert_private, :doc => <<-DOC
+ Sets the current class or definition as private.
+ Calling the class or definition from outside the current module will fail.
+ DOC
+ ) do |args|
+
+ raise(Puppet::ParseError, "assert_private(): Wrong number of arguments given (#{args.size}}) for 0 or 1)") if args.size > 1
+
+ scope = self
+ if scope.lookupvar('module_name') != scope.lookupvar('caller_module_name')
+ message = nil
+ if args[0] && args[0].is_a?(String)
+ message = args[0]
+ else
+ manifest_name = scope.source.name
+ manifest_type = scope.source.type
+ message = (manifest_type.to_s == 'hostclass') ? 'Class' : 'Definition'
+ message += " #{manifest_name} is private"
+ end
+ raise(Puppet::ParseError, message)
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/base64.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/base64.rb
new file mode 100644
index 0000000..484c2f1
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/base64.rb
@@ -0,0 +1,67 @@
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+module Puppet::Parser::Functions
+ newfunction(:base64, :type => :rvalue, :doc => <<-'DOC') do |args|
+ Base64 encode or decode a string based on the command and the string submitted
+
+ Usage:
+
+ $encodestring = base64('encode', 'thestring')
+ $decodestring = base64('decode', 'dGhlc3RyaW5n')
+
+ # explicitly define encode/decode method: default, strict, urlsafe
+ $method = 'default'
+ $encodestring = base64('encode', 'thestring', $method)
+ $decodestring = base64('decode', 'dGhlc3RyaW5n', $method)
+
+ DOC
+
+ require 'base64'
+
+ raise Puppet::ParseError, "base64(): Wrong number of arguments (#{args.length}; must be >= 2)" unless args.length >= 2
+
+ actions = %w[encode decode]
+
+ unless actions.include?(args[0])
+ raise Puppet::ParseError, "base64(): the first argument must be one of 'encode' or 'decode'"
+ end
+
+ unless args[1].is_a?(String)
+ raise Puppet::ParseError, 'base64(): the second argument must be a string to base64'
+ end
+
+ method = %w[default strict urlsafe]
+
+ chosen_method = if args.length <= 2
+ 'default'
+ else
+ args[2]
+ end
+
+ unless method.include?(chosen_method)
+ raise Puppet::ParseError, "base64(): the third argument must be one of 'default', 'strict', or 'urlsafe'"
+ end
+
+ case args[0]
+ when 'encode'
+ case chosen_method
+ when 'default'
+ result = Base64.encode64(args[1])
+ when 'strict'
+ result = Base64.strict_encode64(args[1])
+ when 'urlsafe'
+ result = Base64.urlsafe_encode64(args[1])
+ end
+ when 'decode'
+ case chosen_method
+ when 'default'
+ result = Base64.decode64(args[1])
+ when 'strict'
+ result = Base64.strict_decode64(args[1])
+ when 'urlsafe'
+ result = Base64.urlsafe_decode64(args[1])
+ end
+ end
+
+ return result
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/basename.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/basename.rb
new file mode 100644
index 0000000..b717fa1
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/basename.rb
@@ -0,0 +1,24 @@
+#
+# basename.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:basename, :type => :rvalue, :doc => <<-DOC
+ Strips directory (and optional suffix) from a filename
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, 'basename(): No arguments given') if arguments.empty?
+ raise(Puppet::ParseError, "basename(): Too many arguments given (#{arguments.size})") if arguments.size > 2
+ raise(Puppet::ParseError, 'basename(): Requires string as first argument') unless arguments[0].is_a?(String)
+
+ rv = File.basename(arguments[0]) if arguments.size == 1
+ if arguments.size == 2
+ raise(Puppet::ParseError, 'basename(): Requires string as second argument') unless arguments[1].is_a?(String)
+ rv = File.basename(arguments[0], arguments[1])
+ end
+
+ return rv
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2num.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2num.rb
new file mode 100644
index 0000000..e8ad961
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2num.rb
@@ -0,0 +1,24 @@
+#
+# bool2num.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:bool2num, :type => :rvalue, :doc => <<-DOC
+ Converts a boolean to a number. Converts the values:
+ false, f, 0, n, and no to 0
+ true, t, 1, y, and yes to 1
+ Requires a single boolean or string as an input.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "bool2num(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = function_str2bool([arguments[0]])
+
+ # We have real boolean values as well ...
+ result = value ? 1 : 0
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2str.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2str.rb
new file mode 100644
index 0000000..502ab2e
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/bool2str.rb
@@ -0,0 +1,43 @@
+#
+# bool2str.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:bool2str, :type => :rvalue, :doc => <<-DOC
+ Converts a boolean to a string using optionally supplied arguments. The
+ optional second and third arguments represent what true and false will be
+ converted to respectively. If only one argument is given, it will be
+ converted from a boolean to a string containing 'true' or 'false'.
+
+ *Examples:*
+
+ bool2str(true) => 'true'
+ bool2str(true, 'yes', 'no') => 'yes'
+ bool2str(false, 't', 'f') => 'f'
+
+ Requires a single boolean as an input.
+ DOC
+ ) do |arguments|
+
+ unless arguments.size == 1 || arguments.size == 3
+ raise(Puppet::ParseError, "bool2str(): Wrong number of arguments given (#{arguments.size} for 3)")
+ end
+
+ value = arguments[0]
+ true_string = arguments[1] || 'true'
+ false_string = arguments[2] || 'false'
+ klass = value.class
+
+ # We can have either true or false, and nothing else
+ unless [FalseClass, TrueClass].include?(klass)
+ raise(Puppet::ParseError, 'bool2str(): Requires a boolean to work with')
+ end
+
+ unless [true_string, false_string].all? { |x| x.is_a?(String) }
+ raise(Puppet::ParseError, 'bool2str(): Requires strings to convert to')
+ end
+
+ return value ? true_string : false_string
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/camelcase.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/camelcase.rb
new file mode 100644
index 0000000..fdc54a2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/camelcase.rb
@@ -0,0 +1,31 @@
+#
+# camelcase.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:camelcase, :type => :rvalue, :doc => <<-DOC
+ Converts the case of a string or all strings in an array to camel case.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "camelcase(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+ klass = value.class
+
+ unless [Array, String].include?(klass)
+ raise(Puppet::ParseError, 'camelcase(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? i.split('_').map { |e| e.capitalize }.join : i }
+ else
+ value.split('_').map { |e| e.capitalize }.join
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/capitalize.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/capitalize.rb
new file mode 100644
index 0000000..7d7703f
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/capitalize.rb
@@ -0,0 +1,29 @@
+#
+# capitalize.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:capitalize, :type => :rvalue, :doc => <<-DOC
+ Capitalizes the first letter of a string or array of strings.
+ Requires either a single string or an array as an input.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "capitalize(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'capitalize(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? i.capitalize : i }
+ else
+ value.capitalize
+ end
+
+ return result
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ceiling.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ceiling.rb
new file mode 100644
index 0000000..d0323a8
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ceiling.rb
@@ -0,0 +1,25 @@
+#
+# ceiling.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:ceiling, :type => :rvalue, :doc => <<-DOC
+ Returns the smallest integer greater or equal to the argument.
+ Takes a single numeric value as an argument.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "ceiling(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ begin
+ arg = Float(arguments[0])
+ rescue TypeError, ArgumentError => _e
+ raise(Puppet::ParseError, "ceiling(): Wrong argument type given (#{arguments[0]} for Numeric)")
+ end
+
+ raise(Puppet::ParseError, "ceiling(): Wrong argument type given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false
+
+ arg.ceil
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/chomp.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/chomp.rb
new file mode 100644
index 0000000..0e9cd6d
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/chomp.rb
@@ -0,0 +1,31 @@
+#
+# chomp.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:chomp, :type => :rvalue, :doc => <<-DOC
+ Removes the record separator from the end of a string or an array of
+ strings, for example `hello\n` becomes `hello`.
+ Requires a single string or array as an input.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "chomp(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'chomp(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? i.chomp : i }
+ else
+ value.chomp
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/chop.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/chop.rb
new file mode 100644
index 0000000..80e8964
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/chop.rb
@@ -0,0 +1,33 @@
+#
+# chop.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:chop, :type => :rvalue, :doc => <<-DOC
+ Returns a new string with the last character removed. If the string ends
+ with `\r\n`, both characters are removed. Applying chop to an empty
+ string returns an empty string. If you wish to merely remove record
+ separators then you should use the `chomp` function.
+ Requires a string or array of strings as input.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "chop(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'chop(): Requires either an array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? i.chop : i }
+ else
+ value.chop
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/clamp.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/clamp.rb
new file mode 100644
index 0000000..0aea511
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/clamp.rb
@@ -0,0 +1,28 @@
+#
+# clamp.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:clamp, :type => :rvalue, :arity => -2, :doc => <<-DOC
+ Clamps value to a range.
+ DOC
+ ) do |args|
+
+ args.flatten!
+
+ raise(Puppet::ParseError, 'clamp(): Wrong number of arguments, need three to clamp') if args.size != 3
+
+ # check values out
+ args.each do |value|
+ case [value.class]
+ when [String]
+ raise(Puppet::ParseError, "clamp(): Required explicit numeric (#{value}:String)") unless value =~ %r{^\d+$}
+ when [Hash]
+ raise(Puppet::ParseError, "clamp(): The Hash type is not allowed (#{value})")
+ end
+ end
+
+ # convert to numeric each element
+ # then sort them and get a middle value
+ args.map { |n| n.to_i }.sort[1]
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/concat.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/concat.rb
new file mode 100644
index 0000000..9a83ec1
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/concat.rb
@@ -0,0 +1,39 @@
+#
+# concat.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:concat, :type => :rvalue, :doc => <<-DOC
+ Appends the contents of multiple arrays into array 1.
+
+ *Example:*
+
+ concat(['1','2','3'],['4','5','6'],['7','8','9'])
+
+ Would result in:
+
+ ['1','2','3','4','5','6','7','8','9']
+ DOC
+ ) do |arguments|
+
+ # Check that more than 2 arguments have been given ...
+ raise(Puppet::ParseError, "concat(): Wrong number of arguments given (#{arguments.size} for < 2)") if arguments.size < 2
+
+ a = arguments[0]
+
+ # Check that the first parameter is an array
+ unless a.is_a?(Array)
+ raise(Puppet::ParseError, 'concat(): Requires array to work with')
+ end
+
+ result = a
+ arguments.shift
+
+ arguments.each do |x|
+ result += (x.is_a?(Array) ? x : [x])
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/convert_base.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/convert_base.rb
new file mode 100644
index 0000000..6d17f85
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/convert_base.rb
@@ -0,0 +1,36 @@
+#
+# convert_base.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:convert_base, :type => :rvalue, :arity => 2, :doc => <<-'DOC') do |args|
+ Converts a given integer or base 10 string representing an integer to a specified base, as a string.
+
+ Usage:
+
+ $binary_repr = convert_base(5, 2) # $binary_repr is now set to "101"
+ $hex_repr = convert_base("254", "16") # $hex_repr is now set to "fe"
+
+ DOC
+
+ raise Puppet::ParseError, 'convert_base(): First argument must be either a string or an integer' unless args[0].is_a?(Integer) || args[0].is_a?(String)
+ raise Puppet::ParseError, 'convert_base(): Second argument must be either a string or an integer' unless args[1].is_a?(Integer) || args[1].is_a?(String)
+
+ if args[0].is_a?(String)
+ raise Puppet::ParseError, 'convert_base(): First argument must be an integer or a string corresponding to an integer in base 10' unless args[0] =~ %r{^[0-9]+$}
+ end
+
+ if args[1].is_a?(String)
+ raise Puppet::ParseError, 'convert_base(): First argument must be an integer or a string corresponding to an integer in base 10' unless args[1] =~ %r{^[0-9]+$}
+ end
+
+ number_to_convert = args[0]
+ new_base = args[1]
+
+ number_to_convert = number_to_convert.to_i
+ new_base = new_base.to_i
+
+ raise Puppet::ParseError, 'convert_base(): base must be at least 2 and must not be greater than 36' unless new_base >= 2 && new_base <= 36
+
+ return number_to_convert.to_s(new_base)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/count.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/count.rb
new file mode 100644
index 0000000..f5ac8c3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/count.rb
@@ -0,0 +1,24 @@
+#
+# count.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:count, :type => :rvalue, :arity => -2, :doc => <<-DOC
+ Takes an array as first argument and an optional second argument.
+ Count the number of elements in array that matches second argument.
+ If called with only an array it counts the number of elements that are not nil/undef.
+ DOC
+ ) do |args|
+
+ if args.size > 2
+ raise(ArgumentError, "count(): Wrong number of arguments given #{args.size} for 1 or 2.")
+ end
+
+ collection, item = args
+
+ if item
+ collection.count item
+ else
+ collection.count { |obj| !obj.nil? && obj != :undef && obj != '' }
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb
new file mode 100644
index 0000000..dd70c61
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb
@@ -0,0 +1,47 @@
+#
+# deep_merge.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:deep_merge, :type => :rvalue, :doc => <<-'DOC') do |args|
+ Recursively merges two or more hashes together and returns the resulting hash.
+
+ For example:
+
+ $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+ $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
+ $merged_hash = deep_merge($hash1, $hash2)
+ # The resulting hash is equivalent to:
+ # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
+
+ When there is a duplicate key that is a hash, they are recursively merged.
+ When there is a duplicate key that is not a hash, the key in the rightmost hash will "win."
+
+ DOC
+
+ if args.length < 2
+ raise Puppet::ParseError, "deep_merge(): wrong number of arguments (#{args.length}; must be at least 2)"
+ end
+
+ deep_merge = proc do |hash1, hash2|
+ hash1.merge(hash2) do |_key, old_value, new_value|
+ if old_value.is_a?(Hash) && new_value.is_a?(Hash)
+ deep_merge.call(old_value, new_value)
+ else
+ new_value
+ end
+ end
+ end
+
+ result = {}
+ args.each do |arg|
+ next if arg.is_a?(String) && arg.empty? # empty string is synonym for puppet's undef
+ # If the argument was not a hash, skip it.
+ unless arg.is_a?(Hash)
+ raise Puppet::ParseError, "deep_merge: unexpected argument type #{arg.class}, only expects hash arguments"
+ end
+
+ result = deep_merge.call(result, arg)
+ end
+ return(result)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb
new file mode 100644
index 0000000..1383308
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb
@@ -0,0 +1,57 @@
+# Test whether a given class or definition is defined
+require 'puppet/parser/functions'
+
+Puppet::Parser::Functions.newfunction(:defined_with_params,
+ :type => :rvalue,
+ :doc => <<-'DOC'
+ Takes a resource reference and an optional hash of attributes.
+
+ Returns true if a resource with the specified attributes has already been added
+ to the catalog, and false otherwise.
+
+ user { 'dan':
+ ensure => present,
+ }
+
+ if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
+ user { 'dan': ensure => present, }
+ }
+DOC
+ ) do |vals|
+ reference, params = vals
+ raise(ArgumentError, 'Must specify a reference') unless reference
+ if !params || params == ''
+ params = {}
+ end
+ ret = false
+
+ if Puppet::Util::Package.versioncmp(Puppet.version, '4.6.0') >= 0
+ # Workaround for PE-20308
+ if reference.is_a?(String)
+ type_name, title = Puppet::Resource.type_and_title(reference, nil)
+ type = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(find_global_scope, type_name.downcase)
+ elsif reference.is_a?(Puppet::Resource)
+ type = reference.resource_type
+ title = reference.title
+ else
+ raise(ArgumentError, "Reference is not understood: '#{reference.class}'")
+ end
+ # end workaround
+ else
+ type = reference.to_s
+ title = nil
+ end
+
+ resource = findresource(type, title)
+ if resource
+ matches = params.map do |key, value|
+ # eql? avoids bugs caused by monkeypatching in puppet
+ resource_is_undef = resource[key].eql?(:undef) || resource[key].nil?
+ value_is_undef = value.eql?(:undef) || value.nil?
+ (resource_is_undef && value_is_undef) || (resource[key] == value)
+ end
+ ret = params.empty? || !matches.include?(false)
+ end
+ Puppet.debug("Resource #{reference} was not determined to be defined")
+ ret
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete.rb
new file mode 100644
index 0000000..f83ff16
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete.rb
@@ -0,0 +1,42 @@
+#
+# delete.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:delete, :type => :rvalue, :doc => <<-DOC
+ Deletes all instances of a given element from an array, substring from a
+ string, or key from a hash.
+
+ *Examples:*
+
+ delete(['a','b','c','b'], 'b')
+ Would return: ['a','c']
+
+ delete({'a'=>1,'b'=>2,'c'=>3}, 'b')
+ Would return: {'a'=>1,'c'=>3}
+
+ delete({'a'=>1,'b'=>2,'c'=>3}, ['b','c'])
+ Would return: {'a'=>1}
+
+ delete('abracadabra', 'bra')
+ Would return: 'acada'
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "delete(): Wrong number of arguments given #{arguments.size} for 2") unless arguments.size == 2
+
+ collection = arguments[0].dup
+ Array(arguments[1]).each do |item|
+ case collection
+ when Array, Hash
+ collection.delete item
+ when String
+ collection.gsub! item, ''
+ else
+ raise(TypeError, "delete(): First argument must be an Array, String, or Hash. Given an argument of class #{collection.class}.")
+ end
+ end
+ collection
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_at.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_at.rb
new file mode 100644
index 0000000..e40ad26
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_at.rb
@@ -0,0 +1,45 @@
+#
+# delete_at.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:delete_at, :type => :rvalue, :doc => <<-DOC
+ Deletes a determined indexed value from an array.
+
+ *Examples:*
+
+ delete_at(['a','b','c'], 1)
+
+ Would return: ['a','c']
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "delete_at(): Wrong number of arguments given (#{arguments.size} for 2)") if arguments.size < 2
+
+ array = arguments[0]
+
+ unless array.is_a?(Array)
+ raise(Puppet::ParseError, 'delete_at(): Requires array to work with')
+ end
+
+ index = arguments[1]
+
+ if index.is_a?(String) && !index.match(%r{^\d+$})
+ raise(Puppet::ParseError, 'delete_at(): You must provide non-negative numeric index')
+ end
+
+ result = array.clone
+
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ index = index.to_i
+
+ if index > result.size - 1 # First element is at index 0 is it not?
+ raise(Puppet::ParseError, 'delete_at(): Given index exceeds size of array given')
+ end
+
+ result.delete_at(index) # We ignore the element that got deleted ...
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_regex.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_regex.rb
new file mode 100644
index 0000000..64cad9c
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_regex.rb
@@ -0,0 +1,43 @@
+#
+# delete_regex.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:delete_regex, :type => :rvalue, :doc => <<-DOC
+ deletes all instances of a given element that match a regular expression
+ from an array or key from a hash. Multiple regular expressions are assumed
+ to be matched as an OR.
+
+ *Examples:*
+
+ delete_regex(['a','b','c','b'], 'b')
+ Would return: ['a','c']
+
+ delete_regex(['a','b','c','b'], ['b', 'c'])
+ Would return: ['a']
+
+ delete_regex({'a'=>1,'b'=>2,'c'=>3}, 'b')
+ Would return: {'a'=>1,'c'=>3}
+
+ delete_regex({'a'=>1,'b'=>2,'c'=>3}, '^a$')
+ Would return: {'b'=>2,'c'=>3}
+
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "delete_regex(): Wrong number of arguments given #{arguments.size} for 2") unless arguments.size == 2
+
+ collection = arguments[0].dup
+ Array(arguments[1]).each do |item|
+ case collection
+ when Array, Hash, String
+ collection.reject! { |coll_item| (coll_item =~ %r{\b#{item}\b}) }
+ else
+ raise(TypeError, "delete_regex(): First argument must be an Array, Hash, or String. Given an argument of class #{collection.class}.")
+ end
+ end
+ collection
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb
new file mode 100644
index 0000000..af2dbc7
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb
@@ -0,0 +1,34 @@
+#
+# delete_undef_values.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:delete_undef_values, :type => :rvalue, :doc => <<-DOC
+ Returns a copy of input hash or array with all undefs deleted.
+
+ *Examples:*
+
+ $hash = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})
+
+ Would return: {a => 'A', b => '', d => false}
+
+ $array = delete_undef_values(['A','',undef,false])
+
+ Would return: ['A','',false]
+
+ DOC
+ ) do |args|
+
+ raise(Puppet::ParseError, "delete_undef_values(): Wrong number of arguments given (#{args.size})") if args.empty?
+
+ unless args[0].is_a?(Array) || args[0].is_a?(Hash)
+ raise(Puppet::ParseError, "delete_undef_values(): expected an array or hash, got #{args[0]} type #{args[0].class} ")
+ end
+ result = args[0].dup
+ if result.is_a?(Hash)
+ result.delete_if { |_key, val| val.equal? :undef }
+ elsif result.is_a?(Array)
+ result.delete :undef
+ end
+ result
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_values.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_values.rb
new file mode 100644
index 0000000..1192766
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/delete_values.rb
@@ -0,0 +1,26 @@
+#
+# delete_values.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:delete_values, :type => :rvalue, :doc => <<-DOC
+ Deletes all instances of a given value from a hash.
+
+ *Examples:*
+
+ delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B')
+
+ Would return: {'a'=>'A','c'=>'C','B'=>'D'}
+
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "delete_values(): Wrong number of arguments given (#{arguments.size} of 2)") if arguments.size != 2
+
+ hash, item = arguments
+
+ unless hash.is_a?(Hash)
+ raise(TypeError, "delete_values(): First argument must be a Hash. Given an argument of class #{hash.class}.")
+ end
+ hash.dup.delete_if { |_key, val| item == val }
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/deprecation.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/deprecation.rb
new file mode 100644
index 0000000..01f0deb
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/deprecation.rb
@@ -0,0 +1,19 @@
+#
+# deprecation.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:deprecation, :doc => <<-DOC
+ Function to print deprecation warnings (this is the 3.X version of it), The uniqueness key - can appear once. The msg is the message text including any positional information that is formatted by the user/caller of the method.).
+DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "deprecation: Wrong number of arguments given (#{arguments.size} for 2)") unless arguments.size == 2
+
+ key = arguments[0]
+ message = arguments[1]
+
+ if ENV['STDLIB_LOG_DEPRECATIONS'] == 'true'
+ warning("deprecation. #{key}. #{message}")
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/difference.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/difference.rb
new file mode 100644
index 0000000..cfaebc9
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/difference.rb
@@ -0,0 +1,34 @@
+#
+# difference.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:difference, :type => :rvalue, :doc => <<-DOC
+ This function returns the difference between two arrays.
+ The returned array is a copy of the original array, removing any items that
+ also appear in the second array.
+
+ *Examples:*
+
+ difference(["a","b","c"],["b","c","d"])
+
+ Would return: ["a"]
+ DOC
+ ) do |arguments|
+
+ # Two arguments are required
+ raise(Puppet::ParseError, "difference(): Wrong number of arguments given (#{arguments.size} for 2)") if arguments.size != 2
+
+ first = arguments[0]
+ second = arguments[1]
+
+ unless first.is_a?(Array) && second.is_a?(Array)
+ raise(Puppet::ParseError, 'difference(): Requires 2 arrays')
+ end
+
+ result = first - second
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig.rb
new file mode 100644
index 0000000..75e83aa
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig.rb
@@ -0,0 +1,15 @@
+#
+# dig.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:dig, :type => :rvalue, :doc => <<-DOC
+ DEPRECATED: This function has been replaced in Puppet 4.5.0, please use dig44() for backwards compatibility or use the new version.
+ DOC
+ ) do |arguments|
+ warning('dig() DEPRECATED: This function has been replaced in Puppet 4.5.0, please use dig44() for backwards compatibility or use the new version.')
+ unless Puppet::Parser::Functions.autoloader.loaded?(:dig44)
+ Puppet::Parser::Functions.autoloader.load(:dig44)
+ end
+ function_dig44(arguments)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig44.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig44.rb
new file mode 100644
index 0000000..e7e78bf
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dig44.rb
@@ -0,0 +1,65 @@
+#
+# dig44.rb
+#
+module Puppet::Parser::Functions
+ newfunction(
+ :dig44,
+ :type => :rvalue,
+ :arity => -2,
+ :doc => <<-DOC
+ DEPRECATED: This function has been replaced in puppet 4.5.0.
+
+ Looks up into a complex structure of arrays and hashes and returns a value
+ or the default value if nothing was found.
+
+ Key can contain slashes to describe path components. The function will go down
+ the structure and try to extract the required value.
+
+ $data = {
+ 'a' => {
+ 'b' => [
+ 'b1',
+ 'b2',
+ 'b3',
+ ]
+ }
+ }
+
+ $value = dig44($data, ['a', 'b', '2'], 'not_found')
+ => $value = 'b3'
+
+ a -> first hash key
+ b -> second hash key
+ 2 -> array index starting with 0
+
+ not_found -> (optional) will be returned if there is no value or the path
+ did not match. Defaults to nil.
+
+ In addition to the required "key" argument, the function accepts a default
+ argument. It will be returned if no value was found or a path component is
+ missing. And the fourth argument can set a variable path separator.
+ DOC
+ ) do |arguments|
+ # Two arguments are required
+ raise(Puppet::ParseError, "dig44(): Wrong number of arguments given (#{arguments.size} for at least 2)") if arguments.size < 2
+
+ data, path, default = *arguments
+
+ raise(Puppet::ParseError, "dig44(): first argument must be a hash or an array, given #{data.class.name}") unless data.is_a?(Hash) || data.is_a?(Array)
+ raise(Puppet::ParseError, "dig44(): second argument must be an array, given #{path.class.name}") unless path.is_a? Array
+
+ value = path.reduce(data) do |structure, key|
+ break unless structure.is_a?(Hash) || structure.is_a?(Array)
+ if structure.is_a? Array
+ begin
+ key = Integer key
+ rescue
+ break
+ end
+ end
+ break if structure[key].nil? || structure[key] == :undef
+ structure[key]
+ end
+ value.nil? ? default : value
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dirname.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dirname.rb
new file mode 100644
index 0000000..a243287
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dirname.rb
@@ -0,0 +1,24 @@
+#
+# dirname.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:dirname, :type => :rvalue, :doc => <<-DOC
+ Returns the dirname of a path.
+ DOC
+ ) do |arguments|
+
+ if arguments.empty?
+ raise(Puppet::ParseError, 'dirname(): No arguments given')
+ end
+ if arguments.size > 1
+ raise(Puppet::ParseError, "dirname(): Too many arguments given (#{arguments.size})")
+ end
+ unless arguments[0].is_a?(String)
+ raise(Puppet::ParseError, 'dirname(): Requires string as argument')
+ end
+
+ return File.dirname(arguments[0])
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dos2unix.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dos2unix.rb
new file mode 100644
index 0000000..32722ba
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/dos2unix.rb
@@ -0,0 +1,15 @@
+# Custom Puppet function to convert dos to unix format
+module Puppet::Parser::Functions
+ newfunction(:dos2unix, :type => :rvalue, :arity => 1, :doc => <<-DOC
+ Returns the Unix version of the given string.
+ Takes a single string argument.
+ DOC
+ ) do |arguments|
+
+ unless arguments[0].is_a?(String)
+ raise(Puppet::ParseError, 'dos2unix(): Requires string as argument')
+ end
+
+ arguments[0].gsub(%r{\r\n}, "\n")
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/downcase.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/downcase.rb
new file mode 100644
index 0000000..1661e56
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/downcase.rb
@@ -0,0 +1,30 @@
+#
+# downcase.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:downcase, :type => :rvalue, :doc => <<-DOC
+ Converts the case of a string or all strings in an array to lower case.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "downcase(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'downcase(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? i.downcase : i }
+ else
+ value.downcase
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/empty.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/empty.rb
new file mode 100644
index 0000000..79c43d0
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/empty.rb
@@ -0,0 +1,23 @@
+#
+# empty.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:empty, :type => :rvalue, :doc => <<-DOC
+ Returns true if the variable is empty.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "empty(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) || value.is_a?(Numeric)
+ raise(Puppet::ParseError, 'empty(): Requires either array, hash, string or integer to work with')
+ end
+
+ return false if value.is_a?(Numeric)
+ result = value.empty?
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/enclose_ipv6.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/enclose_ipv6.rb
new file mode 100644
index 0000000..f412b01
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/enclose_ipv6.rb
@@ -0,0 +1,41 @@
+#
+# enclose_ipv6.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:enclose_ipv6, :type => :rvalue, :doc => <<-DOC
+ Takes an array of ip addresses and encloses the ipv6 addresses with square brackets.
+ DOC
+ ) do |arguments|
+
+ require 'ipaddr'
+
+ rescuable_exceptions = [ArgumentError]
+ if defined?(IPAddr::InvalidAddressError)
+ rescuable_exceptions << IPAddr::InvalidAddressError
+ end
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "enclose_ipv6(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+ unless arguments[0].is_a?(String) || arguments[0].is_a?(Array)
+ raise(Puppet::ParseError, "enclose_ipv6(): Wrong argument type given #{arguments[0].class} expected String or Array")
+ end
+
+ input = [arguments[0]].flatten.compact
+ result = []
+
+ input.each do |val|
+ unless val == '*'
+ begin
+ ip = IPAddr.new(val)
+ rescue *rescuable_exceptions
+ raise(Puppet::ParseError, "enclose_ipv6(): Wrong argument given #{val} is not an ip address.")
+ end
+ val = "[#{ip}]" if ip.ipv6?
+ end
+ result << val
+ end
+
+ return result.uniq
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb
new file mode 100644
index 0000000..e1c4f65
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb
@@ -0,0 +1,50 @@
+#
+# ensure_packages.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:ensure_packages, :type => :statement, :doc => <<-DOC
+ Takes a list of packages and only installs them if they don't already exist.
+ It optionally takes a hash as a second parameter that will be passed as the
+ third argument to the ensure_resource() function.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "ensure_packages(): Wrong number of arguments given (#{arguments.size} for 1 or 2)") if arguments.size > 2 || arguments.empty?
+ raise(Puppet::ParseError, 'ensure_packages(): Requires second argument to be a Hash') if arguments.size == 2 && !arguments[1].is_a?(Hash)
+
+ if arguments[0].is_a?(Hash)
+ if arguments[1]
+ defaults = { 'ensure' => 'present' }.merge(arguments[1])
+ if defaults['ensure'] == 'installed'
+ defaults['ensure'] = 'present'
+ end
+ else
+ defaults = { 'ensure' => 'present' }
+ end
+
+ Puppet::Parser::Functions.function(:ensure_resources)
+ function_ensure_resources(['package', arguments[0].dup, defaults])
+ else
+ packages = Array(arguments[0])
+
+ if arguments[1]
+ defaults = { 'ensure' => 'present' }.merge(arguments[1])
+ if defaults['ensure'] == 'installed'
+ defaults['ensure'] = 'present'
+ end
+ else
+ defaults = { 'ensure' => 'present' }
+ end
+
+ Puppet::Parser::Functions.function(:ensure_resource)
+ packages.each do |package_name|
+ raise(Puppet::ParseError, 'ensure_packages(): Empty String provided for package name') if package_name.empty?
+ unless findresource("Package[#{package_name}]")
+ function_ensure_resource(['package', package_name, defaults])
+ end
+ end
+ end
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb
new file mode 100644
index 0000000..d28ed9d
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb
@@ -0,0 +1,46 @@
+# Test whether a given class or definition is defined
+require 'puppet/parser/functions'
+
+Puppet::Parser::Functions.newfunction(:ensure_resource,
+ :type => :statement,
+ :doc => <<-'DOC'
+ Takes a resource type, title, and a list of attributes that describe a
+ resource.
+
+ user { 'dan':
+ ensure => present,
+ }
+
+ This example only creates the resource if it does not already exist:
+
+ ensure_resource('user', 'dan', {'ensure' => 'present' })
+
+ If the resource already exists but does not match the specified parameters,
+ this function will attempt to recreate the resource leading to a duplicate
+ resource definition error.
+
+ An array of resources can also be passed in and each will be created with
+ the type and parameters specified if it doesn't already exist.
+
+ ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
+
+DOC
+ ) do |vals|
+ type, title, params = vals
+ raise(ArgumentError, 'Must specify a type') unless type
+ raise(ArgumentError, 'Must specify a title') unless title
+ params ||= {}
+
+ items = [title].flatten
+
+ items.each do |item|
+ Puppet::Parser::Functions.function(:defined_with_params)
+ if function_defined_with_params(["#{type}[#{item}]", params])
+ Puppet.debug("Resource #{type}[#{item}] with params #{params} not created because it already exists")
+ else
+ Puppet.debug("Create new resource #{type}[#{item}] with params #{params}")
+ Puppet::Parser::Functions.function(:create_resources)
+ function_create_resources([type.capitalize, { item => params }])
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resources.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resources.rb
new file mode 100644
index 0000000..642247c
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/ensure_resources.rb
@@ -0,0 +1,50 @@
+require 'puppet/parser/functions'
+
+Puppet::Parser::Functions.newfunction(:ensure_resources,
+ :type => :statement,
+ :doc => <<-'DOC'
+ Takes a resource type, title (only hash), and a list of attributes that describe a
+ resource.
+
+ user { 'dan':
+ gid => 'mygroup',
+ ensure => present,
+ }
+
+ An hash of resources should be passed in and each will be created with
+ the type and parameters specified if it doesn't already exist.
+
+ ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' } , 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
+
+ From Hiera Backend:
+
+ userlist:
+ dan:
+ gid: 'mygroup'
+ uid: '600'
+ alex:
+ gid: 'mygroup'
+
+ Call:
+ ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
+DOC
+ ) do |vals|
+ type, title, params = vals
+ raise(ArgumentError, 'Must specify a type') unless type
+ raise(ArgumentError, 'Must specify a title') unless title
+ params ||= {}
+
+ raise(Puppet::ParseError, 'ensure_resources(): Requires second argument to be a Hash') unless title.is_a?(Hash)
+ resource_hash = title.dup
+ resources = resource_hash.keys
+
+ Puppet::Parser::Functions.function(:ensure_resource)
+ resources.each do |resource_name|
+ params_merged = if resource_hash[resource_name]
+ params.merge(resource_hash[resource_name])
+ else
+ params
+ end
+ function_ensure_resource([type, resource_name, params_merged])
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/flatten.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/flatten.rb
new file mode 100644
index 0000000..15970df
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/flatten.rb
@@ -0,0 +1,31 @@
+#
+# flatten.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:flatten, :type => :rvalue, :doc => <<-DOC
+ This function flattens any deeply nested arrays and returns a single flat array
+ as a result.
+
+ *Examples:*
+
+ flatten(['a', ['b', ['c']]])
+
+ Would return: ['a','b','c']
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "flatten(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ array = arguments[0]
+
+ unless array.is_a?(Array)
+ raise(Puppet::ParseError, 'flatten(): Requires array to work with')
+ end
+
+ result = array.flatten
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/floor.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/floor.rb
new file mode 100644
index 0000000..9fcb048
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/floor.rb
@@ -0,0 +1,25 @@
+#
+# floor.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:floor, :type => :rvalue, :doc => <<-DOC
+ Returns the largest integer less or equal to the argument.
+ Takes a single numeric value as an argument.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "floor(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ begin
+ arg = Float(arguments[0])
+ rescue TypeError, ArgumentError => _e
+ raise(Puppet::ParseError, "floor(): Wrong argument type given (#{arguments[0]} for Numeric)")
+ end
+
+ raise(Puppet::ParseError, "floor(): Wrong argument type given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false
+
+ arg.floor
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb
new file mode 100644
index 0000000..ee45236
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rand_string.rb
@@ -0,0 +1,35 @@
+Puppet::Parser::Functions.newfunction(
+ :fqdn_rand_string,
+ :arity => -2,
+ :type => :rvalue,
+ :doc => "Usage: `fqdn_rand_string(LENGTH, [CHARSET], [SEED])`. LENGTH is
+ required and must be a positive integer. CHARSET is optional and may be
+ `undef` or a string. SEED is optional and may be any number or string.
+
+ Generates a random string LENGTH characters long using the character set
+ provided by CHARSET, combining the `$fqdn` fact and the value of SEED for
+ repeatable randomness. (That is, each node will get a different random
+ string from this function, but a given node's result will be the same every
+ time unless its hostname changes.) Adding a SEED can be useful if you need
+ more than one unrelated string. CHARSET will default to alphanumeric if
+ `undef` or an empty string.",
+) do |args|
+ raise(ArgumentError, 'fqdn_rand_string(): wrong number of arguments (0 for 1)') if args.empty?
+ Puppet::Parser::Functions.function('is_integer')
+ raise(ArgumentError, 'fqdn_rand_string(): first argument must be a positive integer') unless function_is_integer([args[0]]) && args[0].to_i > 0
+ raise(ArgumentError, 'fqdn_rand_string(): second argument must be undef or a string') unless args[1].nil? || args[1].is_a?(String)
+
+ Puppet::Parser::Functions.function('fqdn_rand')
+
+ length = args.shift.to_i
+ charset = args.shift.to_s.chars.to_a
+
+ charset = (0..9).map { |i| i.to_s } + ('A'..'Z').to_a + ('a'..'z').to_a if charset.empty?
+
+ rand_string = ''
+ for current in 1..length # rubocop:disable Style/For : An each loop would not work correctly in this circumstance
+ rand_string << charset[function_fqdn_rand([charset.size, (args + [current.to_s]).join(':')]).to_i]
+ end
+
+ rand_string
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb
new file mode 100644
index 0000000..879e44b
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb
@@ -0,0 +1,59 @@
+#
+# fqdn_rotate.rb
+#
+Puppet::Parser::Functions.newfunction(
+ :fqdn_rotate,
+ :type => :rvalue,
+ :doc => "Usage: `fqdn_rotate(VALUE, [SEED])`. VALUE is required and
+ must be an array or a string. SEED is optional and may be any number
+ or string.
+
+ Rotates VALUE a random number of times, combining the `$fqdn` fact and
+ the value of SEED for repeatable randomness. (That is, each node will
+ get a different random rotation from this function, but a given node's
+ result will be the same every time unless its hostname changes.) Adding
+ a SEED can be useful if you need more than one unrelated rotation.",
+) do |args|
+
+ raise(Puppet::ParseError, "fqdn_rotate(): Wrong number of arguments given (#{args.size} for 1)") if args.empty?
+
+ value = args.shift
+ require 'digest/md5'
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'fqdn_rotate(): Requires either array or string to work with')
+ end
+
+ result = value.clone
+
+ string = value.is_a?(String) ? true : false
+
+ # Check whether it makes sense to rotate ...
+ return result if result.size <= 1
+
+ # We turn any string value into an array to be able to rotate ...
+ result = string ? result.split('') : result
+
+ elements = result.size
+
+ seed = Digest::MD5.hexdigest([lookupvar('::fqdn'), args].join(':')).hex
+ # deterministic_rand() was added in Puppet 3.2.0; reimplement if necessary
+ if Puppet::Util.respond_to?(:deterministic_rand)
+ offset = Puppet::Util.deterministic_rand(seed, elements).to_i
+ else
+ return offset = Random.new(seed).rand(elements) if defined?(Random) == 'constant' && Random.class == Class
+
+ old_seed = srand(seed)
+ offset = rand(elements)
+ srand(old_seed)
+ end
+ offset.times do
+ result.push result.shift
+ end
+
+ result = string ? result.join : result
+
+ return result
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_uuid.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_uuid.rb
new file mode 100644
index 0000000..5080e8e
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/fqdn_uuid.rb
@@ -0,0 +1,86 @@
+require 'digest/sha1'
+#
+# fqdn_uuid.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:fqdn_uuid, :type => :rvalue, :doc => <<-DOC) do |args|
+ Creates a UUID based on a given string, assumed to be the FQDN
+
+ For example, to generate a UUID based on the FQDN of a system:
+
+ Usage:
+
+ $uuid = fqdn_uuid($::fqdn)
+
+ The generated UUID will be the same for the given hostname
+
+ The resulting UUID is returned on the form:
+
+ 1d839dea-5e10-5243-88eb-e66815bd7d5c
+
+ (u.e. without any curly braces.)
+
+ The generated UUID is a version 5 UUID with the V5 DNS namespace:
+
+ 6ba7b810-9dad-11d1-80b4-00c04fd430c8
+
+ This only supports a the V5 SHA-1 hash, using the DNS namespace.
+
+ Please consult http://www.ietf.org/rfc/rfc4122.txt for the details on
+ UUID generation and example implementation.
+
+ No verification is present at the moment as whether the domain name given
+ is in fact a correct fully-qualified domain name. Therefore any arbitrary
+ string and/or alpha-numeric value can subside for a domain name.
+ DOC
+
+ raise(ArgumentError, 'fqdn_uuid: No arguments given') if args.empty?
+ raise(ArgumentError, "fqdn_uuid: Too many arguments given (#{args.length})") unless args.length == 1
+ fqdn = args[0]
+
+ # Code lovingly taken from
+ # https://github.com/puppetlabs/marionette-collective/blob/master/lib/mcollective/ssl.rb
+
+ # This is the UUID version 5 type DNS name space which is as follows:
+ #
+ # 6ba7b810-9dad-11d1-80b4-00c04fd430c8
+ #
+ uuid_name_space_dns = [0x6b,
+ 0xa7,
+ 0xb8,
+ 0x10,
+ 0x9d,
+ 0xad,
+ 0x11,
+ 0xd1,
+ 0x80,
+ 0xb4,
+ 0x00,
+ 0xc0,
+ 0x4f,
+ 0xd4,
+ 0x30,
+ 0xc8].map { |b| b.chr }.join
+
+ sha1 = Digest::SHA1.new
+ sha1.update(uuid_name_space_dns)
+ sha1.update(fqdn)
+
+ # first 16 bytes..
+ bytes = sha1.digest[0, 16].bytes.to_a
+
+ # version 5 adjustments
+ bytes[6] &= 0x0f
+ bytes[6] |= 0x50
+
+ # variant is DCE 1.1
+ bytes[8] &= 0x3f
+ bytes[8] |= 0x80
+
+ bytes = [4, 2, 2, 2, 6].map do |i|
+ bytes.slice!(0, i).pack('C*').unpack('H*')
+ end
+
+ bytes.join('-')
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb
new file mode 100644
index 0000000..3a95b71
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb
@@ -0,0 +1,18 @@
+#
+# get_module_path.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:get_module_path, :type => :rvalue, :doc => <<-DOC
+ Returns the absolute path of the specified module for the current
+ environment.
+
+ Example:
+ $module_path = get_module_path('stdlib')
+ DOC
+ ) do |args|
+ raise(Puppet::ParseError, 'get_module_path(): Wrong number of arguments, expects one') unless args.size == 1
+ module_path = Puppet::Module.find(args[0], compiler.environment.to_s)
+ raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}") unless module_path
+ module_path.path
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/getparam.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/getparam.rb
new file mode 100644
index 0000000..d73650b
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/getparam.rb
@@ -0,0 +1,36 @@
+# Test whether a given class or definition is defined
+require 'puppet/parser/functions'
+
+Puppet::Parser::Functions.newfunction(:getparam,
+ :type => :rvalue,
+ :doc => <<-'DOC'
+ Takes a resource reference and name of the parameter and
+ returns value of resource's parameter.
+
+ *Examples:*
+
+ define example_resource($param) {
+ }
+
+ example_resource { "example_resource_instance":
+ param => "param_value"
+ }
+
+ getparam(Example_resource["example_resource_instance"], "param")
+
+ Would return: param_value
+ DOC
+ ) do |vals|
+ reference, param = vals
+ raise(ArgumentError, 'Must specify a reference') unless reference
+ raise(ArgumentError, 'Must specify name of a parameter') unless param && param.instance_of?(String)
+
+ return '' if param.empty?
+
+ resource = findresource(reference.to_s)
+ if resource
+ return resource[param] unless resource[param].nil?
+ end
+
+ return ''
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/getvar.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/getvar.rb
new file mode 100644
index 0000000..f464467
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/getvar.rb
@@ -0,0 +1,35 @@
+#
+# getvar.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:getvar, :type => :rvalue, :doc => <<-'DOC') do |args|
+ Lookup a variable in a remote namespace.
+
+ For example:
+
+ $foo = getvar('site::data::foo')
+ # Equivalent to $foo = $site::data::foo
+
+ This is useful if the namespace itself is stored in a string:
+
+ $datalocation = 'site::data'
+ $bar = getvar("${datalocation}::bar")
+ # Equivalent to $bar = $site::data::bar
+ DOC
+
+ unless args.length == 1
+ raise Puppet::ParseError, "getvar(): wrong number of arguments (#{args.length}; must be 1)"
+ end
+
+ begin
+ result = nil
+ catch(:undefined_variable) do
+ result = lookupvar((args[0]).to_s)
+ end
+
+ # avoid relying on incosistent behaviour around ruby return values from catch
+ result
+ rescue Puppet::ParseError # rubocop:disable Lint/HandleExceptions : Eat the exception if strict_variables = true is set
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/glob.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/glob.rb
new file mode 100644
index 0000000..e9d35b2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/glob.rb
@@ -0,0 +1,25 @@
+#
+# glob.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:glob, :type => :rvalue, :doc => <<-'DOC'
+ Returns an Array of file entries of a directory or an Array of directories.
+ Uses same patterns as Dir#glob
+ DOC
+ ) do |arguments|
+
+ unless arguments.size == 1
+ raise(Puppet::ParseError, 'glob(): Wrong number of arguments given ' \
+ "(#{arguments.size} for 1)")
+ end
+
+ pattern = arguments[0]
+
+ unless pattern.is_a?(String) || pattern.is_a?(Array)
+ raise(Puppet::ParseError, 'glob(): Requires either array or string ' \
+ 'to work')
+ end
+
+ Dir.glob(pattern)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/grep.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/grep.rb
new file mode 100644
index 0000000..030c14a
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/grep.rb
@@ -0,0 +1,30 @@
+#
+# grep.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:grep, :type => :rvalue, :doc => <<-DOC
+ This function searches through an array and returns any elements that match
+ the provided regular expression.
+
+ *Examples:*
+
+ grep(['aaa','bbb','ccc','aaaddd'], 'aaa')
+
+ Would return:
+
+ ['aaa','aaaddd']
+ DOC
+ ) do |arguments|
+
+ if arguments.size != 2
+ raise(Puppet::ParseError, "grep(): Wrong number of arguments given #{arguments.size} for 2")
+ end
+
+ a = arguments[0]
+ pattern = Regexp.new(arguments[1])
+
+ a.grep(pattern)
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb
new file mode 100644
index 0000000..44005d0
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb
@@ -0,0 +1,69 @@
+#
+# has_interface_with
+#
+module Puppet::Parser::Functions
+ newfunction(:has_interface_with, :type => :rvalue, :doc => <<-DOC
+ Returns boolean based on kind and value:
+ * macaddress
+ * netmask
+ * ipaddress
+ * network
+
+ has_interface_with("macaddress", "x:x:x:x:x:x")
+ has_interface_with("ipaddress", "127.0.0.1") => true
+ etc.
+
+ If no "kind" is given, then the presence of the interface is checked:
+ has_interface_with("lo") => true
+ DOC
+ ) do |args|
+
+ raise(Puppet::ParseError, "has_interface_with(): Wrong number of arguments given (#{args.size} for 1 or 2)") if args.empty? || args.size > 2
+
+ interfaces = lookupvar('interfaces')
+
+ # If we do not have any interfaces, then there are no requested attributes
+ return false if interfaces == :undefined || interfaces.nil?
+
+ interfaces = interfaces.split(',')
+
+ if args.size == 1
+ return interfaces.member?(args[0])
+ end
+
+ kind, value = args
+
+ # Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
+ # https://tickets.puppetlabs.com/browse/PUP-3597
+ factval = nil
+ begin
+ catch :undefined_variable do
+ factval = lookupvar(kind)
+ end
+ rescue Puppet::ParseError # rubocop:disable Lint/HandleExceptions : Eat the exception if strict_variables = true is set
+ end
+ if factval == value
+ return true
+ end
+
+ result = false
+ interfaces.each do |iface|
+ iface.downcase!
+ factval = nil
+ begin
+ # Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
+ # https://tickets.puppetlabs.com/browse/PUP-3597
+ catch :undefined_variable do
+ factval = lookupvar("#{kind}_#{iface}")
+ end
+ rescue Puppet::ParseError # rubocop:disable Lint/HandleExceptions : Eat the exception if strict_variables = true is set
+ end
+ if value == factval
+ result = true
+ break
+ end
+ end
+
+ result
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb
new file mode 100644
index 0000000..5f14ee2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb
@@ -0,0 +1,22 @@
+#
+# has_ip_address
+#
+module Puppet::Parser::Functions
+ newfunction(:has_ip_address, :type => :rvalue, :doc => <<-DOC
+ Returns true if the client has the requested IP address on some interface.
+
+ This function iterates through the 'interfaces' fact and checks the
+ 'ipaddress_IFACE' facts, performing a simple string comparison.
+ DOC
+ ) do |args|
+
+ raise(Puppet::ParseError, "has_ip_address(): Wrong number of arguments given (#{args.size} for 1)") if args.size != 1
+
+ Puppet::Parser::Functions.autoloader.load(:has_interface_with) \
+ unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with)
+
+ function_has_interface_with(['ipaddress', args[0]])
+ end
+end
+
+# vim:sts=2 sw=2
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb
new file mode 100644
index 0000000..65f2789
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb
@@ -0,0 +1,22 @@
+#
+# has_ip_network
+#
+module Puppet::Parser::Functions
+ newfunction(:has_ip_network, :type => :rvalue, :doc => <<-DOC
+ Returns true if the client has an IP address within the requested network.
+
+ This function iterates through the 'interfaces' fact and checks the
+ 'network_IFACE' facts, performing a simple string comparision.
+ DOC
+ ) do |args|
+
+ raise(Puppet::ParseError, "has_ip_network(): Wrong number of arguments given (#{args.size} for 1)") if args.size != 1
+
+ Puppet::Parser::Functions.autoloader.load(:has_interface_with) \
+ unless Puppet::Parser::Functions.autoloader.loaded?(:has_interface_with)
+
+ function_has_interface_with(['network', args[0]])
+ end
+end
+
+# vim:sts=2 sw=2
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_key.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_key.rb
new file mode 100644
index 0000000..53b8c74
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/has_key.rb
@@ -0,0 +1,28 @@
+#
+# has_key.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:has_key, :type => :rvalue, :doc => <<-'DOC') do |args|
+ Determine if a hash has a certain key value.
+
+ Example:
+
+ $my_hash = {'key_one' => 'value_one'}
+ if has_key($my_hash, 'key_two') {
+ notice('we will not reach here')
+ }
+ if has_key($my_hash, 'key_one') {
+ notice('this will be printed')
+ }
+
+ DOC
+
+ unless args.length == 2
+ raise Puppet::ParseError, "has_key(): wrong number of arguments (#{args.length}; must be 2)"
+ end
+ unless args[0].is_a?(Hash)
+ raise Puppet::ParseError, "has_key(): expects the first argument to be a hash, got #{args[0].inspect} which is of type #{args[0].class}"
+ end
+ args[0].key?(args[1])
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/hash.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/hash.rb
new file mode 100644
index 0000000..f6644db
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/hash.rb
@@ -0,0 +1,38 @@
+#
+# hash.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:hash, :type => :rvalue, :doc => <<-DOC
+ This function converts an array into a hash.
+
+ *Examples:*
+
+ hash(['a',1,'b',2,'c',3])
+
+ Would return: {'a'=>1,'b'=>2,'c'=>3}
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "hash(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ array = arguments[0]
+
+ unless array.is_a?(Array)
+ raise(Puppet::ParseError, 'hash(): Requires array to work with')
+ end
+
+ result = {}
+
+ begin
+ # This is to make it compatible with older version of Ruby ...
+ array = array.flatten
+ result = Hash[*array]
+ rescue StandardError
+ raise(Puppet::ParseError, 'hash(): Unable to compute hash from array given')
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/intersection.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/intersection.rb
new file mode 100644
index 0000000..0c16722
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/intersection.rb
@@ -0,0 +1,31 @@
+#
+# intersection.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:intersection, :type => :rvalue, :doc => <<-DOC
+ This function returns an array of the intersection of two.
+
+ *Examples:*
+
+ intersection(["a","b","c"],["b","c","d"]) # returns ["b","c"]
+ intersection(["a","b","c"],[1,2,3,4]) # returns [] (true, when evaluated as a Boolean)
+ DOC
+ ) do |arguments|
+
+ # Two arguments are required
+ raise(Puppet::ParseError, "intersection(): Wrong number of arguments given (#{arguments.size} for 2)") if arguments.size != 2
+
+ first = arguments[0]
+ second = arguments[1]
+
+ unless first.is_a?(Array) && second.is_a?(Array)
+ raise(Puppet::ParseError, 'intersection(): Requires 2 arrays')
+ end
+
+ result = first & second
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_absolute_path.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_absolute_path.rb
new file mode 100644
index 0000000..06e9465
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_absolute_path.rb
@@ -0,0 +1,54 @@
+#
+# is_absolute_path.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_absolute_path, :type => :rvalue, :arity => 1, :doc => <<-'DOC') do |args|
+ Returns boolean true if the string represents an absolute path in the filesystem. This function works
+ for windows and unix style paths.
+
+ The following values will return true:
+
+ $my_path = 'C:/Program Files (x86)/Puppet Labs/Puppet'
+ is_absolute_path($my_path)
+ $my_path2 = '/var/lib/puppet'
+ is_absolute_path($my_path2)
+ $my_path3 = ['C:/Program Files (x86)/Puppet Labs/Puppet']
+ is_absolute_path($my_path3)
+ $my_path4 = ['/var/lib/puppet']
+ is_absolute_path($my_path4)
+
+ The following values will return false:
+
+ is_absolute_path(true)
+ is_absolute_path('../var/lib/puppet')
+ is_absolute_path('var/lib/puppet')
+ $undefined = undef
+ is_absolute_path($undefined)
+
+ DOC
+ function_deprecation([:is_absolute_path, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Absolute_path. There is further documentation for validate_legacy function in the README.'])
+ require 'puppet/util'
+
+ path = args[0]
+ # This logic was borrowed from
+ # [lib/puppet/file_serving/base.rb](https://github.com/puppetlabs/puppet/blob/master/lib/puppet/file_serving/base.rb)
+ # Puppet 2.7 and beyond will have Puppet::Util.absolute_path? Fall back to a back-ported implementation otherwise.
+ if Puppet::Util.respond_to?(:absolute_path?)
+ value = (Puppet::Util.absolute_path?(path, :posix) || Puppet::Util.absolute_path?(path, :windows))
+ else
+ # This code back-ported from 2.7.x's lib/puppet/util.rb Puppet::Util.absolute_path?
+ # Determine in a platform-specific way whether a path is absolute. This
+ # defaults to the local platform if none is specified.
+ # Escape once for the string literal, and once for the regex.
+ slash = '[\\\\/]'
+ name = '[^\\\\/]+'
+ regexes = {
+ :windows => %r{^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))}i,
+ :posix => %r{^/},
+ }
+ value = !!(path =~ regexes[:posix]) || !!(path =~ regexes[:windows]) # rubocop:disable Style/DoubleNegation : No alternative known
+ end
+ value
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_array.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_array.rb
new file mode 100644
index 0000000..620f4f7
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_array.rb
@@ -0,0 +1,21 @@
+#
+# is_array.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_array, :type => :rvalue, :doc => <<-DOC
+ Returns true if the variable passed to this function is an array.
+ DOC
+ ) do |arguments|
+
+ function_deprecation([:is_array, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Array. There is further documentation for validate_legacy function in the README.'])
+
+ raise(Puppet::ParseError, "is_array(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ type = arguments[0]
+
+ result = type.is_a?(Array)
+
+ return result
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_bool.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_bool.rb
new file mode 100644
index 0000000..d0e0026
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_bool.rb
@@ -0,0 +1,21 @@
+#
+# is_bool.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_bool, :type => :rvalue, :doc => <<-DOC
+ Returns true if the variable passed to this function is a boolean.
+ DOC
+ ) do |arguments|
+
+ function_deprecation([:is_bool, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README.'])
+
+ raise(Puppet::ParseError, "is_bool(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ type = arguments[0]
+
+ result = type.is_a?(TrueClass) || type.is_a?(FalseClass)
+
+ return result
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb
new file mode 100644
index 0000000..d80689a
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb
@@ -0,0 +1,51 @@
+#
+# is_domain_name.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_domain_name, :type => :rvalue, :doc => <<-DOC
+ Returns true if the string passed to this function is a syntactically correct domain name.
+ DOC
+ ) do |arguments|
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_domain_name(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ # Only allow string types
+ return false unless arguments[0].is_a?(String)
+
+ domain = arguments[0].dup
+
+ # Limits (rfc1035, 3.1)
+ domain_max_length = 255
+ label_min_length = 1
+ label_max_length = 63
+
+ # Allow ".", it is the top level domain
+ return true if domain == '.'
+
+ # Remove the final dot, if present.
+ domain.chomp!('.')
+
+ # Check the whole domain
+ return false if domain.empty?
+ return false if domain.length > domain_max_length
+
+ # The top level domain must be alphabetic if there are multiple labels.
+ # See rfc1123, 2.1
+ return false if domain.include?('.') && !%r{\.[A-Za-z]+$}.match(domain)
+
+ # Check each label in the domain
+ labels = domain.split('.')
+ vlabels = labels.each do |label|
+ break if label.length < label_min_length
+ break if label.length > label_max_length
+ break if label[-1..-1] == '-'
+ break if label[0..0] == '-'
+ break unless %r{^[a-z\d-]+$}i =~ label
+ end
+ return vlabels == labels
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_email_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_email_address.rb
new file mode 100644
index 0000000..f656468
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_email_address.rb
@@ -0,0 +1,19 @@
+#
+# is_email_address.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_email_address, :type => :rvalue, :doc => <<-DOC
+ Returns true if the string passed to this function is a valid email address.
+ DOC
+ ) do |arguments|
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_email_address(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ # Taken from http://emailregex.com/ (simpler regex)
+ valid_email_regex = %r{\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z}
+ return (arguments[0] =~ valid_email_regex) == 0 # rubocop:disable Style/NumericPredicate : Changing to '.zero?' breaks the code
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_float.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_float.rb
new file mode 100644
index 0000000..89994d2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_float.rb
@@ -0,0 +1,27 @@
+#
+# is_float.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_float, :type => :rvalue, :doc => <<-DOC
+ Returns true if the variable passed to this function is a float.
+ DOC
+ ) do |arguments|
+
+ function_deprecation([:is_float, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Float. There is further documentation for validate_legacy function in the README.'])
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_float(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ value = arguments[0]
+
+ # Only allow Numeric or String types
+ return false unless value.is_a?(Numeric) || value.is_a?(String)
+
+ return false if value != value.to_f.to_s && !value.is_a?(Float)
+ return true
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb
new file mode 100644
index 0000000..e02aa53
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb
@@ -0,0 +1,24 @@
+#
+# is_function_available.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_function_available, :type => :rvalue, :doc => <<-DOC
+ This function accepts a string as an argument, determines whether the
+ Puppet runtime has access to a function by that name. It returns a
+ true if the function exists, false if not.
+ DOC
+ ) do |arguments|
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_function_available?(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ # Only allow String types
+ return false unless arguments[0].is_a?(String)
+
+ function = Puppet::Parser::Functions.function(arguments[0].to_sym)
+ function.is_a?(String) && !function.empty?
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_hash.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_hash.rb
new file mode 100644
index 0000000..dc03653
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_hash.rb
@@ -0,0 +1,20 @@
+#
+# is_hash.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_hash, :type => :rvalue, :doc => <<-DOC
+ Returns true if the variable passed to this function is a hash.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "is_hash(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ type = arguments[0]
+
+ result = type.is_a?(Hash)
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_integer.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_integer.rb
new file mode 100644
index 0000000..7444cac
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_integer.rb
@@ -0,0 +1,43 @@
+#
+# is_integer.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_integer, :type => :rvalue, :doc => <<-DOC
+ Returns true if the variable passed to this function is an Integer or
+ a decimal (base 10) integer in String form. The string may
+ start with a '-' (minus). A value of '0' is allowed, but a leading '0' digit may not
+ be followed by other digits as this indicates that the value is octal (base 8).
+
+ If given any other argument `false` is returned.
+ DOC
+ ) do |arguments|
+
+ function_deprecation([:is_integer, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Integer. There is further documentation for validate_legacy function in the README.'])
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_integer(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ value = arguments[0]
+
+ # Regex is taken from the lexer of puppet
+ # puppet/pops/parser/lexer.rb but modified to match also
+ # negative values and disallow numbers prefixed with multiple
+ # 0's
+ #
+ # TODO these parameter should be a constant but I'm not sure
+ # if there is no risk to declare it inside of the module
+ # Puppet::Parser::Functions
+
+ # Integer numbers like
+ # -1234568981273
+ # 47291
+ numeric = %r{^-?(?:(?:[1-9]\d*)|0)$}
+
+ return true if value.is_a?(Integer) || (value.is_a?(String) && value.match(numeric))
+ return false
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb
new file mode 100644
index 0000000..6ce993a
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb
@@ -0,0 +1,30 @@
+#
+# is_ip_address.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_ip_address, :type => :rvalue, :doc => <<-DOC
+ Returns true if the string passed to this function is a valid IP address.
+ DOC
+ ) do |arguments|
+
+ require 'ipaddr'
+
+ function_deprecation([:is_ip_address, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Ip_address. There is further documentation for validate_legacy function in the README.'])
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_ip_address(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ begin
+ ip = IPAddr.new(arguments[0])
+ rescue ArgumentError
+ return false
+ end
+
+ return true if ip.ipv4? || ip.ipv6?
+ return false
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv4_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv4_address.rb
new file mode 100644
index 0000000..7f2241b
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv4_address.rb
@@ -0,0 +1,29 @@
+#
+# is_ipv4_address.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_ipv4_address, :type => :rvalue, :doc => <<-DOC
+ Returns true if the string passed to this function is a valid IPv4 address.
+ DOC
+ ) do |arguments|
+
+ require 'ipaddr'
+
+ function_deprecation([:is_ipv4_address, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Ipv4. There is further documentation for validate_legacy function in the README.'])
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_ipv4_address(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ begin
+ ip = IPAddr.new(arguments[0])
+ rescue ArgumentError
+ return false
+ end
+
+ return ip.ipv4?
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv6_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv6_address.rb
new file mode 100644
index 0000000..35be026
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_ipv6_address.rb
@@ -0,0 +1,29 @@
+#
+# is_ipv6_address.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_ipv6_address, :type => :rvalue, :doc => <<-DOC
+ Returns true if the string passed to this function is a valid IPv6 address.
+ DOC
+ ) do |arguments|
+
+ function_deprecation([:is_ipv6_address, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Ipv6. There is further documentation for validate_legacy function in the README.'])
+
+ require 'ipaddr'
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_ipv6_address(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ begin
+ ip = IPAddr.new(arguments[0])
+ rescue ArgumentError
+ return false
+ end
+
+ return ip.ipv6?
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb
new file mode 100644
index 0000000..83a5ba2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb
@@ -0,0 +1,21 @@
+#
+# is_mac_address.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_mac_address, :type => :rvalue, :doc => <<-DOC
+ Returns true if the string passed to this function is a valid mac address.
+ DOC
+ ) do |arguments|
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_mac_address(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ mac = arguments[0]
+
+ return true if %r{^[a-f0-9]{1,2}(:[a-f0-9]{1,2}){5}$}i =~ mac
+ return false
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb
new file mode 100644
index 0000000..e127705
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb
@@ -0,0 +1,74 @@
+#
+# is_numeric.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_numeric, :type => :rvalue, :doc => <<-DOC
+ Returns true if the given argument is a Numeric (Integer or Float),
+ or a String containing either a valid integer in decimal base 10 form, or
+ a valid floating point string representation.
+
+ The function recognizes only decimal (base 10) integers and float but not
+ integers in hex (base 16) or octal (base 8) form.
+
+ The string representation may start with a '-' (minus). If a decimal '.' is used,
+ it must be followed by at least one digit.
+
+ Valid examples:
+
+ 77435
+ 10e-12
+ -8475
+ 0.2343
+ -23.561e3
+ DOC
+ ) do |arguments|
+
+ function_deprecation([:is_numeric, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Numeric. There is further documentation for validate_legacy function in the README.'])
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "is_numeric(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ value = arguments[0]
+
+ # Regex is taken from the lexer of puppet
+ # puppet/pops/parser/lexer.rb but modified to match also
+ # negative values and disallow invalid octal numbers or
+ # numbers prefixed with multiple 0's (except in hex numbers)
+ #
+ # TODO these parameters should be constants but I'm not sure
+ # if there is no risk to declare them inside of the module
+ # Puppet::Parser::Functions
+
+ # TODO: decide if this should be used
+ # HEX numbers like
+ # 0xaa230F
+ # 0X1234009C
+ # 0x0012
+ # -12FcD
+ # numeric_hex = %r{^-?0[xX][0-9A-Fa-f]+$}
+
+ # TODO: decide if this should be used
+ # OCTAL numbers like
+ # 01234567
+ # -045372
+ # numeric_oct = %r{^-?0[1-7][0-7]*$}
+
+ # Integer/Float numbers like
+ # -0.1234568981273
+ # 47291
+ # 42.12345e-12
+ numeric = %r{^-?(?:(?:[1-9]\d*)|0)(?:\.\d+)?(?:[eE]-?\d+)?$}
+
+ if value.is_a?(Numeric) || (value.is_a?(String) &&
+ value.match(numeric) # or
+ # value.match(numeric_hex) or
+ # value.match(numeric_oct)
+ )
+ return true
+ else
+ return false
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_string.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_string.rb
new file mode 100644
index 0000000..f7b1b14
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/is_string.rb
@@ -0,0 +1,28 @@
+#
+# is_string.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:is_string, :type => :rvalue, :doc => <<-DOC
+ Returns true if the variable passed to this function is a string.
+ DOC
+ ) do |arguments|
+
+ function_deprecation([:is_string, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README.'])
+
+ raise(Puppet::ParseError, "is_string(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ type = arguments[0]
+
+ # when called through the v4 API shim, undef gets translated to nil
+ result = type.is_a?(String) || type.nil?
+
+ if result && (type == type.to_f.to_s || type == type.to_i.to_s)
+ return false
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/join.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/join.rb
new file mode 100644
index 0000000..bcb97b7
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/join.rb
@@ -0,0 +1,39 @@
+#
+# join.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:join, :type => :rvalue, :doc => <<-DOC
+ This function joins an array into a string using a separator.
+
+ *Examples:*
+
+ join(['a','b','c'], ",")
+
+ Would result in: "a,b,c"
+ DOC
+ ) do |arguments|
+
+ # Technically we support two arguments but only first is mandatory ...
+ raise(Puppet::ParseError, "join(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ array = arguments[0]
+
+ unless array.is_a?(Array)
+ raise(Puppet::ParseError, 'join(): Requires array to work with')
+ end
+
+ suffix = arguments[1] if arguments[1]
+
+ if suffix
+ unless suffix.is_a?(String)
+ raise(Puppet::ParseError, 'join(): Requires string to work with')
+ end
+ end
+
+ result = suffix ? array.join(suffix) : array.join
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb
new file mode 100644
index 0000000..3232fa8
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb
@@ -0,0 +1,53 @@
+#
+# join.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:join_keys_to_values, :type => :rvalue, :doc => <<-DOC
+ This function joins each key of a hash to that key's corresponding value with a
+ separator. Keys are cast to strings. If values are arrays, multiple keys
+ are added for each element. The return value is an array in
+ which each element is one joined key/value pair.
+
+ *Examples:*
+
+ join_keys_to_values({'a'=>1,'b'=>2}, " is ")
+
+ Would result in: ["a is 1","b is 2"]
+
+ join_keys_to_values({'a'=>1,'b'=>[2,3]}, " is ")
+
+ Would result in: ["a is 1","b is 2","b is 3"]
+ DOC
+ ) do |arguments|
+
+ # Validate the number of arguments.
+ if arguments.size != 2
+ raise(Puppet::ParseError, "join_keys_to_values(): Takes exactly two arguments, but #{arguments.size} given.")
+ end
+
+ # Validate the first argument.
+ hash = arguments[0]
+ unless hash.is_a?(Hash)
+ raise(TypeError, "join_keys_to_values(): The first argument must be a hash, but a #{hash.class} was given.")
+ end
+
+ # Validate the second argument.
+ separator = arguments[1]
+ unless separator.is_a?(String)
+ raise(TypeError, "join_keys_to_values(): The second argument must be a string, but a #{separator.class} was given.")
+ end
+
+ # Join the keys to their values.
+ hash.map { |k, v|
+ if v.is_a?(Array)
+ v.map { |va| String(k) + separator + String(va) }
+ elsif String(v) == 'undef'
+ String(k)
+ else
+ String(k) + separator + String(v)
+ end
+ }.flatten
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/keys.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/keys.rb
new file mode 100644
index 0000000..0ecd48f
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/keys.rb
@@ -0,0 +1,24 @@
+#
+# keys.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:keys, :type => :rvalue, :doc => <<-DOC
+ Returns the keys of a hash as an array.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "keys(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ hash = arguments[0]
+
+ unless hash.is_a?(Hash)
+ raise(Puppet::ParseError, 'keys(): Requires hash to work with')
+ end
+
+ result = hash.keys
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/load_module_metadata.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/load_module_metadata.rb
new file mode 100644
index 0000000..f9a39de
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/load_module_metadata.rb
@@ -0,0 +1,25 @@
+#
+# load_module_metadata.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:load_module_metadata, :type => :rvalue, :doc => <<-DOC
+ This function loads the metadata of a given module.
+ DOC
+ ) do |args|
+ raise(Puppet::ParseError, 'load_module_metadata(): Wrong number of arguments, expects one or two') unless [1, 2].include?(args.size)
+ mod = args[0]
+ allow_empty_metadata = args[1]
+ module_path = function_get_module_path([mod])
+ metadata_json = File.join(module_path, 'metadata.json')
+
+ metadata_exists = File.exists?(metadata_json) # rubocop:disable Lint/DeprecatedClassMethods : Changing to .exist? breaks the code
+ if metadata_exists
+ metadata = PSON.load(File.read(metadata_json))
+ else
+ metadata = {}
+ raise(Puppet::ParseError, "load_module_metadata(): No metadata.json file for module #{mod}") unless allow_empty_metadata
+ end
+
+ return metadata
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadjson.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadjson.rb
new file mode 100644
index 0000000..9a1d54f
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadjson.rb
@@ -0,0 +1,32 @@
+#
+# loadjson.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:loadjson, :type => :rvalue, :arity => -2, :doc => <<-'DOC') do |args|
+ Load a JSON file containing an array, string, or hash, and return the data
+ in the corresponding native data type.
+ The second parameter is the default value. It will be returned if the file
+ was not found or could not be parsed.
+
+ For example:
+
+ $myhash = loadjson('/etc/puppet/data/myhash.json')
+ $myhash = loadjson('no-file.json', {'default' => 'value'})
+ DOC
+
+ raise ArgumentError, 'Wrong number of arguments. 1 or 2 arguments should be provided.' unless args.length >= 1
+
+ if File.exists?(args[0]) # rubocop:disable Lint/DeprecatedClassMethods : Changing to .exist? breaks the code
+ begin
+ content = File.read(args[0])
+ PSON.load(content) || args[1]
+ rescue StandardError => e
+ raise e unless args[1]
+ args[1]
+ end
+ else
+ warning("Can't load '#{args[0]}' File does not exist!")
+ args[1]
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb
new file mode 100644
index 0000000..a8c9e62
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb
@@ -0,0 +1,32 @@
+#
+# loadyaml.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:loadyaml, :type => :rvalue, :arity => -2, :doc => <<-'DOC') do |args|
+ Load a YAML file containing an array, string, or hash, and return the data
+ in the corresponding native data type.
+ The second parameter is the default value. It will be returned if the file
+ was not found or could not be parsed.
+
+ For example:
+
+ $myhash = loadyaml('/etc/puppet/data/myhash.yaml')
+ $myhash = loadyaml('no-file.yaml', {'default' => 'value'})
+ DOC
+
+ raise ArgumentError, 'Wrong number of arguments. 1 or 2 arguments should be provided.' unless args.length >= 1
+ require 'yaml'
+
+ if File.exists?(args[0]) # rubocop:disable Lint/DeprecatedClassMethods : Changing to .exist? breaks the code
+ begin
+ YAML.load_file(args[0]) || args[1]
+ rescue StandardError => e
+ raise e unless args[1]
+ args[1]
+ end
+ else
+ warning("Can't load '#{args[0]}' File does not exist!")
+ args[1]
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/lstrip.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/lstrip.rb
new file mode 100644
index 0000000..f5b9a58
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/lstrip.rb
@@ -0,0 +1,29 @@
+#
+# lstrip.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:lstrip, :type => :rvalue, :doc => <<-DOC
+ Strips leading spaces to the left of a string.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "lstrip(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'lstrip(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? i.lstrip : i }
+ else
+ value.lstrip
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/max.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/max.rb
new file mode 100644
index 0000000..21c5245
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/max.rb
@@ -0,0 +1,23 @@
+#
+# max.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:max, :type => :rvalue, :doc => <<-DOC
+ Returns the highest value of all arguments.
+ Requires at least one argument.
+ DOC
+ ) do |args|
+
+ raise(Puppet::ParseError, 'max(): Wrong number of arguments need at least one') if args.empty?
+
+ # Sometimes we get numbers as numerics and sometimes as strings.
+ # We try to compare them as numbers when possible
+ return args.max do |a, b|
+ if a.to_s =~ %r{\A-?\d+(.\d+)?\z} && b.to_s =~ %r{\A-?\d+(.\d+)?\z}
+ a.to_f <=> b.to_f
+ else
+ a.to_s <=> b.to_s
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/member.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/member.rb
new file mode 100644
index 0000000..9261080
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/member.rb
@@ -0,0 +1,57 @@
+# TODO(Krzysztof Wilczynski): We need to add support for regular expression ...
+# TODO(Krzysztof Wilczynski): Support for strings and hashes too ...
+#
+# member.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:member, :type => :rvalue, :doc => <<-DOC
+ This function determines if a variable is a member of an array.
+ The variable can be a string, fixnum, or array.
+
+ *Examples:*
+
+ member(['a','b'], 'b')
+
+ Would return: true
+
+ member(['a', 'b', 'c'], ['a', 'b'])
+
+ would return: true
+
+ member(['a','b'], 'c')
+
+ Would return: false
+
+ member(['a', 'b', 'c'], ['d', 'b'])
+
+ would return: false
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "member(): Wrong number of arguments given (#{arguments.size} for 2)") if arguments.size < 2
+
+ array = arguments[0]
+
+ unless array.is_a?(Array)
+ raise(Puppet::ParseError, 'member(): Requires array to work with')
+ end
+
+ unless arguments[1].is_a?(String) || arguments[1].is_a?(Integer) || arguments[1].is_a?(Array)
+ raise(Puppet::ParseError, 'member(): Item to search for must be a string, fixnum, or array')
+ end
+
+ item = if arguments[1].is_a?(String) || arguments[1].is_a?(Integer)
+ [arguments[1]]
+ else
+ arguments[1]
+ end
+
+ raise(Puppet::ParseError, 'member(): You must provide item to search for within array given') if item.respond_to?('empty?') && item.empty?
+
+ result = (item - array).empty?
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/merge.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/merge.rb
new file mode 100644
index 0000000..25ebc79
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/merge.rb
@@ -0,0 +1,37 @@
+#
+# merge.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:merge, :type => :rvalue, :doc => <<-'DOC') do |args|
+ Merges two or more hashes together and returns the resulting hash.
+
+ For example:
+
+ $hash1 = {'one' => 1, 'two', => 2}
+ $hash2 = {'two' => 'dos', 'three', => 'tres'}
+ $merged_hash = merge($hash1, $hash2)
+ # The resulting hash is equivalent to:
+ # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'}
+
+ When there is a duplicate key, the key in the rightmost hash will "win."
+
+ DOC
+
+ if args.length < 2
+ raise Puppet::ParseError, "merge(): wrong number of arguments (#{args.length}; must be at least 2)"
+ end
+
+ # The hash we accumulate into
+ accumulator = {}
+ # Merge into the accumulator hash
+ args.each do |arg|
+ next if arg.is_a?(String) && arg.empty? # empty string is synonym for puppet's undef
+ unless arg.is_a?(Hash)
+ raise Puppet::ParseError, "merge: unexpected argument type #{arg.class}, only expects hash arguments"
+ end
+ accumulator.merge!(arg)
+ end
+ # Return the fully merged hash
+ accumulator
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/min.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/min.rb
new file mode 100644
index 0000000..985ec56
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/min.rb
@@ -0,0 +1,23 @@
+#
+# min.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:min, :type => :rvalue, :doc => <<-DOC
+ Returns the lowest value of all arguments.
+ Requires at least one argument.
+ DOC
+ ) do |args|
+
+ raise(Puppet::ParseError, 'min(): Wrong number of arguments need at least one') if args.empty?
+
+ # Sometimes we get numbers as numerics and sometimes as strings.
+ # We try to compare them as numbers when possible
+ return args.min do |a, b|
+ if a.to_s =~ %r{\A^-?\d+(.\d+)?\z} && b.to_s =~ %r{\A-?\d+(.\d+)?\z}
+ a.to_f <=> b.to_f
+ else
+ a.to_s <=> b.to_s
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/num2bool.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/num2bool.rb
new file mode 100644
index 0000000..0957c56
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/num2bool.rb
@@ -0,0 +1,41 @@
+#
+# num2bool.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:num2bool, :type => :rvalue, :doc => <<-DOC
+ This function converts a number or a string representation of a number into a
+ true boolean. Zero or anything non-numeric becomes false. Numbers higher then 0
+ become true.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "num2bool(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ number = arguments[0]
+
+ case number
+ when Numeric # rubocop:disable Lint/EmptyWhen : Required for the module to work
+ # Yay, it's a number
+ when String
+ begin
+ number = Float(number)
+ rescue ArgumentError => ex
+ raise(Puppet::ParseError, "num2bool(): '#{number}' does not look like a number: #{ex.message}")
+ end
+ else
+ begin
+ number = number.to_s
+ rescue NoMethodError => ex
+ raise(Puppet::ParseError, "num2bool(): Unable to parse argument: #{ex.message}")
+ end
+ end
+
+ # Truncate Floats
+ number = number.to_i
+
+ # Return true for any positive number and false otherwise
+ return number > 0
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/parsejson.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/parsejson.rb
new file mode 100644
index 0000000..4cc43e6
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/parsejson.rb
@@ -0,0 +1,24 @@
+#
+# parsejson.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:parsejson, :type => :rvalue, :doc => <<-DOC
+ This function accepts JSON as a string and converts it into the correct
+ Puppet structure.
+
+ The optional second argument can be used to pass a default value that will
+ be returned if the parsing of YAML string have failed.
+ DOC
+ ) do |arguments|
+ raise ArgumentError, 'Wrong number of arguments. 1 or 2 arguments should be provided.' unless arguments.length >= 1
+
+ begin
+ PSON.load(arguments[0]) || arguments[1]
+ rescue StandardError => e
+ raise e unless arguments[1]
+ arguments[1]
+ end
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb
new file mode 100644
index 0000000..7f857ca
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb
@@ -0,0 +1,28 @@
+#
+# parseyaml.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:parseyaml, :type => :rvalue, :doc => <<-DOC
+ This function accepts YAML as a string and converts it into the correct
+ Puppet structure.
+
+ The optional second argument can be used to pass a default value that will
+ be returned if the parsing of YAML string have failed.
+ DOC
+ ) do |arguments|
+ raise ArgumentError, 'Wrong number of arguments. 1 or 2 arguments should be provided.' unless arguments.length >= 1
+ require 'yaml'
+
+ begin
+ YAML.load(arguments[0]) || arguments[1] # rubocop:disable Security/YAMLLoad : using YAML.safe_load causes the code to break
+ # in ruby 1.9.3 Psych::SyntaxError is a RuntimeException
+ # this still needs to catch that and work also on rubies that
+ # do not have Psych available.
+ rescue StandardError, Psych::SyntaxError => e # rubocop:disable Lint/ShadowedException : See above
+ raise e unless arguments[1]
+ arguments[1]
+ end
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick.rb
new file mode 100644
index 0000000..300e164
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick.rb
@@ -0,0 +1,27 @@
+#
+# pick.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:pick, :type => :rvalue, :doc => <<-DOC
+ This function is similar to a coalesce function in SQL in that it will return
+ the first value in a list of values that is not undefined or an empty string
+ (two things in Puppet that will return a boolean false value). Typically,
+ this function is used to check for a value in the Puppet Dashboard/Enterprise
+ Console, and failover to a default value like the following:
+
+ $real_jenkins_version = pick($::jenkins_version, '1.449')
+
+ The value of $real_jenkins_version will first look for a top-scope variable
+ called 'jenkins_version' (note that parameters set in the Puppet Dashboard/
+ Enterprise Console are brought into Puppet as top-scope variables), and,
+ failing that, will use a default value of 1.449.
+DOC
+ ) do |args|
+ args = args.compact
+ args.delete(:undef)
+ args.delete(:undefined)
+ args.delete('')
+ raise Puppet::ParseError, 'pick(): must receive at least one non empty value' if args[0].to_s.empty?
+ return args[0]
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick_default.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick_default.rb
new file mode 100644
index 0000000..29aaef2
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pick_default.rb
@@ -0,0 +1,36 @@
+#
+# pick_default.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:pick_default, :type => :rvalue, :doc => <<-DOC
+ This function is similar to a coalesce function in SQL in that it will return
+ the first value in a list of values that is not undefined or an empty string
+ (two things in Puppet that will return a boolean false value). If no value is
+ found, it will return the last argument.
+
+ Typically, this function is used to check for a value in the Puppet
+ Dashboard/Enterprise Console, and failover to a default value like the
+ following:
+
+ $real_jenkins_version = pick_default($::jenkins_version, '1.449')
+
+ The value of $real_jenkins_version will first look for a top-scope variable
+ called 'jenkins_version' (note that parameters set in the Puppet Dashboard/
+ Enterprise Console are brought into Puppet as top-scope variables), and,
+ failing that, will use a default value of 1.449.
+
+ Note that, contrary to the pick() function, the pick_default does not fail if
+ all arguments are empty. This allows pick_default to use an empty value as
+ default.
+DOC
+ ) do |args|
+ raise 'Must receive at least one argument.' if args.empty?
+ default = args.last
+ args = args[0..-2].compact
+ args.delete(:undef)
+ args.delete(:undefined)
+ args.delete('')
+ args << default
+ return args[0]
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/prefix.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/prefix.rb
new file mode 100644
index 0000000..7490a18
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/prefix.rb
@@ -0,0 +1,50 @@
+#
+# prefix.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:prefix, :type => :rvalue, :doc => <<-DOC
+ This function applies a prefix to all elements in an array or a hash.
+
+ *Examples:*
+
+ prefix(['a','b','c'], 'p')
+
+ Will return: ['pa','pb','pc']
+ DOC
+ ) do |arguments|
+
+ # Technically we support two arguments but only first is mandatory ...
+ raise(Puppet::ParseError, "prefix(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ enumerable = arguments[0]
+
+ unless enumerable.is_a?(Array) || enumerable.is_a?(Hash)
+ raise Puppet::ParseError, "prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}"
+ end
+
+ prefix = arguments[1] if arguments[1]
+
+ if prefix
+ unless prefix.is_a?(String)
+ raise Puppet::ParseError, "prefix(): expected second argument to be a String, got #{prefix.inspect}"
+ end
+ end
+
+ result = if enumerable.is_a?(Array)
+ # Turn everything into string same as join would do ...
+ enumerable.map do |i|
+ i = i.to_s
+ prefix ? prefix + i : i
+ end
+ else
+ Hash[enumerable.map do |k, v|
+ k = k.to_s
+ [prefix ? prefix + k : k, v]
+ end]
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/private.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/private.rb
new file mode 100644
index 0000000..5e0b7c5
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/private.rb
@@ -0,0 +1,16 @@
+#
+# private.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:private, :doc => <<-'DOC'
+ DEPRECATED: Sets the current class or definition as private.
+ Calling the class or definition from outside the current module will fail.
+ DOC
+ ) do |args|
+ warning("private() DEPRECATED: This function will cease to function on Puppet 4; please use assert_private() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.") # rubocop:disable Metrics/LineLength : Cannot shorten this line
+ unless Puppet::Parser::Functions.autoloader.loaded?(:assert_private)
+ Puppet::Parser::Functions.autoloader.load(:assert_private)
+ end
+ function_assert_private([(args[0] unless args.empty?)])
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pry.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pry.rb
new file mode 100644
index 0000000..17b3bc7
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pry.rb
@@ -0,0 +1,29 @@
+#
+# pry.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:pry, :type => :statement, :doc => <<-DOC
+ This function invokes a pry debugging session in the current scope object. This is useful for debugging manifest code at specific points during a compilation.
+
+ *Examples:*
+
+ pry()
+ DOC
+ ) do |arguments|
+ begin
+ require 'pry'
+ rescue LoadError
+ raise(Puppet::Error, "pry(): Requires the 'pry' rubygem to use, but it was not found")
+ end
+ #
+ ## Run `catalog` to see the contents currently compiling catalog
+ ## Run `cd catalog` and `ls` to see catalog methods and instance variables
+ ## Run `@resource_table` to see the current catalog resource table
+ #
+ if $stdout.isatty
+ binding.pry # rubocop:disable Lint/Debugger
+ else
+ Puppet.warning 'pry(): cowardly refusing to start the debugger on a daemonized master'
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pw_hash.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pw_hash.rb
new file mode 100644
index 0000000..eaf1d74
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/pw_hash.rb
@@ -0,0 +1,62 @@
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+Puppet::Parser::Functions.newfunction(
+ :pw_hash,
+ :type => :rvalue,
+ :arity => 3,
+ :doc => "Hashes a password using the crypt function. Provides a hash
+ usable on most POSIX systems.
+
+ The first argument to this function is the password to hash. If it is
+ undef or an empty string, this function returns undef.
+
+ The second argument to this function is which type of hash to use. It
+ will be converted into the appropriate crypt(3) hash specifier. Valid
+ hash types are:
+
+ |Hash type |Specifier|
+ |---------------------|---------|
+ |MD5 |1 |
+ |SHA-256 |5 |
+ |SHA-512 (recommended)|6 |
+
+ The third argument to this function is the salt to use.
+
+ Note: this uses the Puppet Master's implementation of crypt(3). If your
+ environment contains several different operating systems, ensure that they
+ are compatible before using this function.",
+) do |args|
+ raise ArgumentError, "pw_hash(): wrong number of arguments (#{args.size} for 3)" if args.size != 3
+ args.map! do |arg|
+ if (defined? Puppet::Pops::Types::PSensitiveType::Sensitive) && (arg.is_a? Puppet::Pops::Types::PSensitiveType::Sensitive)
+ arg.unwrap
+ else
+ arg
+ end
+ end
+ raise ArgumentError, 'pw_hash(): first argument must be a string' unless args[0].is_a?(String) || args[0].nil?
+ raise ArgumentError, 'pw_hash(): second argument must be a string' unless args[1].is_a? String
+ hashes = { 'md5' => '1',
+ 'sha-256' => '5',
+ 'sha-512' => '6' }
+ hash_type = hashes[args[1].downcase]
+ raise ArgumentError, "pw_hash(): #{args[1]} is not a valid hash type" if hash_type.nil?
+ raise ArgumentError, 'pw_hash(): third argument must be a string' unless args[2].is_a? String
+ raise ArgumentError, 'pw_hash(): third argument must not be empty' if args[2].empty?
+ raise ArgumentError, 'pw_hash(): characters in salt must be in the set [a-zA-Z0-9./]' unless args[2] =~ %r{\A[a-zA-Z0-9./]+\z}
+
+ password = args[0]
+ return nil if password.nil? || password.empty?
+
+ salt = "$#{hash_type}$#{args[2]}"
+
+ # handle weak implementations of String#crypt
+ if 'test'.crypt('$1$1') != '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
+ # JRuby < 1.7.17
+ # MS Windows and other systems that don't support enhanced salts
+ raise Puppet::ParseError, 'system does not support enhanced salts' unless RUBY_PLATFORM == 'java'
+ # puppetserver bundles Apache Commons Codec
+ org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
+ else
+ password.crypt(salt)
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/range.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/range.rb
new file mode 100644
index 0000000..3e5cc44
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/range.rb
@@ -0,0 +1,84 @@
+#
+# range.rb
+#
+# TODO(Krzysztof Wilczynski): We probably need to approach numeric values differently ...
+module Puppet::Parser::Functions
+ newfunction(:range, :type => :rvalue, :doc => <<-DOC
+ When given range in the form of (start, stop) it will extrapolate a range as
+ an array.
+
+ *Examples:*
+
+ range("0", "9")
+
+ Will return: [0,1,2,3,4,5,6,7,8,9]
+
+ range("00", "09")
+
+ Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to
+ integers automatically)
+
+ range("a", "c")
+
+ Will return: ["a","b","c"]
+
+ range("host01", "host10")
+ Will return: ["host01", "host02", ..., "host09", "host10"]
+ NB Be explicit in including trailing zeros. Otherwise the underlying ruby function will fail.
+
+ Passing a third argument will cause the generated range to step by that
+ interval, e.g.
+
+ range("0", "9", "2")
+
+ Will return: [0,2,4,6,8]
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, 'range(): Wrong number of arguments given (0 for 1)') if arguments.empty?
+
+ if arguments.size > 1
+ start = arguments[0]
+ stop = arguments[1]
+ step = arguments[2].nil? ? 1 : arguments[2].to_i.abs
+
+ type = '..' # Use the simplest type of Range available in Ruby
+
+ else # arguments.size == 1
+ value = arguments[0]
+
+ m = value.match(%r{^(\w+)(\.\.\.?|\-)(\w+)$})
+ if m
+ start = m[1]
+ stop = m[3]
+
+ type = m[2]
+ step = 1
+ elsif value =~ %r{^.+$}
+ raise(Puppet::ParseError, "range(): Unable to compute range from the value: #{value}")
+ else
+ raise(Puppet::ParseError, "range(): Unknown range format: #{value}")
+ end
+ end
+
+ # If we were given an integer, ensure we work with one
+ if start.to_s =~ %r{^\d+$}
+ start = start.to_i
+ stop = stop.to_i
+ else
+ start = start.to_s
+ stop = stop.to_s
+ end
+
+ range = case type
+ when %r{^(..|-)$} then (start..stop)
+ when '...' then (start...stop) # Exclusive of last element
+ end
+
+ result = range.step(step).to_a
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/regexpescape.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/regexpescape.rb
new file mode 100644
index 0000000..647d865
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/regexpescape.rb
@@ -0,0 +1,29 @@
+#
+# regexpescape.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:regexpescape, :type => :rvalue, :doc => <<-DOC
+ Regexp escape a string or array of strings.
+ Requires either a single string or an array as an input.
+ DOC
+ ) do |arguments| # rubocop:disable Layout/ClosingParenthesisIndentation
+ raise(Puppet::ParseError, "regexpescape(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'regexpescape(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? Regexp.escape(i) : i }
+ else
+ Regexp.escape(value)
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/reject.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/reject.rb
new file mode 100644
index 0000000..be2f017
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/reject.rb
@@ -0,0 +1,30 @@
+#
+# reject.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:reject, :type => :rvalue, :doc => <<-DOC) do |args|
+ This function searches through an array and rejects all elements that match
+ the provided regular expression.
+
+ *Examples:*
+
+ reject(['aaa','bbb','ccc','aaaddd'], 'aaa')
+
+ Would return:
+
+ ['bbb','ccc']
+DOC
+
+ if args.size != 2
+ raise Puppet::ParseError,
+ "reject(): Wrong number of arguments given #{args.size} for 2"
+ end
+
+ ary = args[0]
+ pattern = Regexp.new(args[1])
+
+ ary.reject { |e| e =~ pattern }
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/reverse.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/reverse.rb
new file mode 100644
index 0000000..ea911ec
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/reverse.rb
@@ -0,0 +1,24 @@
+#
+# reverse.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:reverse, :type => :rvalue, :doc => <<-DOC
+ Reverses the order of a string or array.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "reverse(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'reverse(): Requires either array or string to work with')
+ end
+
+ result = value.reverse
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/round.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/round.rb
new file mode 100644
index 0000000..b4f2c2b
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/round.rb
@@ -0,0 +1,32 @@
+#
+# round.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:round, :type => :rvalue, :doc => <<-DOC
+ Rounds a number to the nearest integer
+
+ *Examples:*
+
+ round(2.9)
+
+ returns: 3
+
+ round(2.4)
+
+ returns: 2
+
+ DOC
+ ) do |args|
+
+ raise Puppet::ParseError, "round(): Wrong number of arguments given #{args.size} for 1" if args.size != 1
+ raise Puppet::ParseError, "round(): Expected a Numeric, got #{args[0].class}" unless args[0].is_a? Numeric
+
+ value = args[0]
+
+ if value >= 0
+ Integer(value + 0.5)
+ else
+ Integer(value - 0.5)
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/rstrip.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/rstrip.rb
new file mode 100644
index 0000000..3e04b27
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/rstrip.rb
@@ -0,0 +1,28 @@
+#
+# rstrip.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:rstrip, :type => :rvalue, :doc => <<-DOC
+ Strips leading spaces to the right of the string.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "rstrip(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'rstrip(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ value.map { |i| i.is_a?(String) ? i.rstrip : i }
+ else
+ value.rstrip
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/seeded_rand.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/seeded_rand.rb
new file mode 100644
index 0000000..0120b87
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/seeded_rand.rb
@@ -0,0 +1,24 @@
+#
+# seeded_rand.rb
+#
+Puppet::Parser::Functions.newfunction(
+ :seeded_rand,
+ :arity => 2,
+ :type => :rvalue,
+ :doc => <<-DOC
+ Usage: `seeded_rand(MAX, SEED)`. MAX must be a positive integer; SEED is any string.
+
+ Generates a random whole number greater than or equal to 0 and less
+ than MAX, using the value of SEED for repeatable randomness. If SEED
+ starts with "$fqdn:", this is behaves the same as `fqdn_rand`.
+DOC
+) do |args|
+ require 'digest/md5'
+
+ raise(ArgumentError, 'seeded_rand(): first argument must be a positive integer') unless function_is_integer([args[0]]) && args[0].to_i > 0
+ raise(ArgumentError, 'seeded_rand(): second argument must be a string') unless args[1].is_a? String
+
+ max = args[0].to_i
+ seed = Digest::MD5.hexdigest(args[1]).hex
+ Puppet::Util.deterministic_rand(seed, max)
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_escape.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_escape.rb
new file mode 100644
index 0000000..96fea20
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_escape.rb
@@ -0,0 +1,27 @@
+require 'shellwords'
+#
+# shell_escape.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:shell_escape, :type => :rvalue, :doc => <<-DOC
+ Escapes a string so that it can be safely used in a Bourne shell command line.
+
+ Note that the resulting string should be used unquoted and is not intended for use in double quotes nor in single
+ quotes.
+
+ This function behaves the same as ruby's Shellwords.shellescape() function.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "shell_escape(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ # explicit conversion to string is required for ruby 1.9
+ string = arguments[0].to_s
+
+ result = Shellwords.shellescape(string)
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_join.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_join.rb
new file mode 100644
index 0000000..0a037c1
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_join.rb
@@ -0,0 +1,29 @@
+
+require 'shellwords'
+#
+# shell_join.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:shell_join, :type => :rvalue, :doc => <<-DOC
+ Builds a command line string from the given array of strings. Each array item is escaped for Bourne shell. All items are
+ then joined together, with a single space in between.
+
+ This function behaves the same as ruby's Shellwords.shelljoin() function
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "shell_join(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ array = arguments[0]
+
+ raise Puppet::ParseError, "First argument is not an Array: #{array.inspect}" unless array.is_a?(Array)
+
+ # explicit conversion to string is required for ruby 1.9
+ array = array.map { |item| item.to_s }
+ result = Shellwords.shelljoin(array)
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_split.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_split.rb
new file mode 100644
index 0000000..9dcf958
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shell_split.rb
@@ -0,0 +1,23 @@
+require 'shellwords'
+#
+# shell_split.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:shell_split, :type => :rvalue, :doc => <<-DOC
+ Splits a string into an array of tokens in the same way the Bourne shell does.
+
+ This function behaves the same as ruby's Shellwords.shellsplit() function
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "shell_split(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ string = arguments[0].to_s
+
+ result = Shellwords.shellsplit(string)
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shuffle.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shuffle.rb
new file mode 100644
index 0000000..5e6d93b
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/shuffle.rb
@@ -0,0 +1,42 @@
+#
+# shuffle.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:shuffle, :type => :rvalue, :doc => <<-DOC
+ Randomizes the order of a string or array elements.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "shuffle(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'shuffle(): Requires either array or string to work with')
+ end
+
+ result = value.clone
+
+ string = value.is_a?(String) ? true : false
+
+ # Check whether it makes sense to shuffle ...
+ return result if result.size <= 1
+
+ # We turn any string value into an array to be able to shuffle ...
+ result = string ? result.split('') : result
+
+ elements = result.size
+
+ # Simple implementation of Fisher–Yates in-place shuffle ...
+ elements.times do |i|
+ j = rand(elements - i) + i
+ result[j], result[i] = result[i], result[j]
+ end
+
+ result = string ? result.join : result
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/size.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/size.rb
new file mode 100644
index 0000000..27f9614
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/size.rb
@@ -0,0 +1,44 @@
+#
+# size.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:size, :type => :rvalue, :doc => <<-DOC
+ Returns the number of elements in a string, an array or a hash
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "size(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ item = arguments[0]
+
+ function_deprecation([:size, 'This method is going to be deprecated, please use the stdlib length function.'])
+
+ if item.is_a?(String)
+
+ begin
+ #
+ # Check whether your item is a numeric value or not ...
+ # This will take care about positive and/or negative numbers
+ # for both integer and floating-point values ...
+ #
+ # Please note that Puppet has no notion of hexadecimal
+ # nor octal numbers for its DSL at this point in time ...
+ #
+ Float(item)
+
+ raise(Puppet::ParseError, 'size(): Requires either string, array or hash to work with')
+ rescue ArgumentError
+ result = item.size
+ end
+
+ elsif item.is_a?(Array) || item.is_a?(Hash)
+ result = item.size
+ else
+ raise(Puppet::ParseError, 'size(): Unknown type given')
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/sort.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/sort.rb
new file mode 100644
index 0000000..f0b4a14
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/sort.rb
@@ -0,0 +1,25 @@
+#
+# sort.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:sort, :type => :rvalue, :doc => <<-DOC
+ Sorts strings and arrays lexically.
+ DOC
+ ) do |arguments|
+
+ if arguments.size != 1
+ raise(Puppet::ParseError, "sort(): Wrong number of arguments given #{arguments.size} for 1")
+ end
+
+ value = arguments[0]
+
+ if value.is_a?(Array)
+ value.sort
+ elsif value.is_a?(String)
+ value.split('').sort.join('')
+ end
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/squeeze.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/squeeze.rb
new file mode 100644
index 0000000..eaa1404
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/squeeze.rb
@@ -0,0 +1,31 @@
+#
+# squeeze.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:squeeze, :type => :rvalue, :doc => <<-DOC
+ Returns a new string where runs of the same character that occur in this set are replaced by a single character.
+ DOC
+ ) do |arguments|
+
+ if (arguments.size != 2) && (arguments.size != 1)
+ raise(Puppet::ParseError, "squeeze(): Wrong number of arguments given #{arguments.size} for 2 or 1")
+ end
+
+ item = arguments[0]
+ squeezeval = arguments[1]
+
+ if item.is_a?(Array)
+ if squeezeval
+ item.map { |i| i.squeeze(squeezeval) }
+ else
+ item.map { |i| i.squeeze }
+ end
+ elsif squeezeval
+ item.squeeze(squeezeval)
+ else
+ item.squeeze
+ end
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2bool.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2bool.rb
new file mode 100644
index 0000000..95c260c
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2bool.rb
@@ -0,0 +1,43 @@
+#
+# str2bool.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:str2bool, :type => :rvalue, :doc => <<-DOC
+ This converts a string to a boolean. This attempt to convert strings that
+ contain things like: Y,y, 1, T,t, TRUE,true to 'true' and strings that contain things
+ like: 0, F,f, N,n, false, FALSE, no to 'false'.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "str2bool(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ string = arguments[0]
+
+ # If string is already Boolean, return it
+ if !!string == string # rubocop:disable Style/DoubleNegation : No viable alternative
+ return string
+ end
+
+ unless string.is_a?(String)
+ raise(Puppet::ParseError, 'str2bool(): Requires string to work with')
+ end
+
+ # We consider all the yes, no, y, n and so on too ...
+ result = case string
+ #
+ # This is how undef looks like in Puppet ...
+ # We yield false in this case.
+ #
+ when %r{^$}, '' then false # Empty string will be false ...
+ when %r{^(1|t|y|true|yes)$}i then true
+ when %r{^(0|f|n|false|no)$}i then false
+ when %r{^(undef|undefined)$} then false # This is not likely to happen ...
+ else
+ raise(Puppet::ParseError, 'str2bool(): Unknown type of boolean given')
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb
new file mode 100644
index 0000000..4d62008
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb
@@ -0,0 +1,30 @@
+#
+# str2saltedsha512.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:str2saltedsha512, :type => :rvalue, :doc => <<-DOC
+ This converts a string to a salted-SHA512 password hash (which is used for
+ OS X versions >= 10.7). Given any simple string, you will get a hex version
+ of a salted-SHA512 password hash that can be inserted into your Puppet
+ manifests as a valid password attribute.
+ DOC
+ ) do |arguments|
+ require 'digest/sha2'
+
+ raise(Puppet::ParseError, "str2saltedsha512(): Wrong number of arguments passed (#{arguments.size} but we require 1)") if arguments.size != 1
+
+ password = arguments[0]
+
+ unless password.is_a?(String)
+ raise(Puppet::ParseError, "str2saltedsha512(): Requires a String argument, you passed: #{password.class}")
+ end
+
+ seedint = rand(2**31 - 1)
+ seedstring = Array(seedint).pack('L')
+ saltedpass = Digest::SHA512.digest(seedstring + password)
+ (seedstring + saltedpass).unpack('H*')[0]
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/strftime.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/strftime.rb
new file mode 100644
index 0000000..53cf749
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/strftime.rb
@@ -0,0 +1,105 @@
+#
+# strftime.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:strftime, :type => :rvalue, :doc => <<-DOC
+ This function returns formatted time.
+
+ *Examples:*
+
+ To return the time since epoch:
+
+ strftime("%s")
+
+ To return the date:
+
+ strftime("%Y-%m-%d")
+
+ *Format meaning:*
+
+ %a - The abbreviated weekday name (``Sun'')
+ %A - The full weekday name (``Sunday'')
+ %b - The abbreviated month name (``Jan'')
+ %B - The full month name (``January'')
+ %c - The preferred local date and time representation
+ %C - Century (20 in 2009)
+ %d - Day of the month (01..31)
+ %D - Date (%m/%d/%y)
+ %e - Day of the month, blank-padded ( 1..31)
+ %F - Equivalent to %Y-%m-%d (the ISO 8601 date format)
+ %h - Equivalent to %b
+ %H - Hour of the day, 24-hour clock (00..23)
+ %I - Hour of the day, 12-hour clock (01..12)
+ %j - Day of the year (001..366)
+ %k - hour, 24-hour clock, blank-padded ( 0..23)
+ %l - hour, 12-hour clock, blank-padded ( 0..12)
+ %L - Millisecond of the second (000..999)
+ %m - Month of the year (01..12)
+ %M - Minute of the hour (00..59)
+ %n - Newline (\n)
+ %N - Fractional seconds digits, default is 9 digits (nanosecond)
+ %3N millisecond (3 digits)
+ %6N microsecond (6 digits)
+ %9N nanosecond (9 digits)
+ %p - Meridian indicator (``AM'' or ``PM'')
+ %P - Meridian indicator (``am'' or ``pm'')
+ %r - time, 12-hour (same as %I:%M:%S %p)
+ %R - time, 24-hour (%H:%M)
+ %s - Number of seconds since 1970-01-01 00:00:00 UTC.
+ %S - Second of the minute (00..60)
+ %t - Tab character (\t)
+ %T - time, 24-hour (%H:%M:%S)
+ %u - Day of the week as a decimal, Monday being 1. (1..7)
+ %U - Week number of the current year,
+ starting with the first Sunday as the first
+ day of the first week (00..53)
+ %v - VMS date (%e-%b-%Y)
+ %V - Week number of year according to ISO 8601 (01..53)
+ %W - Week number of the current year,
+ starting with the first Monday as the first
+ day of the first week (00..53)
+ %w - Day of the week (Sunday is 0, 0..6)
+ %x - Preferred representation for the date alone, no time
+ %X - Preferred representation for the time alone, no date
+ %y - Year without a century (00..99)
+ %Y - Year with century
+ %z - Time zone as hour offset from UTC (e.g. +0900)
+ %Z - Time zone name
+ %% - Literal ``%'' character
+ DOC
+ ) do |arguments|
+
+ # Technically we support two arguments but only first is mandatory ...
+ raise(Puppet::ParseError, "strftime(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ format = arguments[0]
+
+ raise(Puppet::ParseError, 'strftime(): You must provide format for evaluation') if format.empty?
+
+ # The Time Zone argument is optional ...
+ time_zone = arguments[1] if arguments[1]
+
+ time = Time.new
+
+ # There is probably a better way to handle Time Zone ...
+ if time_zone && !time_zone.empty?
+ original_zone = ENV['TZ']
+
+ local_time = time.clone
+ local_time = local_time.utc
+
+ ENV['TZ'] = time_zone
+
+ time = local_time.localtime
+
+ ENV['TZ'] = original_zone
+ end
+
+ result = time.strftime(format)
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/strip.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/strip.rb
new file mode 100644
index 0000000..6a147cd
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/strip.rb
@@ -0,0 +1,35 @@
+#
+# strip.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:strip, :type => :rvalue, :doc => <<-DOC
+ This function removes leading and trailing whitespace from a string or from
+ every string inside an array.
+
+ *Examples:*
+
+ strip(" aaa ")
+
+ Would result in: "aaa"
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "strip(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'strip(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ value.map { |i| i.is_a?(String) ? i.strip : i }
+ else
+ value.strip
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/suffix.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/suffix.rb
new file mode 100644
index 0000000..407cd53
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/suffix.rb
@@ -0,0 +1,51 @@
+#
+# suffix.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:suffix, :type => :rvalue, :doc => <<-DOC
+ This function applies a suffix to all elements in an array, or to the keys
+ in a hash.
+
+ *Examples:*
+
+ suffix(['a','b','c'], 'p')
+
+ Will return: ['ap','bp','cp']
+ DOC
+ ) do |arguments|
+
+ # Technically we support two arguments but only first is mandatory ...
+ raise(Puppet::ParseError, "suffix(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ enumerable = arguments[0]
+
+ unless enumerable.is_a?(Array) || enumerable.is_a?(Hash)
+ raise Puppet::ParseError, "suffix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}"
+ end
+
+ suffix = arguments[1] if arguments[1]
+
+ if suffix
+ unless suffix.is_a? String
+ raise Puppet::ParseError, "suffix(): expected second argument to be a String, got #{suffix.inspect}"
+ end
+ end
+
+ result = if enumerable.is_a?(Array)
+ # Turn everything into string same as join would do ...
+ enumerable.map do |i|
+ i = i.to_s
+ suffix ? i + suffix : i
+ end
+ else
+ Hash[enumerable.map do |k, v|
+ k = k.to_s
+ [suffix ? k + suffix : k, v]
+ end]
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/swapcase.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/swapcase.rb
new file mode 100644
index 0000000..e8a5d9a
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/swapcase.rb
@@ -0,0 +1,36 @@
+#
+# swapcase.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:swapcase, :type => :rvalue, :doc => <<-DOC
+ This function will swap the existing case of a string.
+
+ *Examples:*
+
+ swapcase("aBcD")
+
+ Would result in: "AbCd"
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "swapcase(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'swapcase(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? i.swapcase : i }
+ else
+ value.swapcase
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/time.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/time.rb
new file mode 100644
index 0000000..021a483
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/time.rb
@@ -0,0 +1,48 @@
+#
+# time.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:time, :type => :rvalue, :doc => <<-DOC
+ This function will return the current time since epoch as an integer.
+
+ *Examples:*
+
+ time()
+
+ Will return something like: 1311972653
+ DOC
+ ) do |arguments|
+
+ # The Time Zone argument is optional ...
+ time_zone = arguments[0] if arguments[0]
+
+ if !arguments.empty? && (arguments.size != 1)
+ raise(Puppet::ParseError, "time(): Wrong number of arguments given #{arguments.size} for 0 or 1")
+ end
+
+ time = Time.new
+
+ # There is probably a better way to handle Time Zone ...
+ if time_zone && !time_zone.empty?
+ original_zone = ENV['TZ']
+
+ local_time = time.clone
+ local_time = local_time.utc
+
+ ENV['TZ'] = time_zone
+
+ result = local_time.localtime.strftime('%s')
+
+ ENV['TZ'] = original_zone
+ else
+ result = time.localtime.strftime('%s')
+ end
+
+ # Calling Time#to_i on a receiver changes it. Trust me I am the Doctor.
+ result = result.to_i
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb
new file mode 100644
index 0000000..bff24b0
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb
@@ -0,0 +1,33 @@
+#
+# to_bytes.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:to_bytes, :type => :rvalue, :doc => <<-DOC
+ Converts the argument into bytes, for example 4 kB becomes 4096.
+ Takes a single string value as an argument.
+ These conversions reflect a layperson's understanding of
+ 1 MB = 1024 KB, when in fact 1 MB = 1000 KB, and 1 MiB = 1024 KiB.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "to_bytes(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ arg = arguments[0]
+
+ return arg if arg.is_a? Numeric
+
+ value, prefix = *%r{([0-9.e+-]*)\s*([^bB]?)}.match(arg)[1, 2]
+
+ value = value.to_f
+ case prefix
+ when '' then return value.to_i
+ when 'k' then return (value * (1 << 10)).to_i
+ when 'M' then return (value * (1 << 20)).to_i
+ when 'G' then return (value * (1 << 30)).to_i
+ when 'T' then return (value * (1 << 40)).to_i
+ when 'P' then return (value * (1 << 50)).to_i
+ when 'E' then return (value * (1 << 60)).to_i
+ else raise Puppet::ParseError, "to_bytes(): Unknown prefix #{prefix}"
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/try_get_value.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/try_get_value.rb
new file mode 100644
index 0000000..34f9476
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/try_get_value.rb
@@ -0,0 +1,56 @@
+#
+# try_get_value.rb
+#
+module Puppet::Parser::Functions
+ newfunction(
+ :try_get_value,
+ :type => :rvalue,
+ :arity => -2,
+ :doc => <<-DOC
+ DEPRECATED: this function is deprecated, please use dig() instead.
+
+ Looks up into a complex structure of arrays and hashes and returns a value
+ or the default value if nothing was found.
+
+ Key can contain slashes to describe path components. The function will go down
+ the structure and try to extract the required value.
+
+ $data = {
+ 'a' => {
+ 'b' => [
+ 'b1',
+ 'b2',
+ 'b3',
+ ]
+ }
+ }
+
+ $value = try_get_value($data, 'a/b/2', 'not_found', '/')
+ => $value = 'b3'
+
+ a -> first hash key
+ b -> second hash key
+ 2 -> array index starting with 0
+
+ not_found -> (optional) will be returned if there is no value or the path did not match. Defaults to nil.
+ / -> (optional) path delimiter. Defaults to '/'.
+
+ In addition to the required "key" argument, "try_get_value" accepts default
+ argument. It will be returned if no value was found or a path component is
+ missing. And the fourth argument can set a variable path separator.
+ DOC
+ ) do |args|
+ warning('try_get_value() DEPRECATED: this function is deprecated, please use dig() instead.')
+ data = args[0]
+ path = args[1] || ''
+ default = args[2]
+
+ if !(data.is_a?(Hash) || data.is_a?(Array)) || path == ''
+ return default || data
+ end
+
+ separator = args[3] || '/'
+ path = path.split(separator).map { |key| (key =~ %r{^\d+$}) ? key.to_i : key }
+ function_dig([data, path, default])
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/type.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/type.rb
new file mode 100644
index 0000000..d9d841b
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/type.rb
@@ -0,0 +1,18 @@
+#
+# type.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:type, :type => :rvalue, :doc => <<-DOC
+ DEPRECATED: This function will cease to function on Puppet 4; please use type3x() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.
+ DOC
+ ) do |args|
+
+ warning("type() DEPRECATED: This function will cease to function on Puppet 4; please use type3x() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.") # rubocop:disable Metrics/LineLength : Cannot reduce line length
+ unless Puppet::Parser::Functions.autoloader.loaded?(:type3x)
+ Puppet::Parser::Functions.autoloader.load(:type3x)
+ end
+ function_type3x(args)
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/type3x.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/type3x.rb
new file mode 100644
index 0000000..f5b46aa
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/type3x.rb
@@ -0,0 +1,49 @@
+#
+# type3x.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:type3x, :type => :rvalue, :doc => <<-DOC
+ DEPRECATED: This function will be removed when puppet 3 support is dropped; please migrate to the new parser's typing system.
+
+ Returns the type when passed a value. Type can be one of:
+
+ * string
+ * array
+ * hash
+ * float
+ * integer
+ * boolean
+ DOC
+ ) do |args|
+ raise(Puppet::ParseError, "type3x(): Wrong number of arguments given (#{args.size} for 1)") unless args.size == 1
+
+ value = args[0]
+
+ klass = value.class
+
+ unless [TrueClass, FalseClass, Array, Bignum, Fixnum, Float, Hash, String].include?(klass) # rubocop:disable Lint/UnifiedInteger
+ raise(Puppet::ParseError, 'type3x(): Unknown type')
+ end
+
+ klass = klass.to_s # Ugly ...
+
+ # We note that Integer is the parent to Bignum and Fixnum ...
+ result = case klass
+ when %r{^(?:Big|Fix)num$} then 'integer'
+ when %r{^(?:True|False)Class$} then 'boolean'
+ else klass
+ end
+
+ if result == 'String'
+ if value == value.to_i.to_s
+ result = 'Integer'
+ elsif value == value.to_f.to_s
+ result = 'Float'
+ end
+ end
+
+ return result.downcase
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/union.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/union.rb
new file mode 100644
index 0000000..ed57bc5
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/union.rb
@@ -0,0 +1,27 @@
+#
+# union.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:union, :type => :rvalue, :doc => <<-DOC
+ This function returns a union of two or more arrays.
+
+ *Examples:*
+
+ union(["a","b","c"],["b","c","d"])
+
+ Would return: ["a","b","c","d"]
+ DOC
+ ) do |arguments|
+
+ # Check that 2 or more arguments have been given ...
+ raise(Puppet::ParseError, "union(): Wrong number of arguments given (#{arguments.size} for < 2)") if arguments.size < 2
+
+ arguments.each do |argument|
+ raise(Puppet::ParseError, 'union(): Every parameter must be an array') unless argument.is_a?(Array)
+ end
+
+ arguments.reduce(:|)
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/unique.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/unique.rb
new file mode 100644
index 0000000..301f6a4
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/unique.rb
@@ -0,0 +1,51 @@
+#
+# unique.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:unique, :type => :rvalue, :doc => <<-DOC
+ This function will remove duplicates from strings and arrays.
+
+ *Examples:*
+
+ unique("aabbcc")
+
+ Will return:
+
+ abc
+
+ You can also use this with arrays:
+
+ unique(["a","a","b","b","c","c"])
+
+ This returns:
+
+ ["a","b","c"]
+ DOC
+ ) do |arguments|
+
+ if Puppet::Util::Package.versioncmp(Puppet.version, '5.0.0') >= 0
+ function_deprecation([:unique, 'This method is deprecated, please use the core puppet unique function. There is further documentation for the function in the release notes of Puppet 5.0.'])
+ end
+
+ raise(Puppet::ParseError, "unique(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'unique(): Requires either array or string to work with')
+ end
+
+ result = value.clone
+
+ string = value.is_a?(String) ? true : false
+
+ # We turn any string value into an array to be able to shuffle ...
+ result = string ? result.split('') : result
+ result = result.uniq # Remove duplicates ...
+ result = string ? result.join : result
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/unix2dos.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/unix2dos.rb
new file mode 100644
index 0000000..8123797
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/unix2dos.rb
@@ -0,0 +1,15 @@
+# Custom Puppet function to convert unix to dos format
+module Puppet::Parser::Functions
+ newfunction(:unix2dos, :type => :rvalue, :arity => 1, :doc => <<-DOC
+ Returns the DOS version of the given string.
+ Takes a single string argument.
+ DOC
+ ) do |arguments|
+
+ unless arguments[0].is_a?(String)
+ raise(Puppet::ParseError, 'unix2dos(): Requires string as argument')
+ end
+
+ arguments[0].gsub(%r{\r*\n}, "\r\n")
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/upcase.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/upcase.rb
new file mode 100644
index 0000000..42e6114
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/upcase.rb
@@ -0,0 +1,43 @@
+#
+# upcase.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:upcase, :type => :rvalue, :doc => <<-DOC
+ Converts a string or an array of strings to uppercase.
+
+ *Examples:*
+
+ upcase("abcd")
+
+ Will return:
+
+ ABCD
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "upcase(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(Hash) || value.respond_to?(:upcase)
+ raise(Puppet::ParseError, 'upcase(): Requires an array, hash or object that responds to upcase in order to work')
+ end
+
+ if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ result = value.map { |i| function_upcase([i]) }
+ elsif value.is_a?(Hash)
+ result = {}
+ value.each_pair do |k, v|
+ result[function_upcase([k])] = function_upcase([v])
+ end
+ else
+ result = value.upcase
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/uriescape.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/uriescape.rb
new file mode 100644
index 0000000..8bcd586
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/uriescape.rb
@@ -0,0 +1,32 @@
+require 'uri'
+#
+# uriescape.rb
+# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
+#
+module Puppet::Parser::Functions
+ newfunction(:uriescape, :type => :rvalue, :doc => <<-DOC
+ Urlencodes a string or array of strings.
+ Requires either a single string or an array as an input.
+ DOC
+ ) do |arguments|
+
+ raise(Puppet::ParseError, "uriescape(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
+
+ value = arguments[0]
+
+ unless value.is_a?(Array) || value.is_a?(String)
+ raise(Puppet::ParseError, 'uriescape(): Requires either array or string to work with')
+ end
+
+ result = if value.is_a?(Array)
+ # Numbers in Puppet are often string-encoded which is troublesome ...
+ value.map { |i| i.is_a?(String) ? URI.escape(i) : i }
+ else
+ URI.escape(value)
+ end
+
+ return result
+ end
+end
+
+# vim: set ts=2 sw=2 et :
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb
new file mode 100644
index 0000000..0db10c3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb
@@ -0,0 +1,54 @@
+#
+# validate_absolute_path.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_absolute_path, :doc => <<-'DOC') do |args|
+ Validate the string represents an absolute path in the filesystem. This function works
+ for windows and unix style paths.
+
+ The following values will pass:
+
+ $my_path = 'C:/Program Files (x86)/Puppet Labs/Puppet'
+ validate_absolute_path($my_path)
+ $my_path2 = '/var/lib/puppet'
+ validate_absolute_path($my_path2)
+ $my_path3 = ['C:/Program Files (x86)/Puppet Labs/Puppet','C:/Program Files/Puppet Labs/Puppet']
+ validate_absolute_path($my_path3)
+ $my_path4 = ['/var/lib/puppet','/usr/share/puppet']
+ validate_absolute_path($my_path4)
+
+ The following values will fail, causing compilation to abort:
+
+ validate_absolute_path(true)
+ validate_absolute_path('../var/lib/puppet')
+ validate_absolute_path('var/lib/puppet')
+ validate_absolute_path([ 'var/lib/puppet', '/var/foo' ])
+ validate_absolute_path([ '/var/lib/puppet', 'var/foo' ])
+ $undefined = undef
+ validate_absolute_path($undefined)
+
+ DOC
+
+ require 'puppet/util'
+
+ if args.empty?
+ raise Puppet::ParseError, "validate_absolute_path(): wrong number of arguments (#{args.length}; must be > 0)"
+ end
+
+ args.each do |arg|
+ # put arg to candidate var to be able to replace it
+ candidates = arg
+ # if arg is just a string with a path to test, convert it to an array
+ # to avoid test code duplication
+ unless arg.is_a?(Array)
+ candidates = Array.new(1, arg)
+ end
+ # iterate over all paths within the candidates array
+ candidates.each do |path|
+ unless function_is_absolute_path([path])
+ raise Puppet::ParseError, "#{path.inspect} is not an absolute path."
+ end
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_array.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_array.rb
new file mode 100644
index 0000000..1120ce8
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_array.rb
@@ -0,0 +1,36 @@
+#
+# validate_array.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_array, :doc => <<-'DOC') do |args|
+ Validate that all passed values are array data structures. Abort catalog
+ compilation if any value fails this check.
+
+ The following values will pass:
+
+ $my_array = [ 'one', 'two' ]
+ validate_array($my_array)
+
+ The following values will fail, causing compilation to abort:
+
+ validate_array(true)
+ validate_array('some_string')
+ $undefined = undef
+ validate_array($undefined)
+
+ DOC
+
+ function_deprecation([:validate_array, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Array. There is further documentation for validate_legacy function in the README.'])
+
+ if args.empty?
+ raise Puppet::ParseError, "validate_array(): wrong number of arguments (#{args.length}; must be > 0)"
+ end
+
+ args.each do |arg|
+ unless arg.is_a?(Array)
+ raise Puppet::ParseError, "#{arg.inspect} is not an Array. It looks to be a #{arg.class}"
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb
new file mode 100644
index 0000000..97f3127
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb
@@ -0,0 +1,86 @@
+require 'tempfile'
+
+#
+# validate_augaes.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_augeas, :doc => <<-'DOC') do |args|
+ Perform validation of a string using an Augeas lens
+ The first argument of this function should be a string to
+ test, and the second argument should be the name of the Augeas lens to use.
+ If Augeas fails to parse the string with the lens, the compilation will
+ abort with a parse error.
+
+ A third argument can be specified, listing paths which should
+ not be found in the file. The `$file` variable points to the location
+ of the temporary file being tested in the Augeas tree.
+
+ For example, if you want to make sure your passwd content never contains
+ a user `foo`, you could write:
+
+ validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo'])
+
+ Or if you wanted to ensure that no users used the '/bin/barsh' shell,
+ you could use:
+
+ validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]']
+
+ If a fourth argument is specified, this will be the error message raised and
+ seen by the user.
+
+ A helpful error message can be returned like this:
+
+ validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas')
+
+ DOC
+ unless Puppet.features.augeas?
+ raise Puppet::ParseError, 'validate_augeas(): this function requires the augeas feature. See http://docs.puppetlabs.com/guides/augeas.html#pre-requisites for how to activate it.'
+ end
+
+ if (args.length < 2) || (args.length > 4)
+ raise Puppet::ParseError, "validate_augeas(): wrong number of arguments (#{args.length}; must be 2, 3, or 4)"
+ end
+
+ msg = args[3] || "validate_augeas(): Failed to validate content against #{args[1].inspect}"
+
+ require 'augeas'
+ aug = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD)
+ begin
+ content = args[0]
+
+ # Test content in a temporary file
+ tmpfile = Tempfile.new('validate_augeas')
+ begin
+ tmpfile.write(content)
+ ensure
+ tmpfile.close
+ end
+
+ # Check for syntax
+ lens = args[1]
+ aug.transform(
+ :lens => lens,
+ :name => 'Validate_augeas',
+ :incl => tmpfile.path,
+ )
+ aug.load!
+
+ unless aug.match("/augeas/files#{tmpfile.path}//error").empty?
+ error = aug.get("/augeas/files#{tmpfile.path}//error/message")
+ msg += " with error: #{error}"
+ raise Puppet::ParseError, msg
+ end
+
+ # Launch unit tests
+ tests = args[2] || []
+ aug.defvar('file', "/files#{tmpfile.path}")
+ tests.each do |t|
+ msg += " testing path #{t}"
+ raise Puppet::ParseError, msg unless aug.match(t).empty?
+ end
+ ensure
+ aug.close
+ tmpfile.unlink
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb
new file mode 100644
index 0000000..d3bf3d0
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb
@@ -0,0 +1,34 @@
+#
+# validate_bool.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_bool, :doc => <<-'DOC') do |args|
+ Validate that all passed values are either true or false. Abort catalog
+ compilation if any value fails this check.
+
+ The following values will pass:
+
+ $iamtrue = true
+ validate_bool(true)
+ validate_bool(true, true, false, $iamtrue)
+
+ The following values will fail, causing compilation to abort:
+
+ $some_array = [ true ]
+ validate_bool("false")
+ validate_bool("true")
+ validate_bool($some_array)
+
+ DOC
+
+ if args.empty?
+ raise Puppet::ParseError, "validate_bool(): wrong number of arguments (#{args.length}; must be > 0)"
+ end
+
+ args.each do |arg|
+ unless function_is_bool([arg])
+ raise Puppet::ParseError, "#{arg.inspect} is not a boolean. It looks to be a #{arg.class}"
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb
new file mode 100644
index 0000000..dbea604
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb
@@ -0,0 +1,66 @@
+require 'puppet/util/execution'
+require 'tempfile'
+
+#
+# validate_cmd.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_cmd, :doc => <<-'DOC') do |args|
+ Perform validation of a string with an external command.
+ The first argument of this function should be a string to
+ test, and the second argument should be a path to a test command
+ taking a % as a placeholder for the file path (will default to the end).
+ If the command, launched against a tempfile containing the passed string,
+ returns a non-null value, compilation will abort with a parse error.
+
+ If a third argument is specified, this will be the error message raised and
+ seen by the user.
+
+ A helpful error message can be returned like this:
+
+ Example:
+
+ # Defaults to end of path
+ validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content')
+
+ # % as file location
+ validate_cmd($haproxycontent, '/usr/sbin/haproxy -f % -c', 'Haproxy failed to validate config content')
+
+ DOC
+ if (args.length < 2) || (args.length > 3)
+ raise Puppet::ParseError, "validate_cmd(): wrong number of arguments (#{args.length}; must be 2 or 3)"
+ end
+
+ msg = args[2] || "validate_cmd(): failed to validate content with command #{args[1].inspect}"
+
+ content = args[0]
+ checkscript = args[1]
+
+ # Test content in a temporary file
+ tmpfile = Tempfile.new('validate_cmd')
+ begin
+ tmpfile.write(content)
+ tmpfile.close
+
+ check_with_correct_location = if checkscript =~ %r{\s%(\s|$)}
+ checkscript.gsub(%r{%}, tmpfile.path)
+ else
+ "#{checkscript} #{tmpfile.path}"
+ end
+
+ if Puppet::Util::Execution.respond_to?('execute')
+ Puppet::Util::Execution.execute(check_with_correct_location)
+ else
+ Puppet::Util.execute(check_with_correct_location)
+ end
+ rescue Puppet::ExecutionFailure => detail
+ msg += "\n#{detail}"
+ raise Puppet::ParseError, msg
+ rescue StandardError => detail
+ msg += "\n#{detail.class.name} #{detail}"
+ raise Puppet::ParseError, msg
+ ensure
+ tmpfile.unlink
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_domain_name.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_domain_name.rb
new file mode 100644
index 0000000..c479dfb
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_domain_name.rb
@@ -0,0 +1,42 @@
+#
+# validate_domain_name.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_domain_name, :doc => <<-DOC
+ Validate that all values passed are syntactically correct domain names.
+ Fail compilation if any value fails this check.
+
+ The following values will pass:
+
+ $my_domain_name = 'server.domain.tld'
+ validate_domain_name($my_domain_name)
+ validate_domain_name('domain.tld', 'puppet.com', $my_domain_name)
+
+ The following values will fail, causing compilation to abort:
+
+ validate_domain_name(1)
+ validate_domain_name(true)
+ validate_domain_name('invalid domain')
+ validate_domain_name('-foo.example.com')
+ validate_domain_name('www.example.2com')
+
+ DOC
+ ) do |args|
+
+ rescuable_exceptions = [ArgumentError]
+
+ if args.empty?
+ raise Puppet::ParseError, "validate_domain_name(): wrong number of arguments (#{args.length}; must be > 0)"
+ end
+
+ args.each do |arg|
+ raise Puppet::ParseError, "#{arg.inspect} is not a string." unless arg.is_a?(String)
+
+ begin
+ raise Puppet::ParseError, "#{arg.inspect} is not a syntactically correct domain name" unless function_is_domain_name([arg])
+ rescue *rescuable_exceptions
+ raise Puppet::ParseError, "#{arg.inspect} is not a syntactically correct domain name"
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_email_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_email_address.rb
new file mode 100644
index 0000000..a039f51
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_email_address.rb
@@ -0,0 +1,34 @@
+#
+# validate_email_address.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_email_address, :doc => <<-DOC
+ Validate that all values passed are valid email addresses.
+ Fail compilation if any value fails this check.
+ The following values will pass:
+ $my_email = "waldo@gmail.com"
+ validate_email_address($my_email)
+ validate_email_address("bob@gmail.com", "alice@gmail.com", $my_email)
+
+ The following values will fail, causing compilation to abort:
+ $some_array = [ 'bad_email@/d/efdf.com' ]
+ validate_email_address($some_array)
+ DOC
+ ) do |args|
+ rescuable_exceptions = [ArgumentError]
+
+ if args.empty?
+ raise Puppet::ParseError, "validate_email_address(): wrong number of arguments (#{args.length}; must be > 0)"
+ end
+
+ args.each do |arg|
+ raise Puppet::ParseError, "#{arg.inspect} is not a string." unless arg.is_a?(String)
+
+ begin
+ raise Puppet::ParseError, "#{arg.inspect} is not a valid email address" unless function_is_email_address([arg])
+ rescue *rescuable_exceptions
+ raise Puppet::ParseError, "#{arg.inspect} is not a valid email address"
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb
new file mode 100644
index 0000000..0460cf3
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb
@@ -0,0 +1,36 @@
+#
+# validate_hash.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_hash, :doc => <<-'DOC') do |args|
+ Validate that all passed values are hash data structures. Abort catalog
+ compilation if any value fails this check.
+
+ The following values will pass:
+
+ $my_hash = { 'one' => 'two' }
+ validate_hash($my_hash)
+
+ The following values will fail, causing compilation to abort:
+
+ validate_hash(true)
+ validate_hash('some_string')
+ $undefined = undef
+ validate_hash($undefined)
+
+ DOC
+
+ function_deprecation([:validate_hash, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Hash. There is further documentation for validate_legacy function in the README.'])
+
+ if args.empty?
+ raise Puppet::ParseError, "validate_hash(): wrong number of arguments (#{args.length}; must be > 0)"
+ end
+
+ args.each do |arg|
+ unless arg.is_a?(Hash)
+ raise Puppet::ParseError, "#{arg.inspect} is not a Hash. It looks to be a #{arg.class}"
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_integer.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_integer.rb
new file mode 100644
index 0000000..fc50bdc
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_integer.rb
@@ -0,0 +1,137 @@
+#
+# validate_interger.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_integer, :doc => <<-'DOC') do |args|
+ Validate that the first argument is an integer (or an array of integers). Abort catalog compilation if any of the checks fail.
+
+ The second argument is optional and passes a maximum. (All elements of) the first argument has to be less or equal to this max.
+
+ The third argument is optional and passes a minimum. (All elements of) the first argument has to be greater or equal to this min.
+ If, and only if, a minimum is given, the second argument may be an empty string or undef, which will be handled to just check
+ if (all elements of) the first argument are greater or equal to the given minimum.
+
+ It will fail if the first argument is not an integer or array of integers, and if arg 2 and arg 3 are not convertable to an integer.
+
+ The following values will pass:
+
+ validate_integer(1)
+ validate_integer(1, 2)
+ validate_integer(1, 1)
+ validate_integer(1, 2, 0)
+ validate_integer(2, 2, 2)
+ validate_integer(2, '', 0)
+ validate_integer(2, undef, 0)
+ $foo = undef
+ validate_integer(2, $foo, 0)
+ validate_integer([1,2,3,4,5], 6)
+ validate_integer([1,2,3,4,5], 6, 0)
+
+ Plus all of the above, but any combination of values passed as strings ('1' or "1").
+ Plus all of the above, but with (correct) combinations of negative integer values.
+
+ The following values will not:
+
+ validate_integer(true)
+ validate_integer(false)
+ validate_integer(7.0)
+ validate_integer({ 1 => 2 })
+ $foo = undef
+ validate_integer($foo)
+ validate_integer($foobaridontexist)
+
+ validate_integer(1, 0)
+ validate_integer(1, true)
+ validate_integer(1, '')
+ validate_integer(1, undef)
+ validate_integer(1, , 0)
+ validate_integer(1, 2, 3)
+ validate_integer(1, 3, 2)
+ validate_integer(1, 3, true)
+
+ Plus all of the above, but any combination of values passed as strings ('false' or "false").
+ Plus all of the above, but with incorrect combinations of negative integer values.
+ Plus all of the above, but with non-integer items in arrays or maximum / minimum argument.
+
+ DOC
+
+ function_deprecation([:validate_integer, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Integer. There is further documentation for validate_legacy function in the README.'])
+
+ # tell the user we need at least one, and optionally up to two other parameters
+ raise Puppet::ParseError, "validate_integer(): Wrong number of arguments; must be 1, 2 or 3, got #{args.length}" unless !args.empty? && args.length < 4
+
+ input, max, min = *args
+
+ # check maximum parameter
+ if args.length > 1
+ max = max.to_s
+ # allow max to be empty (or undefined) if we have a minimum set
+ if args.length > 2 && max == ''
+ max = nil
+ else
+ begin
+ max = Integer(max)
+ rescue TypeError, ArgumentError
+ raise Puppet::ParseError, "validate_integer(): Expected second argument to be unset or an Integer, got #{max}:#{max.class}"
+ end
+ end
+ else
+ max = nil
+ end
+
+ # check minimum parameter
+ if args.length > 2
+ begin
+ min = Integer(min.to_s)
+ rescue TypeError, ArgumentError
+ raise Puppet::ParseError, "validate_integer(): Expected third argument to be unset or an Integer, got #{min}:#{min.class}"
+ end
+ else
+ min = nil
+ end
+
+ # ensure that min < max
+ if min && max && min > max
+ raise Puppet::ParseError, "validate_integer(): Expected second argument to be larger than third argument, got #{max} < #{min}"
+ end
+
+ # create lamba validator function
+ validator = ->(num) do
+ # check input < max
+ if max && num > max
+ raise Puppet::ParseError, "validate_integer(): Expected #{input.inspect} to be smaller or equal to #{max}, got #{input.inspect}."
+ end
+ # check input > min (this will only be checked if no exception has been raised before)
+ if min && num < min
+ raise Puppet::ParseError, "validate_integer(): Expected #{input.inspect} to be greater or equal to #{min}, got #{input.inspect}."
+ end
+ end
+
+ # if this is an array, handle it.
+ case input
+ when Array
+ # check every element of the array
+ input.each_with_index do |arg, pos|
+ begin
+ raise TypeError if arg.is_a?(Hash)
+ arg = Integer(arg.to_s)
+ validator.call(arg)
+ rescue TypeError, ArgumentError
+ raise Puppet::ParseError, "validate_integer(): Expected element at array position #{pos} to be an Integer, got #{arg.class}"
+ end
+ end
+ # for the sake of compatibility with ruby 1.8, we need extra handling of hashes
+ when Hash
+ raise Puppet::ParseError, "validate_integer(): Expected first argument to be an Integer or Array, got #{input.class}"
+ # check the input. this will also fail any stuff other than pure, shiny integers
+ else
+ begin
+ input = Integer(input.to_s)
+ validator.call(input)
+ rescue TypeError, ArgumentError
+ raise Puppet::ParseError, "validate_integer(): Expected first argument to be an Integer or Array, got #{input.class}"
+ end
+ end
+ end
+end
diff --git a/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_ip_address.rb b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_ip_address.rb
new file mode 100644
index 0000000..af835ad
--- /dev/null
+++ b/code/environments/production/modules/stdlib/lib/puppet/parser/functions/validate_ip_address.rb
@@ -0,0 +1,53 @@
+#
+# validate_ip_address.rb
+#
+module Puppet::Parser::Functions
+ newfunction(:validate_ip_address, :doc => <<-DOC
+ Validate that all values passed are valid IP addresses,
+ regardless they are IPv4 or IPv6
+ Fail compilation if any value fails this check.
+ The following values will pass:
+ $my_ip = "1.2.3.4"
+ validate_ip_address($my_ip)
+ validate_ip_address("8.8.8.8", "172.16.0.1", $my_ip)
+
+ $my_ip = "3ffe:505:2"
+ validate_ip_address(1)
+ validate_ip_address($my_ip)
+ validate_ip_address("fe80::baf6:b1ff:fe19:7507", $my_ip)
+
+ The following values will fail, causing compilation to abort:
+ $some_array = [ 1, true, false, "garbage string", "3ffe:505:2" ]
+ validate_ip_address($some_array)
+ DOC
+ ) do |args|
+
+ require 'ipaddr'
+ rescuable_exceptions = [ArgumentError]
+
+ function_deprecation([:validate_ip_address, 'This method is deprecated, please use the stdlib validate_legacy function,
+ with Stdlib::Compat::Ip_address. There is further documentation for validate_legacy function in the README.'])
+
+ if defined?(IPAddr::InvalidAddressError)
+ rescuable_exceptions << IPAddr::InvalidAddressError
+ end
+
+ if args.empty?
+ raise Puppet::ParseError, "validate_ip_address(): wrong number of arguments (#{args.length}; must be > 0)"
+ end
+
+ args.each do |arg|
+ unless arg.is_a?(String