Commit graph

505 commits

Author SHA1 Message Date
Jeff McCune
598ef3a62c Merge branch '3.x' into 4.x
* 3.x:
  Add the pick() function
2012-11-15 08:57:28 -05:00
Jeff McCune
5353cd77b7 Merge branch '2.x' into 3.x
* 2.x:
  Add the pick() function
2012-11-15 08:57:21 -05:00
Jeff McCune
43dd606982 Merge branch 'feature/2.x/pick' into 2.x
* feature/2.x/pick:
  Add the pick() function
2012-11-15 08:56:52 -05:00
Gary Larizza
ba6dd13990 Add the pick() function
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-15 08:52:19 -05:00
Jeff McCune
f9616ef72f Merge branch '3.x' into 4.x
* 3.x:
  (#13974) Add predicate functions for interface facts
2012-11-07 14:03:31 -08:00
Jeff McCune
b97e053cad Merge branch '2.x' into 3.x
* 2.x:
  (#13974) Add predicate functions for interface facts
2012-11-07 14:03:22 -08:00
Jeff McCune
f8635584a8 Merge branch 'add/2.x/13974-has_interface_with' into 2.x
* add/2.x/13974-has_interface_with:
  (#13974) Add predicate functions for interface facts
2012-11-07 14:03:08 -08:00
Wil Cooley
f8194176dc (#13974) Add predicate functions for interface facts
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-07 14:00:44 -08:00
Jeff McCune
0b3e8f59a9 Merge branch '3.x' into 4.x
* 3.x:
  Add function, uriescape, to URI.escape strings. Redmine #17459
  Add function, uriescape, to URI.escape strings. Redmine #17459
  Update CHANGELOG, Modulefile for 3.1.1
2012-11-07 09:44:35 -08:00
Jeff McCune
20f4811a9e Merge branch 'add/4.x/joejulian-add_uriescape' into 4.x
* add/4.x/joejulian-add_uriescape:
  Add function, uriescape, to URI.escape strings. Redmine #17459
2012-11-07 09:44:31 -08:00
Jeff McCune
be71219f12 Merge branch '2.x' into 3.x
* 2.x:
  Add function, uriescape, to URI.escape strings. Redmine #17459
2012-11-07 09:43:52 -08:00
Jeff McCune
348f1300c0 Merge branch 'add/3.x/joejulian-add_uriescape' into 3.x
* add/3.x/joejulian-add_uriescape:
  Add function, uriescape, to URI.escape strings. Redmine #17459
2012-11-07 09:43:47 -08:00
Jeff McCune
bf66ded063 Merge branch 'add/2.x/joejulian-add_uriescape' into 2.x
* add/2.x/joejulian-add_uriescape:
  Add function, uriescape, to URI.escape strings. Redmine #17459
2012-11-07 09:40:37 -08:00
Joe Julian
fd52b8d88a Add function, uriescape, to URI.escape strings. Redmine #17459 2012-11-07 09:36:54 -08:00
Joe Julian
2fc85d25d2 Add function, uriescape, to URI.escape strings. Redmine #17459 2012-11-07 09:36:54 -08:00
Joe Julian
70f4a0e9ed Add function, uriescape, to URI.escape strings. Redmine #17459 2012-11-07 09:36:54 -08:00
Jeff McCune
6f0c1e248c Merge branch '3.1.x' into 3.x
* 3.1.x:
  Update CHANGELOG, Modulefile for 3.1.1
2012-10-25 16:06:29 -07:00
Jeff McCune
a3c600d5f2 Update CHANGELOG, Modulefile for 3.1.1 2012-10-25 16:06:25 -07:00
Jeff McCune
65d9b10876 Merge branch '3.x' into 4.x
* 3.x:
  Update Modulefile, CHANGELOG for 2.5.1
2012-10-25 15:55:04 -07:00
Jeff McCune
f4c8c6b8de Merge branch '2.x' into 3.x
* 2.x:
  Update Modulefile, CHANGELOG for 2.5.1

Conflicts:
	CHANGELOG
	Modulefile
2012-10-25 15:54:51 -07:00
Jeff McCune
cc670fb3b1 Merge branch '2.5.x' into 2.x
* 2.5.x:
  Update Modulefile, CHANGELOG for 2.5.1
2012-10-25 15:53:40 -07:00
Jeff McCune
1bb4c7a79e Update Modulefile, CHANGELOG for 2.5.1 2012-10-25 15:51:23 -07:00
Jeff McCune
18212dca01 Merge branch '3.x' into 4.x
* 3.x:
  Revert "Revert "Merge branch '2.5.x' into 3.0.x""
  Revert "Merge branch '2.5.x' into 3.0.x"
  (maint) Fix spec failures resulting from Facter API changes
2012-10-25 15:47:53 -07:00
Jeff McCune
9cc15a650a Merge branch '3.1.x' into 3.x
* 3.1.x:
  Revert "Revert "Merge branch '2.5.x' into 3.0.x""
  Revert "Merge branch '2.5.x' into 3.0.x"
  (maint) Fix spec failures resulting from Facter API changes
2012-10-25 15:47:48 -07:00
Jeff McCune
614b3fbf6c Merge branch '2.5.x' into 3.1.x
* 2.5.x:
  (maint) Fix spec failures resulting from Facter API changes
2012-10-25 15:47:25 -07:00
Jeff McCune
43729e6ea9 Revert "Revert "Merge branch '2.5.x' into 3.0.x""
This reverts commit 9e8c60a8b7.

This was an error on my part.  3.1.x descends from 3.0.x _and_ 2.5.x, but 3.0.x does
not descend from 2.5.x.  I should not have merged 2.5.x into 3.0.x,
instead I should have merged 2.5.x into 3.1.x skipping over the 3.0.x
merge up.

I'm slowly starting to understand the implications of semver on our
branching strategy...  =)
2012-10-25 15:44:14 -07:00
Jeff McCune
2ce2c5bd8d Merge branch '3.0.x' into 3.1.x
* 3.0.x:
  Revert "Merge branch '2.5.x' into 3.0.x"
2012-10-25 15:43:51 -07:00
Jeff McCune
9e8c60a8b7 Revert "Merge branch '2.5.x' into 3.0.x"
This reverts commit c8c7afc7a0, reversing
changes made to 03ec16e291.

This was a mistake on my part.  2.5 is a minor release and minor
releases should never be merged into patch level branches.  2.5.x should
have been merged into 3.1.x instead.
2012-10-25 15:42:05 -07:00
Jeff McCune
f7baf36750 Merge branch '2.5.x' into 2.x
* 2.5.x:
  (maint) Fix spec failures resulting from Facter API changes
2012-10-25 15:39:27 -07:00
Jeff McCune
3f310ec874 Merge branch 'fix/2.5.x/facter_loader' into 2.5.x
* fix/2.5.x/facter_loader:
  (maint) Fix spec failures resulting from Facter API changes
2012-10-25 15:38:50 -07:00
Jeff McCune
97f836f41b (maint) Fix spec failures resulting from Facter API changes
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-25 15:36:54 -07:00
Jeff McCune
81b1f1b376 Merge branch '3.x' into 4.x
* 3.x:
2012-10-25 12:01:36 -07:00
Jeff McCune
4004a758b0 Merge branch '3.1.x' into 3.x
* 3.1.x:
  Update Modulefile, CHANGELOG for 3.1.0
  Revert "Revert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'"""
  Update Modulefile, CHANGELOG for 2.5.0
  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
  Revert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""
  Revert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""
  Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x"
  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
  Fix some logical inconsistencies in README
  (#14422) Update README to include the bug tracker URL.
  Revert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'""
2012-10-25 12:01:01 -07:00
Jeff McCune
1d371ab8b6 Merge branch '3.0.x' into 3.1.x
* 3.0.x:

Conflicts:
	CHANGELOG
	Modulefile
2012-10-25 12:00:28 -07:00
Jeff McCune
c8c7afc7a0 Merge branch '2.5.x' into 3.0.x
* 2.5.x:
  Update Modulefile, CHANGELOG for 2.5.0
  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
  Revert "Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x""
  Revert "Merge branch 'haus-add_pe_facts_to_stdlib' into 2.4.x"
  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

Conflicts:
	CHANGELOG
	Modulefile
	spec/spec_helper.rb
2012-10-25 11:59:02 -07:00
Jeff McCune
aa3bded3dd Merge branch '3.1.x' into 4.x
* 3.1.x:
  Update Modulefile, CHANGELOG for 3.1.0
2012-10-25 11:33:43 -07:00
Jeff McCune
e8fb678c91 Update Modulefile, CHANGELOG for 3.1.0 2012-10-25 11:33:09 -07:00
Jeff McCune
48b3e3b8ea Revert "Revert "Revert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'""""
This reverts commit 2885d314b6.

No, really.  Keep the !@#$% integration branches around so we don't have
this revert nightmare again.
2012-10-25 11:29:07 -07:00
Jeff McCune
f531a2936e Merge branch '3.1.x'
* 3.1.x:
  Revert "Revert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'"""
2012-10-25 11:26:19 -07:00
Jeff McCune
2885d314b6 Revert "Revert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'"""
This reverts commit 8fc00ea5b6.

I really wish we could get this right.

Without this patch there is no branch that contains backwards-comaptible
new functionality relative to the current 3.0.1.  There are only
branches that contain backwards-incompatible functionality relative to
3.0.1.

This is a problem because I need to do a release of stdlib that contains
backwards compatible facts but does not contain any breaking changes.

This patch fixes the problem by establishing the 3.1.x branch.  This
branch will then revert the backwards incompatible changes from the
3.1.x branch and revert the revets in the 4.x and master branches.

I'll review our merge process, but it seems wrong that there is no place
to separate out incompatible from compatible changes when working beyond
the most recent patch release.
2012-10-25 11:20:50 -07:00
Jeff McCune
7d8df4b998 Merge branch '2.5.x'
* 2.5.x:
  Update Modulefile, CHANGELOG for 2.5.0

Conflicts:
	CHANGELOG
	Modulefile
2012-10-25 11:11:11 -07:00
Jeff McCune
88af331b0e Update Modulefile, CHANGELOG for 2.5.0 2012-10-25 11:03:27 -07:00
Jeff McCune
a748735f46 Merge branch '2.5.x'
* 2.5.x:
  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-25 10:59:13 -07:00
Jeff McCune
12a146058e Merge branch 'maint/2.5.x/pick_compatible_new_functionality' into 2.5.x
* 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-25 10:58:27 -07:00
Jeff McCune
c2573298a5 Merge branch 'maint/2.5.x/pick_explicitly_load_functions' into 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-25 10:57:45 -07:00
Dan Bode
9fc3063ea9 Explicitly load functions used by ensure_resource
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-25 10:57:40 -07:00
Jeff McCune
699d520e72 Merge branch 'maint/2.5.x/pick_pr86_ensure_resource' into 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-25 10:54:39 -07:00
Dan Bode
444393bf6b re-formatting
This commit refactors to ensure 80 character lines.
2012-10-25 10:54:33 -07:00
Dan Bode
97d327ae44 Add better docs about duplicate resource failures
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-25 10:54:33 -07:00
Dan Bode
4f8b133917 Handle undef for parameter argument
This commit adds better handling of the case where
undef is passed as the parameter value.

This works by converting '' into []
2012-10-25 10:54:33 -07:00