summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
AgeCommit message (Collapse)Author
2015-08-27Adds a convert_base function, which can convert numbers between basesfhats
Squashed, improved docs, updated error handling and unit tests by David S.
2015-08-25[MODULES-2462] Improve parseyaml functionDmitry Ilyin
* Add default value support Second argument will be returned if yaml cannot be parsed instead of false value * Update tests
2015-08-24(MODULE-2456) Modify union to accept more than two arraysJetroid
Add spec tests to test the new functionality: *Case for 3 arrays. *Case for 4 arrays. Modify README to note new functionality. This is for issue MODULE-2456, follow the precedent of MODULE-444. This change allows union to be much more useful, unioning many arrays in one line rather than in n lines. Additionally, as this is only added functionality, and does not affect the 2 array case that all modules currently using array are using, it should not affect any existing modules utilizing union. This is now useful, for example, for merging many arrays of resources (eg: packages.) to generate just one list with no duplicates, to avoid duplicate resource declarations.
2015-08-14(MODULES-2410) Add new functions dos2unix and unix2dosNigel Gibbs
2015-07-31Merge pull request #483 from nibalizer/load_metadata_jsonHunter Haugen
Add load_metadata_json function
2015-07-30Add load_metadata_json functionSpencer Krum
This function loads the metadata.json into a puppet variable. This enables a number of neat things such as: * Which version of the module am I using? 2.x? 3.x? * Which author of the module am I using? puppetlabs? example42?
2015-07-30Remove colorful language from module.Zee Alexander
2015-07-22adding support for hash in the size functiongcmalloc
2015-07-20Fix documentation error in upcaseDan Offord
The documentation example shows an incorrect response when using the function, this PR corrects the example to agree with what the function actually does.
2015-07-09Merge pull request #482 from DavidS/document_validate_slength_3rd_argMorgan Haskel
Add validate_slength's optional 3rd arg to README
2015-07-09Add validate_slength's optional 3rd arg to READMEAlexander Fisher
2015-06-24catch and rescue from looking up non-existent facts when looking for 'kind'Mathias Klette
facter (2.x) only provides facts without interface suffix for * ipaddress * netmask 'macaddress' and 'network' facts will always have the related interface name appended. in turns lookupvar throws errors when strict_variables is enabled.
2015-06-05Also catch :undefined_variable as thrown by future parserTomas Doran
2015-06-04Fix time() on 1.8.7Hunter Haugen
The time() function takes an argument of a timezone, and always returns time in epoch format. The epoch format is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds. This means that it is universally the same regardless of timezones. I don't know what the timezone argument is supposed to do, and it is not documented. So lets just make 1.8.7 work like > 1.8.7
2015-06-01fqdn_rotate: Improve documentationEli Young
2015-06-01fqdn_rotate: Don't use the value itself as part of the random seedEli Young
Previously, the random number generator was seeded with the array or string to be rotated in addition to any values specifically provided for seeding. This behavior is potentially insecure in that it allows an attacker who can modify the source data to choose the post-shuffle order.
2015-06-01Convert tests to use plain rspec-puppetDavid Schmitt
Tests in the new style produces the following documentation output: abs should not eq nil should run abs() and raise an Puppet::ParseError should run abs(-34) and return 34 should run abs("-34") and return 34 should run abs(34) and return 34 should run abs("34") and return 34
2015-05-29simplify mac address regexIgor Galić
let the computer do the counting and repetition and case
2015-05-27validate_integer, validate_numeric: explicitely reject hashes in arraysDavid Schmitt
Without this patch, Ruby 1.8's Hash#to_s behaviour causes [{1=>2}] to be treated as "12" when validating values.
2015-05-26fqdn_rotate: reset srand seed correctly on old ruby versionsDavid Schmitt
Without this, the global seed is reseeded on every use of fqdn_rotate, which is a waste. Older rubies might even use a time-base seed which adversly impacts the quality of the RNG.
2015-05-06range(): fix TypeError(can't convert nil into Integer) when using range syntaxDavid Schmitt
2015-05-06Merge pull request #447 from elyscape/fix_rangeDavid Schmitt
Restore removed functionality to range()
2015-05-05range: Clean up and clarify function contentsEli Young
2015-05-05Revert "range: remove dead code"Eli Young
This reverts commit 063c58a992c1b5441b7e7b2a2e4886531035bb25, which actually removed non-dead code. Specifically, it removed the ability to make calls such as `range('2..3')`, `range('2...3')`, and `range('2-3')`. cf. https://github.com/puppetlabs/puppetlabs-stdlib/pull/443#commitcomment-11055565
2015-05-05pw_hash: Fix functionality on JRuby < 1.7.17Eli Young
The previous change to this function broke it on JRuby before 1.7.17 by attempting to use a variable that wasn't defined (`salt`). To fix this, define `salt` ahead of time and use that instead of building the salt later. cf. https://github.com/puppetlabs/puppetlabs-stdlib/pull/443#discussion_r29718588
2015-05-05validate_augeas: fix URL to docsDavid Schmitt
2015-05-05range: remove dead codeDavid Schmitt
Since a ParseError is always thrown for zero arguments, the if and all dependent code can be removed.
2015-05-05pw_hash: avoid ruby magic when running on javaDavid Schmitt
2015-04-17fqdn_rand_string: fix argument error messageDavid Schmitt
2015-04-16Merge pull request #314 from amateo/feature/loadyaml_check_fileMorgan Haskel
Check if file exists before loading with loadyaml. If not, return nil
2015-04-09Merge pull request #405 from elyscape/feature/fqdn_rand_stringsHunter Haugen
(MODULES-1715) Add FQDN-based random string generator
2015-04-05(MODULES-1737) Add pw_hash() functionEli Young
2015-03-31(MODULES-1715) Add fqdn_rand string generatorsEli Young
2015-03-05If present, top-level domain must be alphabeticRod Montgomery
See RFC 1123, Section 2.1 http://tools.ietf.org/html/rfc1123#section-2
2015-03-05Merge pull request #422 from cyberious/assert_privateTP Honey
Assert private
2015-03-05Add private function back and forward to assert_private with deprecation warningTravis Fields
2015-03-05Merge pull request #369 from rfugina/dirname_typecheckHunter Haugen
Dirname typecheck
2015-03-05Rename private() to assert_private()Franz Pletz
As mentioned in #270, private is a reserved keyword in the future parser which is to be released with Puppet 4. As it stands, this function is not useable with the future parser so it needs to renamed. This is a breaking change.
2015-03-05Merge pull request #375 from ↵Hunter Haugen
poikilotherm/feature/master/validate_integer_and_numeric (MODULES-560) Add new functions validate_numeric() and validate_integer().
2015-03-03Add support for hashes in the prefix functionStefan Goethals
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2015-03-03URI.escape for the array case was incorrect.Bryon Roché
The previous commit to uriescape() changed the implementation to use the ruby default escape list for URI.escape(), but did not change the call triggered when uriescape() was called on an array, triggering ruby errors.
2015-03-03Merge pull request #407 from adamcrews/ceiling_functionMorgan Haskel
Add a ceiling function to complement the floor function.
2015-03-02Loosen the restrictions of upcase and allow for recursion of the objects and ↵Travis Fields
only worry if the object responds to upcase
2015-02-26Fix issue with Ruby 1.8.7 which did not allow for the return in an each_pair ↵Travis Fields
of the hash
2015-02-25Add Hash to upcaseTravis Fields
2015-02-19Check for string before copyingMorgan Haskel
2015-02-14(MODULES-1771) Don't modify input to is_domain_name()Sean Millichamp
Fix is_domain_name() so it dup's its incoming argument to avoid changing the original with a later chomp!
2015-02-12(MODULES-1738) Don't modify global seed in fqdn_rotate()Eli Young
As per puppetlabs/puppet@292233c, this leaves the global seed in a deterministic state, which is bad. Puppet::Util.deterministic_rand() exists to avoid running into this issue, but is only present starting in Puppet 3.2.0.
2015-02-01Add a ceiling function to complement the floor function.Adam Crews
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.