Commit graph

1476 commits

Author SHA1 Message Date
Hunter Haugen
6248d241bc Merge pull request #582 from derekmceachern/bug/master/spec_test_typo
MODULES-3201 - Fixed typo 'absense' to 'absence'
2016-04-07 14:53:02 -07:00
TP Honey
0624c3f806 Merge pull request #589 from puppetlabs/modulesync-update
Multiple updates to stdlib and its testsuite
2016-04-07 16:01:25 +01:00
David Schmitt
5639828bff (maint) also catch Psych::SyntaxError
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-04-07 12:31:06 +01:00
David Schmitt
3860512d56 (maint) remove failing test
This removes the failing test special casing for puppet 4.
2016-04-07 12:31:06 +01:00
David Schmitt
27458aff98 (maint) Update to current modulesync_configs [953280c]
This removes much of the assorted cruft that accumulated in the
unmanaged files and moves the remaining necessary parts to
spec_helper_local.
2016-04-07 12:31:06 +01:00
Bryan Jen
c5486aba62 Merge pull request #586 from ffrank/dont_catch_exception
catch StandardError rather than the gratuitous Exception
2016-03-29 09:13:46 -07:00
Hunter Haugen
29961218a7 Merge pull request #587 from bmjen/4.12.0_prep
(FM-5000) Release prep for 4.12.0.
2016-03-28 17:46:45 -07:00
Bryan Jen
e6a3436fd0 (FM-5000) Release prep for 4.12.0. 2016-03-28 17:42:22 -07:00
Felix Frank
0cea94a82e catch StandardError rather than the gratuitous Exception 2016-03-29 01:59:54 +02:00
Johnson Earls
7e408ca797 [MODULES-2370] file_line.rb: Fix line attribute validation
`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-28 21:26:01 +00:00
Bryan Jen
b63849c786 Merge pull request #579 from sulaweyo/patch-2
Add check if Gem is defined
2016-03-28 11:44:00 -07:00
Derek McEachern
eca43f41cd Fixed typo 'absense' to 'absence' 2016-03-24 14:23:05 -05:00
Bryan Jen
db2a321434 Merge pull request #581 from vicinus/master
improve suffix function to support the same feature set as prefix
2016-03-23 08:24:37 -07:00
Reinhard Vicinus
85ff2a28a8 improve suffix function to support the same feature set as prefix 2016-03-22 16:24:09 +01:00
Hunter Haugen
b6383d259c Merge pull request #576 from yadavnikhil/master
ensure_packages.rb: Modifed to pass hiera parameters (as hash,array) as first argument
2016-03-17 09:25:38 -07:00
Sledge Sulaweyo
be6d4d2ffb Add check if Gem is defined
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-17 07:36:44 +01:00
Hunter Haugen
52f6af3acc Merge pull request #578 from bmjen/fqdn-rand-fix
(maint) Fixes fqdn_rand_string tests
2016-03-16 14:06:15 -07:00
Bryan Jen
7943b25ec1 (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.
2016-03-16 13:57:36 -07:00
Hunter Haugen
72f6e379a6 Merge pull request #577 from EmilienM/enclose_ipv6
Add enclose_ipv6 function
2016-03-15 16:48:50 -07:00
Nikhil Yadav
0da9ca7e4a 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.

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-15 09:29:38 +05:30
Emilien Macchi
0378336f9c Add enclose_ipv6 function
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-03-13 18:20:49 -04:00
Hunter Haugen
69ca8d09c6 Merge pull request #570 from gfidente/master
Add is_ipv4_address and is_ipv6_address functions
2016-02-18 10:32:25 -08:00
TP Honey
2c3beace24 Merge pull request #575 from guessi/extend_base64_function_support
Extend Base64() function support
2016-02-18 15:47:04 +00:00
guessi
dc64e721ee Extend Base64() function support 2016-02-18 23:38:19 +08:00
Hunter Haugen
e2206fd153 Merge pull request #573 from Yelp/pl-dig
Add dig function
2016-02-16 12:26:51 -08:00
TP Honey
c83a70e674 Merge pull request #574 from DavidS/fm-4046-update-msync
(FM-4046) Update to current msync configs [006831f]
2016-02-16 18:53:34 +00:00
David Schmitt
8f037d23b2 (FM-4046) Update to current msync configs [006831f]
This moves all copyright statements to the NOTICE file in accordance with the ASFs guidelines on applying the Apache-2.0 license.
2016-02-16 16:33:53 +00:00
Maksym Melnychok
3169a43f4c Add dig() function
Deprecates #try_get_value()
2016-02-16 00:51:28 -08:00
Hunter Haugen
990e1d7575 Merge pull request #569 from DavidS/fm-4049-update-msync
(FM-4049) update to modulesync_configs
2016-01-27 08:36:03 -08:00
David Schmitt
7ff944daa0 (FM-4049) Update to current msync configs [2c99161] 2016-01-27 14:48:13 +00:00
Giulio Fidente
d85aec41a3 Add is_ipv4_address and is_ipv6_address functions
These are useful when making decisions based on the type of IP
address received.
2016-01-22 18:01:49 +01:00
JT (Jonny)
2a510169d6 Merge pull request #568 from mattbostock/fix_docs
Fix reference to validate_bool in function
2016-01-20 15:35:00 +00:00
Matt Bostock
b7df76cf7a 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.
2016-01-19 16:22:01 +00:00
David Schmitt
e5be901e0e Merge pull request #567 from alechenninger/add-test-for-basename-with-scheme
Add test for basename on path with scheme
2016-01-18 09:23:51 +00:00
Alec Henninger
1659d478b9 Add test for basename on path with scheme 2016-01-16 11:55:25 -05:00
David Schmitt
4eba9364f1 Merge pull request #566 from puppetlabs/4.11.x
4.11.0 merge back
2016-01-12 14:41:49 +00:00
David Schmitt
f875770245 Merge pull request #552 from mattbostock/add_x509_rsa_key_pair
Add a function to validate an x509 RSA key pair
2016-01-08 11:13:16 +00:00
Matt Bostock
41f9319bbd Change order of tests to be more logical
Put the tests using a valid certificate fixture together and put tests
using a valid key fixture together.
2016-01-08 11:09:45 +00:00
Matt Bostock
4acba73b00 Test certificate and key with a truncated middle
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-08 11:09:45 +00:00
Matt Bostock
97320ab421 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
2016-01-08 11:09:45 +00:00
David Schmitt
fdf3f22e24 Merge pull request #565 from tphoney/4.11.0_tweak
minor tweak to 4.11.0 adding debian 8 to metadata
2016-01-07 11:15:39 +00:00
tphoney
33b79f3497 minor tweak to 4.11.0 adding debian 8 to metadata 2016-01-07 10:54:48 +00:00
David Schmitt
9cce93054a Merge pull request #545 from mpolenchuk/master
Add clamp function
2016-01-04 15:35:42 +00:00
Jesse Lovelace
39644a69af Merge pull request #564 from tphoney/4.11.0_prep
4.11.0 prep
2015-12-31 11:34:44 -05:00
Michael Polenchuk
27782242bc Add clamp function
Clamp keeps value within the range.
Employ of soft() makes the whole thing is independant of order.
2015-12-31 12:46:07 +03:00
tphoney
00973036b2 4.11.0 prep 2015-12-30 13:45:05 +00:00
Bryan Jen
0073c6d8de Merge pull request #553 from logicminds/absolute_path
adds new parser called is_absolute_path
2015-12-21 17:41:55 -07:00
TP Honey
1c6ae4793f Merge pull request #561 from DavidS/fix-package_provider
Allow package_provider fact to resolve on PE 3.x
2015-12-21 16:54:20 +00:00
David Schmitt
35b5d6bcc1 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.

Original-fix-by: Alex Harden <aharden@gmail.com>
2015-12-18 17:38:04 +00:00
TP Honey
8ea26c4c45 Merge pull request #559 from DavidS/fm-3802-fix-ensure_resource-test
(FM-3802) make ensure_resource test of packages
2015-12-17 13:59:52 +00:00