summaryrefslogtreecommitdiff
path: root/lib/puppet/functions
AgeCommit message (Collapse)Author
2017-07-03Revert "Allow use of fact() on other hashes"Reid Vandewiele
This reverts commit 409a974095a3f5b637e091494b5d14b451c5de78. After thinking about this, use case, and function naming, I think it's probably best for now to keep things simple and let `fact()` be single-purpose for looking up facts with no potentially confusing extensions. The only use case where the name makes sense is where it's being used on the `$facts` hash, and I think we'd rather in that circumstance promote the raw use of `fact()`.
2017-06-30(FACT-932) Allow use of fact() on other hashesReid Vandewiele
Because sometimes people want to use an alternative data set, but treat it like it's a set of facts.
2017-06-30(FACT-932) Add new function, fact()Reid Vandewiele
The fact() function allows dot-notation reference to facts. It is an alternative to using $facts directly with array-indexing. Array-indexing is often onerous to use since it doesn't align with how structured facts are accessed elsewhere in the ecosystem and if any element in a multi-step path doesn't exist, array indexing can cause a compilation failure. Example usage: fact('os.family')
2017-03-14Addition of new length functionHelen Campbell
2016-12-01Indicate that the type function is preferred (#695)Nick Walker
Prior to this commit, users coming to the type_of function would not realize that the type function in puppet does the same thing and is preferred over type_of. After this commit, we have a comment indicating the above.
2016-11-24Deprecation - Use puppet stacktrace if availableHelen Campbell
A previous PR (#685) was raised on this issue, however once it was merged it was discovered that Puppet 3 with future parser enabled was calling the Puppet 4 version of the deprecation function. The Puppet stacktrace is not available until Puppet 4.6, so this was breaking existing setups. The solution was to check is the stacktrace was defined, and if it was to use it as part of the message output.
2016-11-21Revert "Call site output for deprecation warnings"Bryan Jen
2016-11-21Call site display for deprecation warningsHelen Campbell
2016-10-12(MODULES-3962) Rework v4 function shims to work on puppet 3.7 and 4.0.0David Schmitt
This is a workaround for PUP-4438 (fixed in https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08, 4.1.0, 3.8.1). It works by manually passing through the scope, instead of relying on the InternalFunction class.
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-09Update deprecation() so warnings can be disabled for CIDavid Schmitt
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-07(Maint) add missing validate_slength deprecationDavid Schmitt
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-03Addition of Puppet 4 functionsHelen Campbell
2016-09-21Revert "Ensure validate functions use Puppet 4 deprecation"Helen
2016-09-21Ensure validate functions use Puppet 4 deprecationHelen Campbell
2016-09-07(MODULES-3737) validate_legacy: refactoringDavid Schmitt
* validate_legacy now accepts undef values * update the TypeMismatch message to include the original validate function name * only notice, not warn, on newly allowed values * changed previous_validation to function_name to avoid confusion with the function of the same name * use deprecation() instead of warn(), when hitting a deprecated value * prepare the tests and function for MODULES-3735 * rewrite validate_legacy tests to use new rspec-puppet * move validate_re deprecation to puppet4 only * adapt validate_re_spec
2016-09-06Addition of logging with file and line numbersHelen Campbell
2016-09-05Deprecation function to be mutable in all casesHelen Campbell
2016-08-11(WIP) Addition of validate legacy functionHelen Campbell
2016-07-18(MODULES-3529)add deprecation functiontphoney
2015-09-14(MODULES-2516) Adds an is_a() functionDavid Schmitt
The data type system is very hard to understand. Many people don't understand why type_of([1,2,3]) == Array will fail, but type_of([1,2,3]) <= Array passes. This does a simpler validation that doesn't rely on explicit data types. Instead, use $foo = [1,2,3] if $foo.is_a(Array) { notify { 'This is an array': } } This is based on code by Ben Ford <ben.ford@puppetlabs.com>. * Added acceptance tests * Added dispatch * Improved unit tests * Added docs to README
2015-01-07(MODULES-1473) Deprecate type() function for new parserHunter Haugen
The `type()` function will cease to work on the new parser because 'type' is a reserved keyword. The `type3x()` function may be used to continue similar functionality, but will be deprecated in favor of the built-in typing system. The `type_of()` function has been included to introspect types in the new parser.