summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-11-26(#17797) min() and max() functionsErik Dalén
returns the min or max of all arguments given to them
2012-11-26Merge branch 'fun/2.x/14670_file_line_autorequire' into 2.xJeff McCune
* fun/2.x/14670_file_line_autorequire: (#14670) Fixup file_line autorequire specs (#14670) autorequire a file_line resource's path
2012-11-26(#14670) Fixup file_line autorequire specsJeff McCune
Without this patch applied the file_line autorequire examples are failing. This is a problem because the failures are false positives and should be passing given the implementation. This patch fixes the problem by changing the examples to directly test the existence of the relationship by finding it in the list of autorequire relationships.
2012-11-26(#14670) autorequire a file_line resource's pathPeter Meier
If we manage a file we edit with file_line, it should be autorequired by file_line. Without this patch applied the relationship is not automatically setup and the user is forced to manually manage the relationship.
2012-11-20Merge branch 'lifton-feature/2.x/join_keys_to_values_function' into 2.xJeff McCune
* lifton-feature/2.x/join_keys_to_values_function: Add join_keys_to_values function
2012-11-20Add join_keys_to_values functionJoshua Harlan Lifton
This commit adds a function that joins each of a hash's keys with that key's corresponding value, separated by a separator string. The arguments are a hash and separator string. The return value is an array of joined key/value pairs.
2012-11-19Merge branch 'lifton-feature/2.x/extend_delete_function' into 2.xJeff McCune
* lifton-feature/2.x/extend_delete_function: Extend delete function for strings and hashes Fixed typo
2012-11-19Extend delete function for strings and hashesJoshua Harlan Lifton
Previous to this commit, the delete function only acted on arrays. This commit adds the same functionality for hashes and strings in the obvious way: delete(h, k) would delete the k key from the h hash and delete(s, sub) would delete all instances of the sub substring from the s string.
2012-11-19Fixed typoJoshua Harlan Lifton
2012-11-15Merge branch 'feature/2.x/pick' into 2.xJeff McCune
* feature/2.x/pick: Add the pick() function
2012-11-15Add the pick() functionGary Larizza
This function is similar to a coalesce function in SQL in that it will return the first value in a list of values that is not undefined or an empty string (two things in Puppet that will return a boolean false value). Typically, this function is used to check for a value in the Puppet Dashboard/Enterprise Console, and failover to a default value like the following: $real_jenkins_version = pick($::jenkins_version, '1.449') The value of $real_jenkins_version will first look for a top-scope variable called 'jenkins_version' (note that parameters set in the Puppet Dashboard/ Enterprise Console are brought into Puppet as top-scope variables), and, failing that, will use a default value of 1.449.
2012-11-07Merge branch 'add/2.x/13974-has_interface_with' into 2.xJeff McCune
* add/2.x/13974-has_interface_with: (#13974) Add predicate functions for interface facts
2012-11-07(#13974) Add predicate functions for interface factsWil Cooley
If one wishes to test if a host has a particular IP address (such as a floating virtual address) or has an interface on a particular network (such as a secondary management network), the facts that provide this information are difficult to use within Puppet. This patch addresses these needs by implementing functions ‘has_ip_address(value)’ and ‘has_ip_network(value)’. These functions look through all interfaces for ipaddress_<interface> and network_<interface> (respectively) having the requested <value>. These functions are implemented on top of a lower-level predicate function, ‘has_interface_with(kind, value)’, which iterates through the interfaces in the ‘interfaces’ fact and checks the facts <kind>_<interface> looking for <value>. Additionally, the existence of a particular named interface can be checked for by calling with only a single argument: has_interface_with(interface). A Boolean is returned in all cases.
2012-11-07Merge branch 'add/2.x/joejulian-add_uriescape' into 2.xJeff McCune
* add/2.x/joejulian-add_uriescape: Add function, uriescape, to URI.escape strings. Redmine #17459
2012-11-07Add function, uriescape, to URI.escape strings. Redmine #17459Joe Julian
2012-10-25Merge branch '2.5.x' into 2.xJeff McCune
* 2.5.x: Update Modulefile, CHANGELOG for 2.5.1
2012-10-25Update Modulefile, CHANGELOG for 2.5.1Jeff McCune
2012-10-25Merge branch '2.5.x' into 2.xJeff McCune
* 2.5.x: (maint) Fix spec failures resulting from Facter API changes
2012-10-25Merge branch 'fix/2.5.x/facter_loader' into 2.5.xJeff McCune
* fix/2.5.x/facter_loader: (maint) Fix spec failures resulting from Facter API changes
2012-10-25(maint) Fix spec failures resulting from Facter API changesJeff McCune
Without this patch stdlib tests fail against Facter 2.x and master but not 1.6.x. This patch fixes the problem by initializing the example group differently depending on the version of Facter integrating into the system. The adjusted methods are: 1.x - Facter.collection.loader.load 2.x - Facter.collection.load The collection actually implements the load method in both version, it's simply marked as private in 1.x.
2012-10-25Update Modulefile, CHANGELOG for 2.5.0Jeff McCune
2012-10-25Merge branch 'maint/2.5.x/pick_compatible_new_functionality' into 2.5.xJeff McCune
* maint/2.5.x/pick_compatible_new_functionality: Explicitly load functions used by ensure_resource re-formatting Add better docs about duplicate resource failures Handle undef for parameter argument Add function ensure_resource and defined_with_params
2012-10-25Merge branch 'maint/2.5.x/pick_explicitly_load_functions' into ↵Jeff McCune
maint/2.5.x/pick_compatible_new_functionality * maint/2.5.x/pick_explicitly_load_functions: Explicitly load functions used by ensure_resource
2012-10-25Explicitly load functions used by ensure_resourceDan Bode
The ensure_resource function actually calls two other functions, create_resources and defined_with_param. When calling Puppet functions from Ruby, you sometimes have to load the functions manually if they have not been called before. This commit explicitly loads the functions that ensure_resource depends on from within the function.
2012-10-25Merge branch 'maint/2.5.x/pick_pr86_ensure_resource' into ↵Jeff McCune
maint/2.5.x/pick_compatible_new_functionality * maint/2.5.x/pick_pr86_ensure_resource: re-formatting Add better docs about duplicate resource failures Handle undef for parameter argument Add function ensure_resource and defined_with_params
2012-10-25re-formattingDan Bode
This commit refactors to ensure 80 character lines.
2012-10-25Add better docs about duplicate resource failuresDan Bode
This commit adds better inline documentation explaining how replicate resource definitions can occur if the resource exists and does not have matching parameters.
2012-10-25Handle undef for parameter argumentDan Bode
This commit adds better handling of the case where undef is passed as the parameter value. This works by converting '' into []
2012-10-25Add function ensure_resource and defined_with_paramsDan Bode
This commit adds 2 new functions with unit tests. defined_with_params works similarily to puppet's defined function, except it allows you to also specify a hash of params. defined_with_params will return true if a resource also exists that matches the specified type/title (just like with defined) as well as all of the specified params. ensure_resource is a function that basically combines defined_with_params with create_resources to conditionally create resources only if the specified resource (title, type, params) does not already exist. These functions are created to serve as an alternative to using defined as follows: if ! defined(Package['some_package']) { package { 'some_package': ensure => present, } The issue with this usage is that there is no guarentee about what parameters were set in the previous definition of the package that made its way into the catalog. ensure_resource could be used instead, as: ensure_resource('package', 'some_package', { 'ensure' => 'present' }) This will creat the package resources only if another resource does not exist with the specified parameters.
2012-10-25Revert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""Jeff McCune
This reverts commit d6d23b495cda0e154b4e73982acc43e586564c0e. This backwards-compatible additional functionality is targeted at the next minor release. There are already backwards-incompatible changes in the master branch so we need to establish a new minor branch.
2012-10-25Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x"Jeff McCune
This reverts commit 74e6411157b8df1af9a24c17971e3236f3096529, reversing changes made to 417d219aa6e42f2a16af42c98aa063fc1d9d2ecd. Here's why: Actually... I just screwed this up. I merged this new fact into 2.4.x but it's not fixing any bug. It's adding a new fact, so this should go into master and we should release 2.5 since this is new, backwards-compatible functionality.
2012-10-25Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.xJeff McCune
* haus-add_pe_facts_to_stdlib: Prevent undefined method `split' for nil:NilClass with pe_foo_version facts (maint) Clear all facts before each example Add spec tests for pe_version facts Add PE facts to stdlib
2012-10-25Prevent undefined method `split' for nil:NilClass with pe_foo_version factsJeff McCune
Without this patch the pe_major_version, pe_minor_version, and pe_patch_version facts directly depend on the pe_version fact in a manner that calls split directly on the return value. This is a problem because Fact values are not always guaranteed to return strings, or objects that respond to split. This patch is a defensive measure to ensure we're always calling the split method on a string object. If the Fact returns nil, this will be converted to an empty string responding to split.
2012-10-24(maint) Clear all facts before each exampleJeff McCune
Without this patch example groups must explicitly call `Facter.clear` to clear any cached values between examples. This is a problem because this behavior is not the concern of the example groups, the behavior is the concern of the spec_helper or whatever facility we have in place to initialize the system for testing. This patch fixes the problem by duplicating the logic in the Facter spec_helper to ensure facts are cleared out before each example. This patch requires the example groups to explicitly load the facts they require if the fact name does not match the filename.
2012-10-24Add spec tests for pe_version factsMatthaus Owens
This commit adds some basic spec tests for the pe_version facts. There are basic postitive and negative cases.
2012-10-24Add PE facts to stdlibMatthaus Owens
As many PE modules have PE specific functionality, but are deployed to all nodes, including FOSS nodes, it is valuable to be able to selectively enable those PE specific functions. These facts allow modules to use the is_pe fact to determine whether the module should be used or not. The facts include is_pe, pe_version, pe_major_version, pe_minor_version, and pe_patch_version. For PE 2.6.0 those facts would have values true, 2.6.0, 2, 6, and 0, respectively.
2012-08-20Merge branch '2.3.x' into 2.4.xJeff McCune
* 2.3.x: Disable tests that fail on 2.6.x due to #15912
2012-08-20Merge branch '2.2.x' into 2.3.xJeff McCune
* 2.2.x: Disable tests that fail on 2.6.x due to #15912
2012-08-20Merge branch '2.1.x' into 2.2.xJeff McCune
* 2.1.x: Disable tests that fail on 2.6.x due to #15912 Conflicts: spec/unit/puppet/parser/functions/getvar_spec.rb spec/unit/puppet/parser/functions/has_key_spec.rb spec/unit/puppet/parser/functions/merge_spec.rb
2012-08-20Merge branch 'fix/2.1.x/disable_puppet26_failing_tests' into 2.1.xJeff McCune
* fix/2.1.x/disable_puppet26_failing_tests: Disable tests that fail on 2.6.x due to #15912
2012-08-20Disable tests that fail on 2.6.x due to #15912Jeff McCune
In Puppet 2.6.x there is a bug where a function may be incorrectly detected as an rvalue when it is not, or not detected when it is. This means that in tests the correct syntax for calling a function will be rejected. This disables those tests on 2.6.x, as there is no straightforward way to write them to be compatible with both 2.6.x and newer versions of Puppet. Conflicts: spec/unit/puppet/parser/functions/getvar_spec.rb spec/unit/puppet/parser/functions/has_key_spec.rb spec/unit/puppet/parser/functions/merge_spec.rb This patch was constructed by cherry-picking e27eccb and resolving the merge conflicts to only include the `pending` statements. This resolves the problem by disabling these tests in Puppet 2.6.
2012-08-20Merge branch '2.3.x' into 2.4.xJeff McCune
* 2.3.x: (Maint) Fix mis-use of rvalue functions as statements Add .rspec file to repo root
2012-08-20Merge branch '2.2.x' into 2.3.xJeff McCune
* 2.2.x: (Maint) Fix mis-use of rvalue functions as statements Add .rspec file to repo root
2012-08-20Merge branch '2.1.x' into 2.2.xJeff McCune
* 2.1.x: (Maint) Fix mis-use of rvalue functions as statements Add .rspec file to repo root Conflicts: spec/unit/puppet/parser/functions/getvar_spec.rb spec/unit/puppet/parser/functions/has_key_spec.rb spec/unit/puppet/parser/functions/merge_spec.rb
2012-08-20Merge branch 'fix/2.1.x/spec_failures' into 2.1.xJeff McCune
* fix/2.1.x/spec_failures: (Maint) Fix mis-use of rvalue functions as statements Add .rspec file to repo root
2012-08-20(Maint) Fix mis-use of rvalue functions as statementsJeff McCune
Without this patch applied the spec tests are invalid because they call rvalue functions as if they were statements. This is a problem because Puppet 2.7.x currently throws an exception if a rvalue function is invoked as if it were a statement function. This exception from Puppet is causing tests to fail. This patch fixes the problem by changing the tests to assign the return value of the functions to a variable. This fixes the problem by invoking the functions properly. Paired-with: Andrew Parker <andy@puppetlabs.com>
2012-08-20Add .rspec file to repo rootJeff McCune
Without this patch we don't get an opinionated rspec behavior. This patch makes the behavior of `rake test` and `rspec spec/` opinionated by including some default options.
2012-08-14Update Modulefile, CHANGELOG for 2.4.0Jeff McCune
2012-08-14Merge branch 'feature/2.4.x/backport_file_line_match_pr75' into 2.4.xJeff McCune
* feature/2.4.x/backport_file_line_match_pr75: Add support for a 'match' parameter to file_line
2012-08-14Add support for a 'match' parameter to file_lineChris Price
This commit adds a new parameter called "match" to the file_line resource type, and support for this new parameter to the corresponding ruby provider. This parameter is optional; file_line should work just as before if you do not specify this parameter... so this change should be backwards-compatible. If you do specify the parameter, it is treated as a regular expression that should be used when looking through the file for a line. This allows you to do things like find a line that begins with a certain prefix (e.g., "foo=.*"), and *replace* the existing line with the line you specify in your "line" parameter. Without this capability, if you already had a line "foo=bar" in your file and your "line" parameter was set to "foo=baz", you'd end up with *both* lines in the final file. In many cases this is undesirable.