summaryrefslogtreecommitdiff
path: root/spec/functions
AgeCommit message (Collapse)Author
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.
2016-05-12Merge pull request #600 from dmitryilyin/masterBryan Jen
Add the default value to the "loadyaml" function
2016-05-05Merge pull request #601 from petems/MODULES-1439-any2bool_addedBryan Jen
(MODULES-1439) Adds any2bool function
2016-05-04Use reject instead of delete_ifJoseph Yaworski
2016-05-03Merge pull request #603 from puppetlabs/4.12.xBryan Jen
Mergeback 4.12.x
2016-05-02(MODULES-1439) Adds any2bool functionPeter Souter
* Basically a combination of `string2bool` and `num2bool`
2016-04-28Expose the functions of ruby's built-in Shellwords module (#580)Joris
* Add shell_escape function, shell_join function & shell_split function
2016-04-26Add the default value to the "loadyaml" functionDmitry Ilyin
This value will be returned if the is no file to load or a file could not be parsed. It's similar to the "parseyaml" function's default value. Add the "loadjson" function too
2016-04-25Remove todo for delete() and update specHunter Haugen
This spec should verify that substring matches are not removed in the future
2016-04-25Revert "Add support for regular expressions to delete"Hunter Haugen
This reverts commit 0d46515b57cea60d4d5f1e4d81a75a448a7a73a8. It introduced backwards-incompatible functionality.
2016-04-12Add support for regular expressions to deleteJoseph Yaworski
2016-04-11Merge pull request #590 from alext/fix_concat_with_hashHunter Haugen
(MODULES-3246) Fix concat with Hash arguments.
2016-04-11Merge pull request #583 from jyaworski/validate_email_addressTP Honey
Add validate_email_address function
2016-04-10Add validate_email_address functionJoseph Yaworski
2016-04-08(MODULES-3246) Fix concat with Hash arguments.Alex Tomlins
85d5ead Updated the concat function so that it wouldn't modify the original array. A side-effect of this change is that it now always calls `Array()` on the second argument. If thit is a Hash, this results in `to_a` being called on the hash, which converts it to an array or tuples. This is undesired. Update the behaviour so that it doesn't (indirectly) call `to_a` on anything, instead test for the type of the argument, wrapping it in an array if it's not already an array.
2016-04-07(maint) remove failing testDavid Schmitt
This removes the failing test special casing for puppet 4.
2016-03-22improve suffix function to support the same feature set as prefixReinhard Vicinus
2016-02-18Extend Base64() function supportguessi
2016-02-16Add dig() functionMaksym Melnychok
Deprecates #try_get_value()
2016-01-16Add test for basename on path with schemeAlec Henninger
2016-01-08Merge pull request #552 from mattbostock/add_x509_rsa_key_pairDavid Schmitt
Add a function to validate an x509 RSA key pair
2016-01-08Change order of tests to be more logicalMatt Bostock
Put the tests using a valid certificate fixture together and put tests using a valid key fixture together.
2016-01-08Test certificate and key with a truncated middleMatt Bostock
Test a valid certificate and valid key that have had 48 characters removed from their middle, to simulate a malformed certificate and key. Suggested by @DavidS in https://github.com/puppetlabs/puppetlabs-stdlib/pull/552
2016-01-08Add a function to validate an x509 RSA key pairMatt Bostock
Add a function to validate an x509 RSA certificate and key pair, as commonly used for TLS certificates. The rationale behind this is that we store our TLS certificates and private keys in Hiera YAML files, and poor indentation or formatting in the YAML file could cause a valid certificate to be considered invalid. Will cause the Puppet run to fail if: - an invalid certificate is detected - an invalid RSA key is detected - the certificate does not match the key, i.e. the certificate has not been signed by the supplied key The test certificates I've used in the spec tests were generated using the Go standard library: $ go run $GOROOT/src/crypto/tls/generate_cert.go -host localhost Example output: ==> cache-1.router: Error: Not a valid RSA key: Neither PUB key nor PRIV key:: nested asn1 error at /var/govuk/puppet/modules/nginx/manifests/config/ssl.pp:30 on node cache-1.router.dev.gov.uk
2016-01-04Merge pull request #545 from mpolenchuk/masterDavid Schmitt
Add clamp function
2015-12-31Add clamp functionMichael Polenchuk
Clamp keeps value within the range. Employ of soft() makes the whole thing is independant of order.
2015-12-08(#2886) seeded_rand: new functionKjetil Torgrim Homme
seeded_rand is needed for repeatable randomness across nodes in a cluster
2015-11-30Add validator for any IP addressJaume Devesa
Provide a validator for IP addresses, regardless they are IPv4 or IPv6, and its documentation.
2015-10-16Merge pull request #538 from mmckinst/bool2str_enhanceDavid Schmitt
add functionality to bool2str function
2015-10-15add functionality to bool2str to return strings of your choice for a booleanMark McKinstry
2015-10-14Let load_module_metadata succeed on empty fileColleen Murphy
Some modules or module versions don't have a metadata.json file, but we might still want to use the load_module_metadata function on them. The lack of a file can still give us important information. For example, it might tell us that the version of the module installed is "very old" even if we can't read the version number directly. This patch adds a parameter to let the user specify if an empty file is acceptable. To preserve backwards compatibility it does not change the current default behavior, which is to raise an error if metadata.json does not exist.
2015-10-14Rename load_module_metadata test pathColleen Murphy
`rake spec` only finds test files that end in _spec.rb, so this test was not being run. Correct the path name so that the test runs properly.
2015-09-28Check for numeric values as empty fails on thoseRoman Mueller
2015-09-21Fix backwards compatibility from #511Morgan Haskel
Maintain the old behavior in the case where the optional second parameter isn't passed. Also, adding arity is backwards incompatible since stdlib still supports 2.7, so remove that.
2015-09-17(MAINT) validate_re: Clarify docs and error messageDavid Schmitt
2015-09-14Merge pull request #523 from DavidS/modules-2516-is_aBryan Jen
(MODULES-2561) add is_a function
2015-09-14Merge pull request #511 from dmitryilyin/parseyaml_defaultBryan Jen
[MODULES-2462] Improve parseyaml function
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-09-04accept any case of boolean stringsCorey Osman
* previously the str2bool function did not accept 'TRUE' as a bool type. This causes the function to now accept TRUE, FALSE strings as a boolean type in order to be converted to a proper boolean. * This would also cause Y,N, YES, NO to be accepted as boolean types as well.
2015-09-02Merge pull request #513 from dmitryilyin/fetchDavid Schmitt
Add a new function "try_get_value"
2015-09-01Add a new function "try_get_value"Dmitry Ilyin
* Extracts a value from a deeply-nested data structure * Returns default if a value could not be extracted
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(MAINT) improve base64 unit testsDavid Schmitt
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-22adding support for hash in the size functiongcmalloc