Commit graph

437 commits

Author SHA1 Message Date
Jetroid
1d9189d860 (MODULE-2456) Modify union to accept more than two arrays
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-24 14:24:10 +01:00
Nigel Gibbs
4cbe846750 (MODULES-2410) Add new functions dos2unix and unix2dos 2015-08-14 13:30:01 +01:00
Bryan Jen
e84090df1d Merge pull request #499 from jearls/2370-use-match-for-ensure-absent
[MODULES-2370] allow `match` parameter to influence `ensure => absent` behavior.
2015-08-13 10:14:13 -07:00
Hunter Haugen
57275061ab Add puppet_version back to spec_helper 2015-08-11 19:52:43 -07:00
Hunter Haugen
9baca7f755 Sometimes this exits 1 2015-08-11 16:23:06 -07:00
Hunter Haugen
0a58b9382c Fix extraneous end 2015-08-11 08:29:48 -07:00
Hunter Haugen
dfa98b89f7 Prep 4.8.0 2015-08-10 16:30:27 -07:00
Johnson Earls
9bacf14ca2 allow match parameter to influence ensure => absent behavior.
Split the `destroy` method of the file_type::ruby provider into two
private methods:  `handle_destroy_line` which is the same as the previous
`destroy` method, and `handle_destroy_with_match` which will destroy any
line which matches the `match` parameter, raising an error if multiple
lines match and the `multiple` parameter is not `true`.  This new
behavior is only used if the new boolean parameter `match_for_absence`
is `true` (it defaults to `false`).
2015-08-06 13:44:32 -07:00
Dominic Cleal
a7adcda803 (MODULES-2316) Change file_type boolean parameter to symbols
Puppet's boolean parameter type is only available in Puppet 3.3 and
higher, so change file_type's new "replace" parameter to a regular
parameter with true and false as possible values.  This matches the
existing "multiple" parameter.
2015-08-04 09:59:53 +01:00
Hunter Haugen
e815da5962 Merge pull request #483 from nibalizer/load_metadata_json
Add load_metadata_json function
2015-07-31 14:12:56 -07:00
Spencer Krum
f411ee7119 Add load_metadata_json function
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-30 15:51:54 -07:00
Bryan Jen
ebf73482e5 Merge pull request #494 from CENGN/fix/master/file_line_replace
[#puppethack] Adding replace attribute to file_line
2015-07-30 13:34:26 -07:00
Bryan Jen
41a7297cb7 Merge pull request #495 from puppetlabs/4.7.x
4.7.x
2015-07-30 13:33:44 -07:00
Raymond Maika
35e92645f7 (MODULES-2024) Adding replace attribute to file_line 2015-07-30 14:55:32 -04:00
David Schmitt
44c4bad392 (maint) use puppet's utility function instead of API that's not available on all rubies 2015-07-30 10:46:38 +01:00
David Schmitt
a8d7563a44 (main) clean up fqdn_rand acceptance tests to work on windows 2015-07-22 17:30:39 +01:00
David Schmitt
24b1cd78db (maint) Remove failing acceptance test for ensure_packages
This only duplicates what's already being tested in ensure_packages_spec.rb
but doesn't work on all our supported platforms.
2015-07-22 12:21:31 +01:00
gcmalloc
5c79107863 adding support for hash in the size function 2015-07-22 12:11:52 +02:00
Hunter Haugen
615227918a disable pw_hash test on sles, as it only supports md5 2015-07-21 14:43:34 -07:00
Travis Fields
78e8c73671 (maint) Fix test to not assume is_pe fact on > 4.0.0 puppet 2015-07-20 15:51:39 -07:00
Morgan Haskel
224b644003 Use puppet_install_helper 2015-07-09 17:11:10 -07:00
Alexander Fisher
c64ecfb0c3 Add validate_slength's optional 3rd arg to README 2015-07-09 18:13:19 +01:00
Morgan Haskel
5381dbd4b4 AIO uses puppet 4 so should return true for is_future_parser_enabled 2015-06-19 14:29:42 -07:00
David Schmitt
c9e093f8d3 (maint) getvar: update spec to match implementation 2015-06-12 14:42:09 +01:00
Justin Stoller
a41cfbd043 (maint) update PUPPET_VERSION default to be 3.8.1 2015-06-08 21:43:36 -07:00
Morgan Haskel
c69b75f88b Merge pull request #469 from hunner/fix_time
Fix time() on 1.8.7
2015-06-04 10:51:41 -07:00
Hunter Haugen
ad4ca4cc34 Fix time() on 1.8.7
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-04 09:40:52 -07:00
Eli Young
98c2f283b0 fqdn_rand_string: Add acceptance tests for custom charsets 2015-06-02 12:02:30 -07:00
Eli Young
84279e90ab fqdn_rotate: Add acceptance tests for custom seeds 2015-06-02 12:02:30 -07:00
Eli Young
b436216fe6 fqdn_rotate: Add tests for custom seeds 2015-06-01 17:03:42 -07:00
Eli Young
601f681787 fqdn_rotate: Don't use the value itself as part of the random seed
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-01 16:19:07 -07:00
David Schmitt
18d4c21418 Remove unused puppet_spec code
This is copied and changed code from an older version of puppet's internal
test setup code. It does not work with puppet4.
2015-06-01 18:02:22 +01:00
David Schmitt
f3e79ddcd5 Convert tests to use plain rspec-puppet
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-06-01 18:02:22 +01:00
David Schmitt
b62dff0c6e spec_helper: implement an easy way for specs to confine to puppet version
Usage:

    describe 'puppet3 behaviour', :unless => RSpec.configuration.puppet_future do
    describe 'puppet4 behaviour', :if => RSpec.configuration.puppet_future do
2015-06-01 12:21:59 +01:00
David Schmitt
78bd9c8cbe Add the missing symlinks to get puppet 4 pickup the functions from the environmentpath 2015-06-01 12:21:59 +01:00
David Schmitt
65b56c711d Workaround the broken rspec-mocks support in rspec-puppet 2015-06-01 12:21:59 +01:00
David Schmitt
4a8c0a57f2 Merge pull request #463 from CENGN/fix/master/file_line_multiple_after
(MODULES-2071) Patch file_line provider to use multiple with after
2015-05-29 10:21:41 +01:00
Raymond Maika
72089f3d13 (MODULES-2071) Refactor file_line provider to contain logic to handle parameter multiple in function handle_create_with_after
Without this, file_line resource without the `match` parameter but with the `after` param will throw an error if there are multiple matches for the after expression. This patch creates the handling for the `multiple` parameter in handle_create_with_after. This allows you to add a line after the `after` expression if it appears at multiple points in a file.

Updated reference to `file_line` in the README to reflect that the multiple parameter can be set when using `after` and/or `match` as the matching regex.
2015-05-29 00:30:44 -04:00
David Schmitt
cf9f7a6b7e validate_integer, validate_numeric: explicitely reject hashes in arrays
Without this patch, Ruby 1.8's Hash#to_s behaviour causes [{1=>2}] to be
treated as "12" when validating values.
2015-05-27 20:05:05 +01:00
Hunter Haugen
732f7e8b35 Remove all the pops stuff
The rspec-puppet matchers don't allow to check the return types, but
this is a pretty rare thing to need to do anyway, so probably not worth
patching rspec-puppet
2015-05-12 15:03:27 -07:00
David Schmitt
f49eb6b8e2 range(): fix TypeError(can't convert nil into Integer) when using range syntax 2015-05-06 10:13:27 +01:00
David Schmitt
6a0a6153d5 spec_helper: Remove unneccesary stubbing
This only roots all Facter instances into memory, while something already
creates a new Facter instance each run.
2015-05-05 13:30:57 +01:00
David Schmitt
24680aceec spec_helper: use proper mocha import to avoid warning 2015-05-05 13:30:54 +01:00
David Schmitt
29f09e2181 spec_helper: set parser config if requested 2015-05-05 13:27:46 +01:00
David Schmitt
c0cf14e774 spec_helper_acceptance: fix FUTURE_PARSER usage
Use the more common "yes", instead of "true" to detect FUTURE_PARSER.
2015-05-05 13:27:46 +01:00
David Schmitt
a3016c45c5 specs: move function specs to where rspec-puppet expects them 2015-05-05 13:27:46 +01:00
David Schmitt
b664fec30f specs: loosen certain error expectations to make tests pass on future parser 2015-04-23 16:40:53 -07:00
Morgan Haskel
8a1d1e2f34 Merge pull request #314 from amateo/feature/loadyaml_check_file
Check if file exists before loading with loadyaml. If not, return nil
2015-04-16 10:48:10 -07:00
Angel L. Mateo
ac24e7acc7 test case for when the file does not exist 2015-04-13 09:27:03 +02:00
Bryan Jen
601e2e2574 Modules-2474: Only runs enhanced salts functional test on systems that support it. 2015-04-10 11:38:15 -07:00