summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
AgeCommit message (Collapse)Author
2017-05-09Fix issue where the following causes obscure catalog compilation errors:Alex Dacre
``` file { '/tmp/somefile': ensure => 'file', } File['/tmp/somefile'] -> Package <| |> ensure_packages($somearray) ``` If $somearray is undefined or one of the elements contains an empty string, an error like the following is thrown: Could not find resource 'Package[]' for relationship from 'File[/tmp/somefile]' on node $::fqdn
2017-05-09(PE-20308) Also fix defined type strings & referencesHunter Haugen
2017-04-26(PE-20308) Correct boundary for 4.5 vs 4.6Hunter Haugen
2017-04-25(PE-20308) Pass a literal type and not a string to findresourceHunter Haugen
- `defined_with_params` calls `findresource(reference.to_s)` - `findresource` is https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/parser/compiler.rb#L407 and points to https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L352 - This calls `Puppet::Resource.new` with the type https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L366 - This ends up calling `resource_type` via https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L317-L319 and that ends up declaring the type via the autoloader api at https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L390 - But why does the autoloader API fail to find it in the current environment? - Okay, so when the autoloader is trying to find the type, it uses the typeloader to look it up in the current environment https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/metatype/manager.rb#L171 - this calls `get_file` and `mark_loaded` https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/util/autoload.rb#L64-L67 Suggested workaround is to pass a literal type instead of a string to `findresource` to fix in stdlib, and also to fix loading/requiring of type in core puppet. This seems to affect more recent versions of puppet, so fallback to original behavior on pre-4.5
2017-03-21Merge pull request #718 from sspreitzer/master_globWilson McCoubrey
Add glob function
2017-03-15(FM-6051) Adds comments to warn for UTF8 incompatibilityHelen Campbell
2017-03-14Merge pull request #736 from HelenCampbell/lengthfunctDavid Schmitt
Addition of new length function
2017-03-14Addition of new length functionHelen Campbell
2017-03-13Merge pull request #729 from eputnam/i18n_prepGlenn Sarti
(MODULES-4473) join strings for i18n parser
2017-03-10Should only try to aplpy the resource if it not definedmbakerbp
2017-03-01(MODULES-4473) join strings for i18n parserEric Putnam
This commit joins all strings that are split over two lines with a plus, backslash, or double less than so that our magical i18n parser can wave over the module and mark every ruby string with our i18n function.
2017-02-05Add glob functionSascha Spreitzer
2016-12-15Merge pull request #640 from hunner/add_pryBryan Jen
Add pry() function from hunner-pry
2016-12-13Merge pull request #700 from petems/MODULES-4188-uuid_functionBryan Jen
(MODULES-4188) Add UUID generation function
2016-12-09(MODULES-3829) Make ensure_packages work with < 2.0Hailee Kenney
Prior to this commit, if a hash was passed in as an argument to the ensure_packages function a method of hash duplication would be used that is not supported with versions of ruby older than 2.0. In order to ensure the method is compatible with older ruby versions, switch to a different method of duplication. Additionally add tests to prevent further regressions.
2016-12-09(MODULES-4188) Add FQDN UUID generation functionPeter Souter
* Generates UUID based on a given FQDN string and the DNS namespace (6ba7b810-9dad-11d1-80b4-00c04fd430c8)
2016-12-08Add pry() function from hunner-pryHunter Haugen
2016-11-27Remove rvalue declaration from v3 deprecation() functionDavid Schmitt
Without this, some uses of this function do not work in puppet3. e.g. if $include_src != undef { deprecation('apt $include_src', "please use \$include => { 'src' => ${include_src} } instead") } causes Function 'deprecation' must be the value of a statement on puppet 3.8.7.
2016-11-10Merge pull request #632 from MiamiOH/masterWilson McCoubrey
Handle array values in join_keys_to_values function
2016-11-08(MODULES-3829) Use .dup to duplicate classes for modification.Simon Beirnaert
This function otherwise fails during `puppet preview` on Puppet 3.8.X systems.
2016-10-12(MODULES-3969) Update getvar to work on ruby 1.8.7David Schmitt
2016-10-12(MODULES-3961) emit more deprecation warningsDavid Schmitt
This now emits one deprecation warning for each function used (but not for each call-site). Prior to this, only a single deprecation warning would have been triggered, potentially misleading users. Additionally this adds v4 deprecation stubs for the functions that were missed.
2016-10-08Revert "Addition of logging with file and line numbers"David Schmitt
This reverts commit b63862ff43194194f7428739a32cfe13bad1e7ed, as it would only show the irrelevant first entry of the ruby stack trace. The puppetserver log does contain the full trace information, or you can use --strict=error to cause a hard failure when hitting a deprecation. # Conflicts: # lib/puppet/functions/validate_legacy.rb
2016-10-08Ignore :undefined_variable "reason" in getvarMaksym Melnychok
`catch` returns value of second argument to `throw`, which until 860a2761f334c964068038b3ef6853f08beb1df5 was `nil`, but now is non-falsey reason for error. short-circuit using return and eval to nil if `throw` was caught.
2016-10-07(FM-5703, PUP-6717) Remove the dynamic deprecation_genDavid Schmitt
This was not working when the puppet master did not have the newest stdlib version in its environment.
2016-10-04(MODULES-3933) Fix getparam for 'false' valuesDavid Schmitt
This is the idiomatic version of #634, and also addresses the test failures. Original-Fix-By: Michiel Brandenburg <michiel@silverstreet.com>
2016-10-04Permit undef passed as `nil` to validate_stringDominic Cleal
When validate_string is called via the Puppet 4 deprecation wrappers from deprecation_gen (introduced in 970852d), `undef` is passed as `nil` where it was previously passed as `''` from the Puppet 3-style function API. This change explicitly permits a `nil` value in validate_string, and adds a test case to `is_string` which also accepts the same. Fixes test failures in apt, concat etc: Error while evaluating a Function Call, nil is not a string. It looks to be a NilClass at apt/manifests/source.pp:23:3 [..] # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:34:in `block (2 levels) in <module:Functions>' # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `each' # ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `block in <module:Functions>' # puppet-4.7.0/lib/puppet/parser/functions.rb:174:in `block (2 levels) in newfunction' # puppet-4.7.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile' # puppet-4.7.0/lib/puppet/util/profiler.rb:51:in `profile' # puppet-4.7.0/lib/puppet/parser/functions.rb:167:in `block in newfunction' # ./spec/fixtures/modules/stdlib/lib/puppet_x/puppetlabs/stdlib/deprecation_gen.rb:13:in `block (2 levels) in deprecation_gen'
2016-09-26Remove duplicate deprecation warningsHelen Campbell
2016-09-26Merge pull request #656 from HelenCampbell/hashFupdateHunter Haugen
Add deprecation warnings to remaining validates
2016-09-26Add deprecation warnings to remaining validatesHelen Campbell
2016-09-15Fix whitespaceHunter Haugen
2016-09-15Merge pull request #644 from dmitryilyin/masterBryan Jen
Refactor dig44 function
2016-09-06Addition of logging with file and line numbersHelen Campbell
2016-09-05Deprecation function to be mutable in all casesHelen Campbell
2016-08-30Refactor dig44 functionDmitry Ilyin
The current implementation of the dig44 function has the following problems: * Doesn't recognise Puppet4's :undef value as an empty value and doesn't return the default value. * Doesn't make a different between false and nil value and returns the default value for a non-empty false value
2016-08-17Merge pull request #637 from HelenCampbell/ipdeprecationDavid Schmitt
(MODULES-3534) Deprecation of ip functions
2016-08-17Deprecation of ip functionsHelen Campbell
2016-08-15(maint) Switch 3.x deprecation() to use Puppet warning loggerDominic Cleal
The deprecation function was calling the `Kernel#warn` function which prints to stderr, rather than the Puppet logger. This causes problems for Puppet module tests on Travis CI, which has a cap on the amount of stdout/err permitted in its logs and also prevents users from finding the deprecation warnings when running under a Puppet master.
2016-08-08(modules-3532) deprecate string type checkstphoney
2016-08-08Merge pull request #629 from tphoney/MODULES-3533David Schmitt
(modules-3533) deprecation for 3.x number function
2016-08-08(modules-3533) deprecation for 3.x number functiontphoney
2016-08-05Handle array values in join_keys_to_values functionChris Edester
2016-07-27Fix str2bool error messageLoic Antoine-Gombeaud
2016-07-22Added the regexpescape function.Steve Moore
2016-07-19(MODULES-2143) document edge behaviour of range.tphoney
2016-07-13Merge pull request #618 from ntpttr/fix/master/modules-3568David Schmitt
(MODULES-3568) Move dig to dig44 and deprecate dig
2016-07-08(MODULES-3568) Move dig to dig44 and deprecate digNate Potter
A new version of dig was introduced in Puppet 4.5.0 that isn't compatible with the stdlib version of dig. To maintain backwards compatibility and ensure that tests for stdlib aren't broken, this patch renames dig to dig44 and adds a deprecation warning to the stdlib dig function.
2016-06-30(MODULES-3543) Fixup defined_with_params to work on all puppet versionsDavid Schmitt
2016-06-29(MODULES-3543) Fix define_with_params to handle undef properlyDavid Schmitt
As described in PUP-6422, ensure_resources('File[/tmp/a]', { owner => undef }) would not actually create the file. This fixes it, and adds tests to prove it.
2016-05-13Add a delete_regex functionJoseph Yaworski
To maintain backwards compatibility, add a delete_regex function instead of modifying delete itself.