puppet 6.8.1-x64-mingw32 → 6.9.0-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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/Gemfile.lock +10 -11
  4. data/ext/project_data.yaml +1 -0
  5. data/lib/puppet.rb +9 -1
  6. data/lib/puppet/application/agent.rb +12 -0
  7. data/lib/puppet/application_support.rb +1 -1
  8. data/lib/puppet/context.rb +120 -48
  9. data/lib/puppet/face/config.rb +10 -48
  10. data/lib/puppet/face/help.rb +1 -1
  11. data/lib/puppet/face/plugin.rb +9 -2
  12. data/lib/puppet/forge/repository.rb +1 -1
  13. data/lib/puppet/functions/regsubst.rb +58 -37
  14. data/lib/puppet/indirector/catalog/compiler.rb +10 -6
  15. data/lib/puppet/module_tool/applications/uninstaller.rb +2 -3
  16. data/lib/puppet/network/http/connection.rb +1 -1
  17. data/lib/puppet/network/http/factory.rb +1 -1
  18. data/lib/puppet/network/http_pool.rb +1 -0
  19. data/lib/puppet/provider/package/dnf.rb +1 -1
  20. data/lib/puppet/provider/package/rpm.rb +51 -13
  21. data/lib/puppet/provider/package/yum.rb +8 -4
  22. data/lib/puppet/provider/service/systemd.rb +1 -1
  23. data/lib/puppet/settings.rb +40 -0
  24. data/lib/puppet/ssl.rb +1 -1
  25. data/lib/puppet/ssl/base.rb +1 -1
  26. data/lib/puppet/ssl/openssl_loader.rb +28 -0
  27. data/lib/puppet/ssl/validator.rb +1 -1
  28. data/lib/puppet/ssl/validator/default_validator.rb +1 -1
  29. data/lib/puppet/ssl/validator/no_validator.rb +1 -1
  30. data/lib/puppet/thread_local.rb +7 -0
  31. data/lib/puppet/type/exec.rb +14 -6
  32. data/lib/puppet/type/group.rb +4 -2
  33. data/lib/puppet/type/package.rb +10 -0
  34. data/lib/puppet/type/user.rb +4 -2
  35. data/lib/puppet/util/checksums.rb +3 -3
  36. data/lib/puppet/util/http_proxy.rb +8 -6
  37. data/lib/puppet/util/monkey_patches.rb +53 -47
  38. data/lib/puppet/util/platform.rb +16 -0
  39. data/lib/puppet/util/ssl.rb +1 -1
  40. data/lib/puppet/util/windows/root_certs.rb +1 -1
  41. data/lib/puppet/version.rb +1 -1
  42. data/lib/puppet/x509.rb +1 -1
  43. data/locales/puppet.pot +119 -119
  44. data/man/man5/puppet.conf.5 +2 -2
  45. data/man/man8/puppet-agent.8 +1 -1
  46. data/man/man8/puppet-apply.8 +1 -1
  47. data/man/man8/puppet-catalog.8 +1 -1
  48. data/man/man8/puppet-config.8 +1 -1
  49. data/man/man8/puppet-describe.8 +1 -1
  50. data/man/man8/puppet-device.8 +1 -1
  51. data/man/man8/puppet-doc.8 +1 -1
  52. data/man/man8/puppet-epp.8 +1 -1
  53. data/man/man8/puppet-facts.8 +1 -1
  54. data/man/man8/puppet-filebucket.8 +1 -1
  55. data/man/man8/puppet-generate.8 +1 -1
  56. data/man/man8/puppet-help.8 +1 -1
  57. data/man/man8/puppet-key.8 +1 -1
  58. data/man/man8/puppet-lookup.8 +1 -1
  59. data/man/man8/puppet-man.8 +1 -1
  60. data/man/man8/puppet-module.8 +1 -1
  61. data/man/man8/puppet-node.8 +1 -1
  62. data/man/man8/puppet-parser.8 +1 -1
  63. data/man/man8/puppet-plugin.8 +1 -1
  64. data/man/man8/puppet-report.8 +1 -1
  65. data/man/man8/puppet-resource.8 +1 -1
  66. data/man/man8/puppet-script.8 +1 -1
  67. data/man/man8/puppet-ssl.8 +1 -1
  68. data/man/man8/puppet-status.8 +1 -1
  69. data/man/man8/puppet.8 +3 -3
  70. data/spec/integration/provider/service/systemd_spec.rb +7 -6
  71. data/spec/integration/util/execution_spec.rb +1 -1
  72. data/spec/lib/puppet_spec/matchers.rb +0 -13
  73. data/spec/spec_helper.rb +1 -3
  74. data/spec/unit/application/agent_spec.rb +19 -0
  75. data/spec/unit/context_spec.rb +119 -38
  76. data/spec/unit/face/help_spec.rb +1 -1
  77. data/spec/unit/face/plugin_spec.rb +8 -0
  78. data/spec/unit/forge/forge_spec.rb +1 -3
  79. data/spec/unit/forge/repository_spec.rb +1 -3
  80. data/spec/unit/functions/contain_spec.rb +1 -1
  81. data/spec/unit/indirector/catalog/compiler_spec.rb +62 -5
  82. data/spec/unit/module_tool/applications/uninstaller_spec.rb +16 -7
  83. data/spec/unit/node/environment_spec.rb +1 -1
  84. data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
  85. data/spec/unit/provider/package/dnf_spec.rb +7 -0
  86. data/spec/unit/provider/package/pkgin_spec.rb +1 -1
  87. data/spec/unit/provider/package/rpm_spec.rb +150 -16
  88. data/spec/unit/provider/package/yum_spec.rb +7 -0
  89. data/spec/unit/type/exec_spec.rb +9 -0
  90. data/spec/unit/type/schedule_spec.rb +1 -1
  91. data/spec/unit/util/http_proxy_spec.rb +50 -0
  92. data/spec/unit/util/inifile_spec.rb +5 -5
  93. metadata +18 -2
@@ -196,7 +196,7 @@ Puppet::Face.define(:help, '0.0.1') do
196
196
  #private :horribly_extract_summary_from
197
197
 
198
198
  def exclude_from_docs?(appname)
199
- %w{face_base indirection_base cert key man plugin report status}.include? appname
199
+ %w{face_base indirection_base cert key man report status}.include? appname
200
200
  end
201
201
  # This should absolutely be a private method, but for some reason it appears
202
202
  # that you can't use the 'private' keyword inside of a Face definition.
@@ -41,8 +41,15 @@ Puppet::Face.define(:plugin, '0.0.1') do
41
41
  when_invoked do |options|
42
42
  remote_environment_for_plugins = Puppet::Node::Environment.remote(Puppet[:environment])
43
43
 
44
- handler = Puppet::Configurer::PluginHandler.new()
45
- handler.download_plugins(remote_environment_for_plugins)
44
+ pool = Puppet::Network::HTTP::Pool.new(Puppet[:http_keepalive_timeout])
45
+ Puppet.override(:http_pool => pool) do
46
+ begin
47
+ handler = Puppet::Configurer::PluginHandler.new()
48
+ handler.download_plugins(remote_environment_for_plugins)
49
+ ensure
50
+ pool.close
51
+ end
52
+ end
46
53
  end
47
54
 
48
55
  when_rendering :console do |value|
@@ -1,4 +1,4 @@
1
- require 'net/https'
1
+ require 'puppet/ssl/openssl_loader'
2
2
  require 'digest/sha1'
3
3
  require 'uri'
4
4
  require 'puppet/util/http_proxy'
@@ -1,42 +1,34 @@
1
1
  # Performs regexp replacement on a string or array of strings.
2
- #
3
- # @param target [String, Array[String]]
4
- # The string or array of strings to operate on. If an array, the replacement will be
5
- # performed on each of the elements in the array, and the return value will be an array.
6
- # @param pattern [String, Regexp, Type[Regexp]]
7
- # The regular expression matching the target string. If you want it anchored at the start
8
- # and or end of the string, you must do that with ^ and $ yourself.
9
- # @param replacement [String, Hash[String, String]]
10
- # Replacement string. Can contain backreferences to what was matched using \\0 (whole match),
11
- # \\1 (first set of parentheses), and so on.
12
- # If the second argument is a Hash, and the matched text is one of its keys, the corresponding value is the replacement string.
13
- # @param flags [Optional[Pattern[/^[GEIM]*$/]], Pattern[/^G?$/]]
14
- # Optional. String of single letter flags for how the regexp is interpreted (E, I, and M cannot be used
15
- # if pattern is a precompiled regexp):
16
- # - *E* Extended regexps
17
- # - *I* Ignore case in regexps
18
- # - *M* Multiline regexps
19
- # - *G* Global replacement; all occurrences of the regexp in each target string will be replaced. Without this, only the first occurrence will be replaced.
20
- # @param encoding [Enum['N','E','S','U']]
21
- # Optional. How to handle multibyte characters when compiling the regexp (must not be used when pattern is a
22
- # precompiled regexp). A single-character string with the following values:
23
- # - *N* None
24
- # - *E* EUC
25
- # - *S* SJIS
26
- # - *U* UTF-8
27
- # @return [Array[String], String] The result of the substitution. Result type is the same as for the target parameter.
28
- #
29
- # @example Get the third octet from the node's IP address:
30
- # ```puppet
31
- # $i3 = regsubst($ipaddress,'^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$','\\3')
32
- # ```
33
- #
34
- # @example Put angle brackets around each octet in the node's IP address:
35
- # ```puppet
36
- # $x = regsubst($ipaddress, /([0-9]+)/, '<\\1>', 'G')
37
- # ```
38
- #
39
2
  Puppet::Functions.create_function(:regsubst) do
3
+ # @param target [String]
4
+ # The string or array of strings to operate on. If an array, the replacement will be
5
+ # performed on each of the elements in the array, and the return value will be an array.
6
+ # @param pattern [String, Regexp, Type[Regexp]]
7
+ # The regular expression matching the target string. If you want it anchored at the start
8
+ # and or end of the string, you must do that with ^ and $ yourself.
9
+ # @param replacement [String, Hash[String, String]]
10
+ # Replacement string. Can contain backreferences to what was matched using \\0 (whole match),
11
+ # \\1 (first set of parentheses), and so on.
12
+ # If the second argument is a Hash, and the matched text is one of its keys, the corresponding value is the replacement string.
13
+ # @param flags [Optional[Pattern[/^[GEIM]*$/]], Pattern[/^G?$/]]
14
+ # Optional. String of single letter flags for how the regexp is interpreted (E, I, and M cannot be used
15
+ # if pattern is a precompiled regexp):
16
+ # - *E* Extended regexps
17
+ # - *I* Ignore case in regexps
18
+ # - *M* Multiline regexps
19
+ # - *G* Global replacement; all occurrences of the regexp in each target string will be replaced. Without this, only the first occurrence will be replaced.
20
+ # @param encoding [Enum['N','E','S','U']]
21
+ # Optional. How to handle multibyte characters when compiling the regexp (must not be used when pattern is a
22
+ # precompiled regexp). A single-character string with the following values:
23
+ # - *N* None
24
+ # - *E* EUC
25
+ # - *S* SJIS
26
+ # - *U* UTF-8
27
+ # @return [Array[String], String] The result of the substitution. Result type is the same as for the target parameter.
28
+ # @example Get the third octet from the node's IP address:
29
+ # ```puppet
30
+ # $i3 = regsubst($ipaddress,'^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$','\\3')
31
+ # ```
40
32
  dispatch :regsubst_string do
41
33
  param 'Variant[Array[String],String]', :target
42
34
  param 'String', :pattern
@@ -45,6 +37,35 @@ Puppet::Functions.create_function(:regsubst) do
45
37
  optional_param "Enum['N','E','S','U']", :encoding
46
38
  end
47
39
 
40
+ # @param target [String, Array[String]]
41
+ # The string or array of strings to operate on. If an array, the replacement will be
42
+ # performed on each of the elements in the array, and the return value will be an array.
43
+ # @param pattern [Regexp, Type[Regexp]]
44
+ # The regular expression matching the target string. If you want it anchored at the start
45
+ # and or end of the string, you must do that with ^ and $ yourself.
46
+ # @param replacement [String, Hash[String, String]]
47
+ # Replacement string. Can contain backreferences to what was matched using \\0 (whole match),
48
+ # \\1 (first set of parentheses), and so on.
49
+ # If the second argument is a Hash, and the matched text is one of its keys, the corresponding value is the replacement string.
50
+ # @param flags [Optional[Pattern[/^[GEIM]*$/]], Pattern[/^G?$/]]
51
+ # Optional. String of single letter flags for how the regexp is interpreted (E, I, and M cannot be used
52
+ # if pattern is a precompiled regexp):
53
+ # - *E* Extended regexps
54
+ # - *I* Ignore case in regexps
55
+ # - *M* Multiline regexps
56
+ # - *G* Global replacement; all occurrences of the regexp in each target string will be replaced. Without this, only the first occurrence will be replaced.
57
+ # @param encoding [Enum['N','E','S','U']]
58
+ # Optional. How to handle multibyte characters when compiling the regexp (must not be used when pattern is a
59
+ # precompiled regexp). A single-character string with the following values:
60
+ # - *N* None
61
+ # - *E* EUC
62
+ # - *S* SJIS
63
+ # - *U* UTF-8
64
+ # @return [Array[String], String] The result of the substitution. Result type is the same as for the target parameter.
65
+ # @example Put angle brackets around each octet in the node's IP address:
66
+ # ```puppet
67
+ # $x = regsubst($ipaddress, /([0-9]+)/, '<\\1>', 'G')
68
+ # ```
48
69
  dispatch :regsubst_regexp do
49
70
  param 'Variant[Array[String],String]', :target
50
71
  param 'Variant[Regexp,Type[Regexp]]', :pattern
@@ -401,24 +401,28 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
401
401
 
402
402
  # And then add the server name and IP
403
403
  {"servername" => "fqdn",
404
- "serverip" => "ipaddress"
404
+ "serverip" => "ipaddress",
405
+ "serverip6" => "ipaddress6"
405
406
  }.each do |var, fact|
406
407
  value = Facter.value(fact)
407
- if value
408
+ if !value.nil?
408
409
  @server_facts[var] = value
409
- else
410
- Puppet.warning _("Could not retrieve fact %{fact}") % { fact: fact }
411
410
  end
412
411
  end
413
412
 
414
413
  if @server_facts["servername"].nil?
415
414
  host = Facter.value(:hostname)
416
- domain = Facter.value(:domain)
417
- if domain
415
+ if host.nil?
416
+ Puppet.warning _("Could not retrieve fact servername")
417
+ elsif domain = Facter.value(:domain) #rubocop:disable Lint/AssignmentInCondition
418
418
  @server_facts["servername"] = [host, domain].join(".")
419
419
  else
420
420
  @server_facts["servername"] = host
421
421
  end
422
422
  end
423
+
424
+ if @server_facts["serverip"].nil? && @server_facts["serverip6"].nil?
425
+ Puppet.warning _("Could not retrieve either serverip or serverip6 fact")
426
+ end
423
427
  end
424
428
  end
@@ -15,9 +15,6 @@ module Puppet::ModuleTool
15
15
  end
16
16
 
17
17
  def run
18
- # Disallow anything that invokes md5 to avoid un-friendly termination due to FIPS
19
- raise _("Module uninstall is prohibited in FIPS mode.") if Facter.value(:fips_enabled)
20
-
21
18
  results = {
22
19
  :module_name => @name,
23
20
  :requested_version => @version,
@@ -92,6 +89,8 @@ module Puppet::ModuleTool
92
89
  mod = @installed.first
93
90
 
94
91
  unless @ignore_changes
92
+ raise _("Either the `--ignore_changes` or `--force` argument must be specified to uninstall modules when running in FIPS mode.") if Facter.value(:fips_enabled)
93
+
95
94
  changes = begin
96
95
  Puppet::ModuleTool::Applications::Checksummer.run(mod.path)
97
96
  rescue ArgumentError
@@ -1,4 +1,4 @@
1
- require 'net/https'
1
+ require 'puppet/ssl/openssl_loader'
2
2
  require 'puppet/ssl/host'
3
3
  require 'puppet/ssl/validator'
4
4
  require 'puppet/network/http'
@@ -1,4 +1,4 @@
1
- require 'openssl'
1
+ require 'puppet/ssl/openssl_loader'
2
2
  require 'net/http'
3
3
  require 'puppet/util/http_proxy'
4
4
 
@@ -1,4 +1,5 @@
1
1
  require 'puppet/network/http/connection'
2
+ require 'puppet/util/platform'
2
3
 
3
4
  module Puppet::Network; end
4
5
 
@@ -9,7 +9,7 @@ Puppet::Type.type(:package).provide :dnf, :parent => :yum do
9
9
  These options should be specified as an array where each element is either
10
10
  a string or a hash."
11
11
 
12
- has_feature :install_options, :versionable, :virtual_packages
12
+ has_feature :install_options, :versionable, :virtual_packages, :install_only
13
13
 
14
14
  commands :cmd => "dnf", :rpm => "rpm"
15
15
 
@@ -13,6 +13,7 @@ These options should be specified as an array where each element is either a str
13
13
  has_feature :install_options
14
14
  has_feature :uninstall_options
15
15
  has_feature :virtual_packages
16
+ has_feature :install_only
16
17
 
17
18
  # Note: self:: is required here to keep these constants in the context of what will
18
19
  # eventually become this Puppet::Type::Package::ProviderRpm class.
@@ -20,6 +21,7 @@ These options should be specified as an array where each element is either a str
20
21
  self::NEVRA_FORMAT = %Q{%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\\n}
21
22
  self::NEVRA_REGEX = %r{^'?(\S+) (\S+) (\S+) (\S+) (\S+)$}
22
23
  self::NEVRA_FIELDS = [:name, :epoch, :version, :release, :arch]
24
+ self::MULTIVERSION_SEPARATOR = "; "
23
25
 
24
26
  ARCH_LIST = [
25
27
  'noarch',
@@ -79,12 +81,9 @@ These options should be specified as an array where each element is either a str
79
81
 
80
82
  # list out all of the packages
81
83
  begin
82
- execpipe("#{command(:rpm)} -qa #{nosignature} #{nodigest} --qf '#{self::NEVRA_FORMAT}'") { |process|
84
+ execpipe("#{command(:rpm)} -qa #{nosignature} #{nodigest} --qf '#{self::NEVRA_FORMAT}' | sort") { |process|
83
85
  # now turn each returned line into a package object
84
- process.each_line { |line|
85
- hash = nevra_to_hash(line)
86
- packages << new(hash) unless hash.empty?
87
- }
86
+ nevra_to_multiversion_hash(process).each { |hash| packages << new(hash) }
88
87
  }
89
88
  rescue Puppet::ExecutionFailure
90
89
  raise Puppet::Error, _("Failed to list packages"), $!.backtrace
@@ -100,7 +99,7 @@ These options should be specified as an array where each element is either a str
100
99
  #NOTE: Prior to a fix for issue 1243, this method potentially returned a cached value
101
100
  #IF YOU CALL THIS METHOD, IT WILL CALL RPM
102
101
  #Use get(:property) to check if cached values are available
103
- cmd = ["-q", @resource[:name], "#{self.class.nosignature}", "#{self.class.nodigest}", "--qf", "'#{self.class::NEVRA_FORMAT}'"]
102
+ cmd = ["-q", @resource[:name], "#{self.class.nosignature}", "#{self.class.nodigest}", "--qf", "#{self.class::NEVRA_FORMAT}"]
104
103
 
105
104
  begin
106
105
  output = rpm(*cmd)
@@ -117,9 +116,7 @@ These options should be specified as an array where each element is either a str
117
116
  return nil
118
117
  end
119
118
  end
120
- # FIXME: We could actually be getting back multiple packages
121
- # for multilib and this will only return the first such package
122
- @property_hash.update(self.class.nevra_to_hash(output))
119
+ @property_hash.update(self.class.nevra_to_multiversion_hash(output))
123
120
 
124
121
  @property_hash.dup
125
122
  end
@@ -131,8 +128,8 @@ These options should be specified as an array where each element is either a str
131
128
  @resource.fail _("RPMs must specify a package source")
132
129
  end
133
130
 
134
- cmd = [command(:rpm), "-q", "--qf", "'#{self.class::NEVRA_FORMAT}'", "-p", source]
135
- h = self.class.nevra_to_hash(execute(cmd))
131
+ cmd = [command(:rpm), "-q", "--qf", "#{self.class::NEVRA_FORMAT}", "-p", source]
132
+ h = self.class.nevra_to_multiversion_hash(execute(cmd))
136
133
  h[:ensure]
137
134
  rescue Puppet::ExecutionFailure => e
138
135
  raise Puppet::Error, e.message, e.backtrace
@@ -170,7 +167,11 @@ These options should be specified as an array where each element is either a str
170
167
  if @resource[:name].start_with? nav
171
168
  identifier = nav
172
169
  else
173
- identifier = name
170
+ if @resource[:install_only]
171
+ identifier = get(:ensure).split(self.class::MULTIVERSION_SEPARATOR).map { |ver| "#{name}-#{ver}" }
172
+ else
173
+ identifier = name
174
+ end
174
175
  end
175
176
  end
176
177
  # If an arch is specified in the resource, uninstall that arch,
@@ -310,8 +311,12 @@ These options should be specified as an array where each element is either a str
310
311
 
311
312
  def insync?(is)
312
313
  return false if [:purged, :absent].include?(is)
314
+ return false if is.include?(self.class::MULTIVERSION_SEPARATOR) && !@resource[:install_only]
315
+
313
316
  should = resource[:ensure]
314
- 0 == rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(is))
317
+ is.split(self.class::MULTIVERSION_SEPARATOR).any? do |version|
318
+ 0 == self.rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(version))
319
+ end
315
320
  end
316
321
 
317
322
  # parse a rpm "version" specification
@@ -416,4 +421,37 @@ These options should be specified as an array where each element is either a str
416
421
 
417
422
  return hash
418
423
  end
424
+
425
+ # @param line [String] multiple lines of rpm package query information
426
+ # @return list of [Hash] of NEVRA_FIELDS strings parsed from package info
427
+ # or an empty list if we failed to parse
428
+ # @api private
429
+ def self.nevra_to_multiversion_hash(multiline)
430
+ list = []
431
+ multiversion_hash = {}
432
+ multiline.each_line do |line|
433
+ hash = self.nevra_to_hash(line)
434
+ if !hash.empty?
435
+ if multiversion_hash.empty?
436
+ multiversion_hash = hash.dup
437
+ next
438
+ end
439
+
440
+ if multiversion_hash[:name] != hash[:name]
441
+ list << multiversion_hash
442
+ multiversion_hash = hash.dup
443
+ next
444
+ end
445
+
446
+ if !multiversion_hash[:ensure].include?(hash[:ensure])
447
+ multiversion_hash[:ensure].concat("#{self::MULTIVERSION_SEPARATOR}#{hash[:ensure]}")
448
+ end
449
+ end
450
+ end
451
+ list << multiversion_hash if multiversion_hash
452
+ if list.size == 1
453
+ return list[0]
454
+ end
455
+ return list
456
+ end
419
457
  end
@@ -8,7 +8,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
8
8
  This provider supports the `install_options` attribute, which allows command-line flags to be passed to yum.
9
9
  These options should be specified as an array where each element is either a string or a hash."
10
10
 
11
- has_feature :install_options, :versionable, :virtual_packages
11
+ has_feature :install_options, :versionable, :virtual_packages, :install_only
12
12
 
13
13
  commands :cmd => "yum", :rpm => "rpm"
14
14
 
@@ -203,7 +203,10 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
203
203
  end
204
204
  current_package = self.query
205
205
  if current_package
206
- if rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) < 0
206
+ if @resource[:install_only]
207
+ self.debug "Updating package #{@resource[:name]} from version #{current_package[:ensure]} to #{should} as install_only packages are never downgraded"
208
+ operation = update_command
209
+ elsif rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) < 0
207
210
  self.debug "Downgrading package #{@resource[:name]} from version #{current_package[:ensure]} to #{should}"
208
211
  operation = :downgrade
209
212
  elsif rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) > 0
@@ -228,10 +231,11 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
228
231
  is = self.query
229
232
  raise Puppet::Error, _("Could not find package %{name}") % { name: self.name } unless is
230
233
 
234
+ version = is[:ensure]
231
235
  # FIXME: Should we raise an exception even if should == :latest
232
236
  # and yum updated us to a version other than @param_hash[:ensure] ?
233
- vercmp_result = rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(is[:ensure]))
234
- raise Puppet::Error, _("Failed to update to version %{should}, got version %{version} instead") % { should: should, version: is[:ensure] } if vercmp_result != 0
237
+ raise Puppet::Error, _("Failed to update to version %{should}, got version %{version} instead") % { should: should, version: version } unless
238
+ insync?(version)
235
239
  end
236
240
  end
237
241
 
@@ -11,7 +11,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
11
11
 
12
12
  commands :systemctl => "systemctl"
13
13
 
14
- confine :true => Puppet::FileSystem.exist?('/proc/1/exe') && Puppet::FileSystem.readlink('/proc/1/exe').include?('systemd')
14
+ confine :true => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd')
15
15
 
16
16
  defaultfor :osfamily => [:archlinux]
17
17
  defaultfor :osfamily => :redhat, :operatingsystemmajrelease => ["7", "8"]
@@ -84,6 +84,46 @@ class Puppet::Settings
84
84
  "puppet.conf"
85
85
  end
86
86
 
87
+ def stringify_settings(section, settings = :all)
88
+ values_from_the_selected_section =
89
+ values(nil, section.to_sym)
90
+
91
+ loader_settings = {
92
+ :environmentpath => values_from_the_selected_section.interpolate(:environmentpath),
93
+ :basemodulepath => values_from_the_selected_section.interpolate(:basemodulepath),
94
+ }
95
+
96
+ Puppet.override(Puppet.base_context(loader_settings),
97
+ _("New environment loaders generated from the requested section.")) do
98
+ # And now we can lookup values that include those from environments configured from
99
+ # the requested section
100
+ values = values(Puppet[:environment].to_sym, section.to_sym)
101
+
102
+ to_be_rendered = {}
103
+ settings = Puppet.settings.to_a.collect(&:first) if settings == :all
104
+ settings.sort.each do |setting_name|
105
+ to_be_rendered[setting_name] = values.print(setting_name.to_sym)
106
+ end
107
+
108
+ stringifyhash(to_be_rendered)
109
+ end
110
+ end
111
+
112
+ def stringifyhash(hash)
113
+ newhash = {}
114
+ hash.each do |key, val|
115
+ key = key.to_s
116
+ if val.is_a? Hash
117
+ newhash[key] = stringifyhash(val)
118
+ elsif val.is_a? Symbol
119
+ newhash[key] = val.to_s
120
+ else
121
+ newhash[key] = val
122
+ end
123
+ end
124
+ newhash
125
+ end
126
+
87
127
  # Create a new collection of config settings.
88
128
  def initialize
89
129
  @config = {}
@@ -1,6 +1,6 @@
1
1
  # Just to make the constants work out.
2
2
  require 'puppet'
3
- require 'openssl'
3
+ require 'puppet/ssl/openssl_loader'
4
4
 
5
5
  module Puppet::SSL # :nodoc:
6
6
  CA_NAME = "ca".freeze