Bryan Jen [Wed, 16 Mar 2016 20:57:36 +0000 (13:57 -0700)]
(maint) Fixes fqdn_rand_string tests
Puppet 4.4.0 and later has changed fqdn_rand to use a higher ceiling
(PUP-5646), the tests for fqdn_rand_string needed to be updated to
reflect the new expected output.
Nikhil Yadav [Thu, 10 Mar 2016 05:03:35 +0000 (10:33 +0530)]
Add ensure_resources() function
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.
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.
Matt Bostock [Tue, 19 Jan 2016 16:22:01 +0000 (16:22 +0000)]
Fix reference to validate_bool in function
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.
Matt Bostock [Mon, 23 Nov 2015 23:45:23 +0000 (23:45 +0000)]
Add a function to validate an x509 RSA key pair
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
David Schmitt [Fri, 18 Dec 2015 17:38:04 +0000 (17:38 +0000)]
Allow package_provider fact to resolve on PE 3.x
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.
Matt Bostock [Mon, 23 Nov 2015 23:45:55 +0000 (23:45 +0000)]
Fix reference to validate_bool in IP4 function
The documentation in `validate_ipv4_address` references `validate_bool`,
but I believe this should read `validate_ipv4_address` instead, which
makes more sense.
Colleen Murphy [Wed, 14 Oct 2015 23:09:05 +0000 (16:09 -0700)]
Let load_module_metadata succeed on empty file
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.
Adam S [Sat, 26 Sep 2015 00:58:05 +0000 (17:58 -0700)]
fixup-PR#506 Speed improvements in facter resolution
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.
Adam S [Sat, 26 Sep 2015 00:55:21 +0000 (17:55 -0700)]
Add package_provider fact
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.
Morgan Haskel [Mon, 21 Sep 2015 17:56:08 +0000 (10:56 -0700)]
Fix backwards compatibility from #511
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.