puppet 4.2.0-x64-mingw32 → 4.2.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/ext/project_data.yaml +1 -1
  4. data/ext/suse/client.init +23 -10
  5. data/lib/hiera/puppet_function.rb +5 -5
  6. data/lib/puppet/application/agent.rb +14 -4
  7. data/lib/puppet/application/apply.rb +13 -4
  8. data/lib/puppet/defaults.rb +1 -1
  9. data/lib/puppet/environments.rb +85 -5
  10. data/lib/puppet/functions/epp.rb +29 -37
  11. data/lib/puppet/functions/hiera_include.rb +2 -2
  12. data/lib/puppet/functions/inline_epp.rb +44 -71
  13. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  14. data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +25 -18
  15. data/lib/puppet/node.rb +11 -5
  16. data/lib/puppet/parser/functions/epp.rb +29 -37
  17. data/lib/puppet/parser/functions/inline_epp.rb +35 -60
  18. data/lib/puppet/pops/issues.rb +6 -2
  19. data/lib/puppet/pops/patterns.rb +3 -0
  20. data/lib/puppet/pops/types/type_parser.rb +2 -2
  21. data/lib/puppet/pops/validation/checker4_0.rb +4 -0
  22. data/lib/puppet/provider/zone/solaris.rb +2 -2
  23. data/lib/puppet/type.rb +4 -4
  24. data/lib/puppet/util.rb +9 -1
  25. data/lib/puppet/util/command_line.rb +4 -0
  26. data/lib/puppet/version.rb +1 -1
  27. data/spec/integration/parser/compiler_spec.rb +7 -5
  28. data/spec/integration/provider/package_spec.rb +3 -1
  29. data/spec/integration/ssl/certificate_authority_spec.rb +0 -1
  30. data/spec/integration/ssl/certificate_request_spec.rb +0 -1
  31. data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -1
  32. data/spec/integration/ssl/host_spec.rb +0 -1
  33. data/spec/integration/util/rdoc/parser_spec.rb +1 -1
  34. data/spec/unit/application/apply_spec.rb +1 -1
  35. data/spec/unit/application/filebucket_spec.rb +1 -1
  36. data/spec/unit/application_spec.rb +3 -3
  37. data/spec/unit/environments_spec.rb +2 -0
  38. data/spec/unit/face/node_spec.rb +1 -1
  39. data/spec/unit/file_serving/configuration_spec.rb +1 -1
  40. data/spec/unit/functions/hiera_spec.rb +2 -2
  41. data/spec/unit/graph/sequential_prioritizer_spec.rb +1 -1
  42. data/spec/unit/indirector/indirection_spec.rb +2 -2
  43. data/spec/unit/indirector/ssl_file_spec.rb +1 -1
  44. data/spec/unit/indirector/yaml_spec.rb +1 -1
  45. data/spec/unit/module_tool/application_spec.rb +1 -1
  46. data/spec/unit/module_tool/applications/builder_spec.rb +1 -1
  47. data/spec/unit/network/authstore_spec.rb +1 -1
  48. data/spec/unit/network/http/compression_spec.rb +1 -1
  49. data/spec/unit/network/http/handler_spec.rb +0 -5
  50. data/spec/unit/network/rights_spec.rb +3 -3
  51. data/spec/unit/node_spec.rb +27 -0
  52. data/spec/unit/parser/ast/leaf_spec.rb +1 -1
  53. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +1 -0
  54. data/spec/unit/pops/types/type_parser_spec.rb +8 -0
  55. data/spec/unit/pops/validator/validator_spec.rb +19 -0
  56. data/spec/unit/property_spec.rb +1 -1
  57. data/spec/unit/provider/service/debian_spec.rb +1 -0
  58. data/spec/unit/provider/service/gentoo_spec.rb +1 -0
  59. data/spec/unit/provider/service/init_spec.rb +6 -0
  60. data/spec/unit/provider/service/openrc_spec.rb +1 -0
  61. data/spec/unit/provider/service/src_spec.rb +1 -0
  62. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -1
  63. data/spec/unit/provider/zone/solaris_spec.rb +19 -0
  64. data/spec/unit/resource_spec.rb +2 -2
  65. data/spec/unit/settings_spec.rb +1 -1
  66. data/spec/unit/ssl/certificate_authority_spec.rb +5 -3
  67. data/spec/unit/ssl/host_spec.rb +2 -2
  68. data/spec/unit/type/host_spec.rb +4 -4
  69. data/spec/unit/type/tidy_spec.rb +4 -4
  70. data/spec/unit/type/vlan_spec.rb +1 -1
  71. data/spec/unit/util/ldap/generator_spec.rb +1 -1
  72. data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
  73. data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -1
  74. data/spec/unit/util/network_device_spec.rb +1 -1
  75. data/spec/unit/util/storage_spec.rb +5 -1
  76. data/spec/unit/util_spec.rb +21 -2
  77. metadata +3195 -3217
@@ -93,7 +93,7 @@ module Puppet::ModuleTool
93
93
  # @api private
94
94
  # @return [String] path to temporary unpacking location
95
95
  def tmpdir
96
- @dir ||= Dir.mktmpdir('tmp-unpacker', Puppet::Forge::Cache.base_path)
96
+ @dir ||= Dir.mktmpdir('tmp', Puppet::Forge::Cache.base_path)
97
97
  end
98
98
  end
99
99
  end
@@ -1,37 +1,44 @@
1
- # == Class: <%= metadata.name %>
1
+ # Class: <%= metadata.name %>
2
+ # ===========================
2
3
  #
3
4
  # Full description of class <%= metadata.name %> here.
4
5
  #
5
- # === Parameters
6
+ # Parameters
7
+ # ----------
6
8
  #
7
9
  # Document parameters here.
8
10
  #
9
- # [*sample_parameter*]
10
- # Explanation of what this parameter affects and what it defaults to.
11
- # e.g. "Specify one or more upstream ntp servers as an array."
11
+ # * `sample parameter`
12
+ # Explanation of what this parameter affects and what it defaults to.
13
+ # e.g. "Specify one or more upstream ntp servers as an array."
12
14
  #
13
- # === Variables
15
+ # Variables
16
+ # ----------
14
17
  #
15
18
  # Here you should define a list of variables that this module would require.
16
19
  #
17
- # [*sample_variable*]
18
- # Explanation of how this variable affects the function of this class and if
19
- # it has a default. e.g. "The parameter enc_ntp_servers must be set by the
20
- # External Node Classifier as a comma separated list of hostnames." (Note,
21
- # global variables should be avoided in favor of class parameters as
22
- # of Puppet 2.6.)
20
+ # * `sample variable`
21
+ # Explanation of how this variable affects the function of this class and if
22
+ # it has a default. e.g. "The parameter enc_ntp_servers must be set by the
23
+ # External Node Classifier as a comma separated list of hostnames." (Note,
24
+ # global variables should be avoided in favor of class parameters as
25
+ # of Puppet 2.6.)
23
26
  #
24
- # === Examples
27
+ # Examples
28
+ # --------
25
29
  #
26
- # class { '<%= metadata.name %>':
27
- # servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
28
- # }
30
+ # @example
31
+ # class { '<%= metadata.name %>':
32
+ # servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
33
+ # }
29
34
  #
30
- # === Authors
35
+ # Authors
36
+ # -------
31
37
  #
32
38
  # Author Name <author@domain.com>
33
39
  #
34
- # === Copyright
40
+ # Copyright
41
+ # ---------
35
42
  #
36
43
  # Copyright <%= Time.now.year %> Your name here, unless otherwise noted.
37
44
  #
data/lib/puppet/node.rb CHANGED
@@ -9,6 +9,9 @@ class Puppet::Node
9
9
  # the node sources.
10
10
  extend Puppet::Indirector
11
11
 
12
+ # Asymmetric serialization/deserialization required in this class via to/from datahash
13
+ include Puppet::Util::PsychSupport
14
+
12
15
  # Use the node source as the indirection terminus.
13
16
  indirects :node, :terminus_setting => :node_terminus, :doc => "Where to find node information.
14
17
  A node is composed of its name, its facts, and its environment."
@@ -18,13 +21,16 @@ class Puppet::Node
18
21
 
19
22
  attr_reader :server_facts
20
23
 
21
- def self.from_data_hash(data)
22
- raise ArgumentError, "No name provided in serialized data" unless name = data['name']
24
+ def initialize_from_hash(data)
25
+ @name = data['name'] || (raise ArgumentError, "No name provided in serialized data")
26
+ @classes = data['classes'] || []
27
+ @parameters = data['parameters'] || {}
28
+ @environment_name = data['environment']
29
+ end
23
30
 
31
+ def self.from_data_hash(data)
24
32
  node = new(name)
25
- node.classes = data['classes']
26
- node.parameters = data['parameters']
27
- node.environment_name = data['environment']
33
+ node.initialize_from_hash(data)
28
34
  node
29
35
  end
30
36
 
@@ -1,43 +1,35 @@
1
1
  Puppet::Parser::Functions::newfunction(:epp, :type => :rvalue, :arity => -2, :doc =>
2
- "Evaluates an Embedded Puppet Template (EPP) file and returns the rendered text result as a String.
2
+ "Evaluates an Embedded Puppet (EPP) template file and returns the rendered text
3
+ result as a String.
4
+
5
+ `epp('<MODULE NAME>/<TEMPLATE FILE>', <PARAMETER HASH>)`
3
6
 
4
7
  The first argument to this function should be a `<MODULE NAME>/<TEMPLATE FILE>`
5
- reference, which will load `<TEMPLATE FILE>` from a module's `templates`
6
- directory. (For example, the reference `apache/vhost.conf.epp` will load the
7
- file `<MODULES DIRECTORY>/apache/templates/vhost.conf.epp`.)
8
-
9
- The second argument is optional; if present, it should be a hash containing parameters for the
10
- template. (See below.)
11
-
12
- EPP supports the following tags:
13
-
14
- * `<%= puppet expression %>` - This tag renders the value of the expression it contains.
15
- * `<% puppet expression(s) %>` - This tag will execute the expression(s) it contains, but renders nothing.
16
- * `<%# comment %>` - The tag and its content renders nothing.
17
- * `<%%` or `%%>` - Renders a literal `<%` or `%>` respectively.
18
- * `<%-` - Same as `<%` but suppresses any leading whitespace.
19
- * `-%>` - Same as `%>` but suppresses any trailing whitespace on the same line (including line break).
20
- * `<%- |parameters| -%>` - When placed as the first tag declares the template's parameters.
21
-
22
- File based EPP supports the following visibilities of variables in scope:
23
-
24
- * Global scope (i.e. top + node scopes) - global scope is always visible
25
- * Global + all given arguments - if the EPP template does not declare parameters, and arguments are given
26
- * Global + declared parameters - if the EPP declares parameters, given argument names must match
27
-
28
- EPP supports parameters by placing an optional parameter list as the very first element in the EPP. As an example,
29
- `<%- |$x, $y, $z = 'unicorn'| -%>` when placed first in the EPP text declares that the parameters `x` and `y` must be
30
- given as template arguments when calling `inline_epp`, and that `z` if not given as a template argument
31
- defaults to `'unicorn'`. Template parameters are available as variables, e.g.arguments `$x`, `$y` and `$z` in the example.
32
- Note that `<%-` must be used or any leading whitespace will be interpreted as text
33
-
34
- Arguments are passed to the template by calling `epp` with a Hash as the last argument, where parameters
35
- are bound to values, e.g. `epp('...', {'x'=>10, 'y'=>20})`. Excess arguments may be given
36
- (i.e. undeclared parameters) only if the EPP templates does not declare any parameters at all.
37
- Template parameters shadow variables in outer scopes. File based epp does never have access to variables in the
38
- scope where the `epp` function is called from.
39
-
40
- - See function inline_epp for examples of EPP
8
+ reference, which loads `<TEMPLATE FILE>` from `<MODULE NAME>`'s `templates`
9
+ directory. In most cases, the last argument is optional; if used, it should be a
10
+ [hash](/puppet/latest/reference/lang_data_hash.html) that contains parameters to
11
+ pass to the template.
12
+
13
+ - See the [template](/puppet/latest/reference/lang_template.html) documentation
14
+ for general template usage information.
15
+ - See the [EPP syntax](/puppet/latest/reference/lang_template_epp.html)
16
+ documentation for examples of EPP.
17
+
18
+ For example, to call the apache module's `templates/vhost/_docroot.epp`
19
+ template and pass the `docroot` and `virtual_docroot` parameters, call the `epp`
20
+ function like this:
21
+
22
+ `epp('apache/templates/vhost/_docroot.epp', { 'docroot' => '/var/www/html',
23
+ 'virtual_docroot' => '/var/www/example' })`
24
+
25
+ Puppet produces a syntax error if you pass more parameters than are declared in
26
+ the template's parameter tag. When passing parameters to a template that
27
+ contains a parameter tag, use the same names as the tag's declared parameters.
28
+
29
+ Parameters are required only if they are declared in the called template's
30
+ parameter tag without default values. Puppet produces an error if the `epp`
31
+ function fails to pass any required parameter.
32
+
41
33
  - Since 4.0.0") do |args|
42
34
 
43
35
  function_fail(["epp() is only available when parser/evaluator future is in effect"])
@@ -1,76 +1,51 @@
1
1
  Puppet::Parser::Functions::newfunction(:inline_epp, :type => :rvalue, :arity => -2, :doc =>
2
- "Evaluates an Embedded Puppet Template (EPP) string and returns the rendered text result as a String.
2
+ "Evaluates an Embedded Puppet (EPP) template string and returns the rendered
3
+ text result as a String.
3
4
 
4
- EPP support the following tags:
5
+ `inline_epp('<EPP TEMPLATE STRING>', <PARAMETER HASH>)`
5
6
 
6
- * `<%= puppet expression %>` - This tag renders the value of the expression it contains.
7
- * `<% puppet expression(s) %>` - This tag will execute the expression(s) it contains, but renders nothing.
8
- * `<%# comment %>` - The tag and its content renders nothing.
9
- * `<%%` or `%%>` - Renders a literal `<%` or `%>` respectively.
10
- * `<%-` - Same as `<%` but suppresses any leading whitespace.
11
- * `-%>` - Same as `%>` but suppresses any trailing whitespace on the same line (including line break).
12
- * `<%- |parameters| -%>` - When placed as the first tag declares the template's parameters.
7
+ The first argument to this function should be a string containing an EPP
8
+ template. In most cases, the last argument is optional; if used, it should be a
9
+ [hash](/puppet/latest/reference/lang_data_hash.html) that contains parameters to
10
+ pass to the template.
13
11
 
14
- Inline EPP supports the following visibilities of variables in scope which depends on how EPP parameters
15
- are used - see further below:
12
+ - See the [template](/puppet/latest/reference/lang_template.html) documentation
13
+ for general template usage information.
14
+ - See the [EPP syntax](/puppet/latest/reference/lang_template_epp.html)
15
+ documentation for examples of EPP.
16
16
 
17
- * Global scope (i.e. top + node scopes) - global scope is always visible
18
- * Global + Enclosing scope - if the EPP template does not declare parameters, and no arguments are given
19
- * Global + all given arguments - if the EPP template does not declare parameters, and arguments are given
20
- * Global + declared parameters - if the EPP declares parameters, given argument names must match
17
+ For example, to evaluate an inline EPP template and pass it the `docroot` and
18
+ `virtual_docroot` parameters, call the `inline_epp` function like this:
21
19
 
22
- EPP supports parameters by placing an optional parameter list as the very first element in the EPP. As an example,
23
- `<%- |$x, $y, $z='unicorn'| -%>` when placed first in the EPP text declares that the parameters `x` and `y` must be
24
- given as template arguments when calling `inline_epp`, and that `z` if not given as a template argument
25
- defaults to `'unicorn'`. Template parameters are available as variables, e.g.arguments `$x`, `$y` and `$z` in the example.
26
- Note that `<%-` must be used or any leading whitespace will be interpreted as text
20
+ `inline_epp('docroot: <%= $docroot %> Virtual docroot: <%= $virtual_docroot %>',
21
+ { 'docroot' => '/var/www/html', 'virtual_docroot' => '/var/www/example' })`
27
22
 
28
- Arguments are passed to the template by calling `inline_epp` with a Hash as the last argument, where parameters
29
- are bound to values, e.g. `inline_epp('...', {'x'=>10, 'y'=>20})`. Excess arguments may be given
30
- (i.e. undeclared parameters) only if the EPP templates does not declare any parameters at all.
31
- Template parameters shadow variables in outer scopes.
23
+ Puppet produces a syntax error if you pass more parameters than are declared in
24
+ the template's parameter tag. When passing parameters to a template that
25
+ contains a parameter tag, use the same names as the tag's declared parameters.
32
26
 
33
- Note: An inline template is best stated using a single-quoted string, or a heredoc since a double-quoted string
34
- is subject to expression interpolation before the string is parsed as an EPP template. Here are examples
35
- (using heredoc to define the EPP text):
27
+ Parameters are required only if they are declared in the called template's
28
+ parameter tag without default values. Puppet produces an error if the
29
+ `inline_epp` function fails to pass any required parameter.
36
30
 
37
- # produces 'Hello local variable world!'
38
- $x ='local variable'
39
- inline_epptemplate(@(END:epp))
40
- <%- |$x| -%>
41
- Hello <%= $x %> world!
42
- END
31
+ An inline EPP template should be written as a single-quoted string or
32
+ [heredoc](puppet/latest/reference/lang_data_string.html#heredocs).
33
+ A double-quoted string is subject to expression interpolation before the string
34
+ is parsed as an EPP template.
43
35
 
44
- # produces 'Hello given argument world!'
45
- $x ='local variable world'
46
- inline_epptemplate(@(END:epp), { x =>'given argument'})
47
- <%- |$x| -%>
48
- Hello <%= $x %> world!
49
- END
36
+ For example, to evaluate an inline EPP template using a heredoc, call the
37
+ `inline_epp` function like this:
50
38
 
51
- # produces 'Hello given argument world!'
52
- $x ='local variable world'
53
- inline_epptemplate(@(END:epp), { x =>'given argument'})
54
- <%- |$x| -%>
55
- Hello <%= $x %>!
56
- END
57
-
58
- # results in error, missing value for y
59
- $x ='local variable world'
60
- inline_epptemplate(@(END:epp), { x =>'given argument'})
61
- <%- |$x, $y| -%>
62
- Hello <%= $x %>!
63
- END
64
-
65
- # Produces 'Hello given argument planet'
66
- $x ='local variable world'
67
- inline_epptemplate(@(END:epp), { x =>'given argument'})
68
- <%- |$x, $y=planet| -%>
69
- Hello <%= $x %> <%= $y %>!
70
- END
39
+ ~~~ puppet
40
+ # Outputs 'Hello given argument planet!'
41
+ inline_epp(@(END), { x => 'given argument' })
42
+ <%- | $x, $y = planet | -%>
43
+ Hello <%= $x %> <%= $y %>!
44
+ END
45
+ ~~~
71
46
 
72
47
  - Since 3.5
73
- - Requires Future Parser") do |arguments|
48
+ - Requires [future parser](/puppet/3.8/reference/experiments_future.html) in Puppet 3.5 to 3.8") do |arguments|
74
49
 
75
50
  function_fail(["inline_epp() is only available when parser/evaluator future is in effect"])
76
51
  end
@@ -261,11 +261,15 @@ module Puppet::Pops::Issues
261
261
  end
262
262
 
263
263
  ILLEGAL_NAME = hard_issue :ILLEGAL_NAME, :name do
264
- "Illegal name. The given name #{name} does not conform to the naming rule /^((::)?[a-z_]\w*)(::[a-z]\w*)*$/"
264
+ "Illegal name. The given name '#{name}' does not conform to the naming rule /^((::)?[a-z_]\w*)(::[a-z]\\w*)*$/"
265
+ end
266
+
267
+ ILLEGAL_PARAM_NAME = hard_issue :ILLEGAL_PARAM_NAME, :name do
268
+ "Illegal parameter name. The given name '#{name}' does not conform to the naming rule /^[a-z_]\\w*$/"
265
269
  end
266
270
 
267
271
  ILLEGAL_VAR_NAME = hard_issue :ILLEGAL_VAR_NAME, :name do
268
- "Illegal variable name, The given name '#{name}' does not conform to the naming rule /^((::)?[a-z]\w*)*((::)?[a-z_]\w*)$/"
272
+ "Illegal variable name, The given name '#{name}' does not conform to the naming rule /^((::)?[a-z]\\w*)*((::)?[a-z_]\\w*)$/"
269
273
  end
270
274
 
271
275
  ILLEGAL_NUMERIC_VAR_NAME = hard_issue :ILLEGAL_NUMERIC_VAR_NAME, :name do
@@ -38,6 +38,9 @@ module Puppet::Pops::Patterns
38
38
  # Note, that only the final segment may start with an underscore.
39
39
  VAR_NAME = %r{\A(:?(::)?[a-z]\w*)*(:?(::)?[a-z_]\w*)\z}
40
40
 
41
+ # PARAM_NAME matches the name part of a parameter (The $ character is not included)
42
+ PARAM_NAME = %r{\A[a-z_]\w*\z}
43
+
41
44
  # A Numeric var name must be the decimal number 0, or a decimal number not starting with 0
42
45
  NUMERIC_VAR_NAME = %r{\A(?:0|(?:[1-9][0-9]*))\z}
43
46
 
@@ -356,7 +356,7 @@ class Puppet::Pops::Types::TypeParser
356
356
  if parameters.size == 1
357
357
  case parameters[0]
358
358
  when Integer
359
- TYPES.range(parameters[0], parameters[0])
359
+ TYPES.range(parameters[0], :default)
360
360
  when :default
361
361
  TYPES.integer # unbound
362
362
  end
@@ -370,7 +370,7 @@ class Puppet::Pops::Types::TypeParser
370
370
  if parameters.size == 1
371
371
  case parameters[0]
372
372
  when Integer, Float
373
- TYPES.float_range(parameters[0], parameters[0])
373
+ TYPES.float_range(parameters[0], :default)
374
374
  when :default
375
375
  TYPES.float # unbound
376
376
  end
@@ -433,6 +433,10 @@ class Puppet::Pops::Validation::Checker4_0
433
433
  if o.name =~ /^(?:0x)?[0-9]+$/
434
434
  acceptor.accept(Issues::ILLEGAL_NUMERIC_PARAMETER, o, :name => o.name)
435
435
  end
436
+
437
+ unless o.name =~ Puppet::Pops::Patterns::PARAM_NAME
438
+ acceptor.accept(Issues::ILLEGAL_PARAM_NAME, o, :name => o.name)
439
+ end
436
440
  return unless o.value
437
441
 
438
442
  if o.value.is_a?(Puppet::Pops::Model::AssignmentExpression)
@@ -234,10 +234,10 @@ Puppet::Type.type(:zone).provide(:solaris) do
234
234
  end
235
235
  current[$1.intern] = $2
236
236
  else
237
- Puppet.err "Ignoring '#{line}'"
237
+ err "Ignoring '#{line}'"
238
238
  end
239
239
  else
240
- Puppet.debug "Ignoring zone output '#{line}'"
240
+ debug "Ignoring zone output '#{line}'"
241
241
  end
242
242
  end
243
243
 
data/lib/puppet/type.rb CHANGED
@@ -1539,7 +1539,7 @@ class Type
1539
1539
 
1540
1540
  newmetaparam(:require, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :NONE}) do
1541
1541
  desc "One or more resources that this resource depends on, expressed as
1542
- [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_datatypes.html#resource-references).
1542
+ [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1543
1543
  Multiple resources can be specified as an array of references. When this
1544
1544
  attribute is present:
1545
1545
 
@@ -1553,7 +1553,7 @@ class Type
1553
1553
 
1554
1554
  newmetaparam(:subscribe, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :ALL_EVENTS, :callback => :refresh}) do
1555
1555
  desc "One or more resources that this resource depends on, expressed as
1556
- [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_datatypes.html#resource-references).
1556
+ [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1557
1557
  Multiple resources can be specified as an array of references. When this
1558
1558
  attribute is present:
1559
1559
 
@@ -1571,7 +1571,7 @@ class Type
1571
1571
 
1572
1572
  newmetaparam(:before, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :NONE}) do
1573
1573
  desc "One or more resources that depend on this resource, expressed as
1574
- [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_datatypes.html#resource-references).
1574
+ [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1575
1575
  Multiple resources can be specified as an array of references. When this
1576
1576
  attribute is present:
1577
1577
 
@@ -1585,7 +1585,7 @@ class Type
1585
1585
 
1586
1586
  newmetaparam(:notify, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :ALL_EVENTS, :callback => :refresh}) do
1587
1587
  desc "One or more resources that depend on this resource, expressed as
1588
- [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_datatypes.html#resource-references).
1588
+ [resource references](http://docs.puppetlabs.com/puppet/latest/reference/lang_data_resource_reference.html).
1589
1589
  Multiple resources can be specified as an array of references. When this
1590
1590
  attribute is present:
1591
1591
 
data/lib/puppet/util.rb CHANGED
@@ -260,7 +260,15 @@ module Util
260
260
  $stdout.reopen(stdout)
261
261
  $stderr.reopen(stderr)
262
262
 
263
- 3.upto(256){|fd| IO::new(fd).close rescue nil}
263
+ begin
264
+ Dir.foreach('/proc/self/fd') do |f|
265
+ if f != '.' && f != '..' && f.to_i >= 3
266
+ IO::new(f.to_i).close rescue nil
267
+ end
268
+ end
269
+ rescue Errno::ENOENT # /proc/self/fd not found
270
+ 3.upto(256){|fd| IO::new(fd).close rescue nil}
271
+ end
264
272
 
265
273
  block.call if block
266
274
  end
@@ -117,6 +117,10 @@ module Puppet
117
117
  configured_environment.each_plugin_directory do |dir|
118
118
  $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
119
119
  end
120
+
121
+ # Puppet requires Facter, which initializes its lookup paths. Reset Facter to
122
+ # pickup the new $LOAD_PATH.
123
+ Facter.reset
120
124
  end
121
125
  end
122
126
 
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '4.2.0'
10
+ PUPPETVERSION = '4.2.1'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -1202,13 +1202,15 @@ describe Puppet::Parser::Compiler do
1202
1202
 
1203
1203
  it 'should recompute the version after input files are re-parsed' do
1204
1204
  Puppet[:code] = 'class foo { }'
1205
- Time.stubs(:now).returns(1)
1205
+ first_time = Time.at(1)
1206
+ second_time = Time.at(200)
1207
+ Time.stubs(:now).returns(first_time)
1206
1208
  node = Puppet::Node.new('mynode')
1207
- expect(Puppet::Parser::Compiler.compile(node).version).to eq(1)
1208
- Time.stubs(:now).returns(2)
1209
- expect(Puppet::Parser::Compiler.compile(node).version).to eq(1) # no change because files didn't change
1209
+ expect(Puppet::Parser::Compiler.compile(node).version).to eq(first_time.to_i)
1210
+ Time.stubs(:now).returns(second_time)
1211
+ expect(Puppet::Parser::Compiler.compile(node).version).to eq(first_time.to_i) # no change because files didn't change
1210
1212
  Puppet[:code] = nil
1211
- expect(Puppet::Parser::Compiler.compile(node).version).to eq(2)
1213
+ expect(Puppet::Parser::Compiler.compile(node).version).to eq(second_time.to_i)
1212
1214
  end
1213
1215
 
1214
1216
  ['define', 'class', 'node'].each do |thing|