summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
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-25Revert "Add support for regular expressions to delete"Hunter Haugen
This reverts commit 0d46515b57cea60d4d5f1e4d81a75a448a7a73a8. It introduced backwards-incompatible functionality.
2016-04-18(MODULES-3271) Ensure that is_email_address works on unsupported rubiesDavid Schmitt
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-07Merge pull request #585 from ↵Hunter Haugen
jearls/MODULES-2370-update-validate-to-not-require-line-when-matching-for-absence [MODULES-2370] file_line.rb: Fix `line` attribute validation
2016-04-07(maint) also catch Psych::SyntaxErrorDavid Schmitt
Psych::SyntaxError is a RuntimeException. This still needs to catch that. This was uncovered by the recent move to catch StandardError rather than the catchall Exception that was here before.
2016-03-29catch StandardError rather than the gratuitous ExceptionFelix Frank
2016-03-28[MODULES-2370] file_line.rb: Fix `line` attribute validationJohnson Earls
`file_line` type: During validation, do not require `line` attribute if: * `ensure` is `absent`, * `match` is not empty, * and `match_for_absence` is `true`. Also update `spec` tests to reflect this.
2016-03-28Merge pull request #579 from sulaweyo/patch-2Bryan Jen
Add check if Gem is defined
2016-03-22improve suffix function to support the same feature set as prefixReinhard Vicinus
2016-03-17Merge pull request #576 from yadavnikhil/masterHunter Haugen
ensure_packages.rb: Modifed to pass hiera parameters (as hash,array) as first argument
2016-03-17Add check if Gem is definedSledge Sulaweyo
On e.g. Ubuntu 12.04 LTS Gem is not there by default so i added a check to not fail in that fact if this is the case.
2016-03-15Add ensure_resources() functionNikhil Yadav
New function "ensure_resources()" to support passing hash as parameter OR from hiera backend This new function is extension of ensure_resource() which will now support to pass multiple values as hash/array OR from hiera backend variables in title argument with additional parameters needed. It will process multiple values for a resource type from the passed argument & pass each entry (type, title, params) to ensure_resource() in required format for further processing. Now user can have duplicate resource check functionality extended to multiple entries with this new function. Use: For multiple resources using hash: 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'}) ensure_packages() Modified to also support Hash type argument for packages This modification will call newly added ensure_resources() for processing Hash as second argument. The original functionality remains same for Array type arguments. Use: hiera: packagelist: ksh: ensure: latest mlocate: {} myrpm: provider: rpm source: "/tmp/myrpm-1.0.0.x86_64.rpm" install_options: --prefix: /users/home openssl: provider: rpm source: "/tmp/openssl-1.0.1e-42.el7.x86_64.rpm" Call: ensure_packages($packagelist)
2016-03-13Add enclose_ipv6 functionEmilien Macchi
Copy a function from puppetlabs/apache, created by Benedikt Bock by 55cc3b4e8f4bc859a1255cb57be2c7923005d822 . This function enclose IPv6 addresses in square brackets. It takes an array of ip addresses and encloses the ipv6 addresses with square brackets. Co-Authored-By: Benedikt Bock <benedikt_bock@web.de>
2016-02-18Merge pull request #570 from gfidente/masterHunter Haugen
Add is_ipv4_address and is_ipv6_address functions
2016-02-18Extend Base64() function supportguessi
2016-02-16Add dig() functionMaksym Melnychok
Deprecates #try_get_value()
2016-01-22Add is_ipv4_address and is_ipv6_address functionsGiulio Fidente
These are useful when making decisions based on the type of IP address received.
2016-01-19Fix reference to validate_bool in functionMatt Bostock
The documentation in `validate_ip_address` references `validate_bool`, but I believe this should read `validate_ip_address` instead, which makes more sense. Looks like this was copied from `validate_ipv4_address`, which I fixed in 7b068781.
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-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-21Merge pull request #553 from logicminds/absolute_pathBryan Jen
adds new parser called is_absolute_path
2015-12-18Allow package_provider fact to resolve on PE 3.xDavid Schmitt
PE 3.x emits a puppetversion fact in the format "3.x.x (Puppet Enterprise 3.x.x)". This fact causes an error when invoked on PE 3.x: Could not retrieve fact='package_provider', resolution='<anonymous>': Malformed version number string 3.8.1 (Puppet Enterprise 3.8.1 This fix has been tested on PE 3.8.2 and should work for PE 3.3, 3.7, and 3.8. Original-fix-by: Alex Harden <aharden@gmail.com>
2015-12-15refactors the validate_absolute_path to utilize the is_absolute_pathCorey Osman
2015-12-15adds new parser called is_absolute_pathCorey Osman
* is_absolute_path returns boolean true if the given path is absolute, returns false otherwise. * works for windows and unix
2015-12-08(#2886) seeded_rand: new functionKjetil Torgrim Homme
seeded_rand is needed for repeatable randomness across nodes in a cluster
2015-11-30Merge pull request #546 from jdevesa/validate_ipBryan Jen
Add validator for any IP address
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-11-23Fix reference to validate_bool in IP4 functionMatt Bostock
The documentation in `validate_ipv4_address` references `validate_bool`, but I believe this should read `validate_ipv4_address` instead, which makes more sense.
2015-11-19(FM-3773) Fix root_home fact on AIX 5.xReid Vandewiele
The -C (capital C) flag to lsuser is incorrect. It should be -c (lowercase). this commit updates the aix root_home fact to use `lsuser -c`, rather than `lsuser -C`.
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-15Add check to ensure regex does not throw for none type.Jesse Lovelace
Add a quick check to ensure puppetversion value is not nil and supporting test.
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-13(MODULES-2421) improve description of file_lineDavid Schmitt
This mostly needed extraction of the existing doc strings from the type.
2015-10-13prevent deprecation warning about the allow_virtual parameterMartin Pfeifer
2015-10-01Merge pull request #534 from asasfu/feature/package_provider_factBryan Jen
Add package_provider fact
2015-09-28Check for numeric values as empty fails on thoseRoman Mueller
2015-09-25fixup-PR#506 Speed improvements in facter resolutionAdam S
This is to improve speed on Facter resolution of service_provider fact that was just introduced in PR# 506. The improvements go from 280ms resolution time approx. down to 2ms resolution time approx. by adding requires statements.
2015-09-25Add package_provider factAdam S
This adds a package_provider fact for situations where we need to be able to know the client's package provider in a simple way. Situations such as: package { 'name': install_options => [] } As those tend to be package provider specific options.
2015-09-24Merge pull request #506 from binford2k/feature/service_provider_factHunter Haugen
Add a service_provider fact
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-14Clarify what an empty intersection looks like.Ben Ford