puppet 8.6.0-x86-mingw32 → 8.7.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -2
  3. data/Gemfile.lock +42 -38
  4. data/Rakefile +45 -22
  5. data/examples/hiera/README.md +68 -57
  6. data/examples/hiera/data/common.yaml +12 -0
  7. data/examples/hiera/data/dc1.yaml +6 -0
  8. data/examples/hiera/hiera.yaml +15 -0
  9. data/examples/hiera/modules/ntp/data/common.yaml +4 -0
  10. data/examples/hiera/modules/ntp/hiera.yaml +9 -0
  11. data/examples/hiera/modules/ntp/manifests/config.pp +16 -4
  12. data/examples/hiera/modules/ntp/templates/ntp.conf.epp +3 -0
  13. data/examples/hiera/modules/users/manifests/common.pp +7 -2
  14. data/examples/hiera/modules/users/manifests/dc1.pp +7 -2
  15. data/examples/hiera/site.pp +1 -1
  16. data/ext/project_data.yaml +0 -45
  17. data/lib/puppet/daemon.rb +1 -0
  18. data/lib/puppet/pops/loader/static_loader.rb +2 -2
  19. data/lib/puppet/pops/lookup/module_data_provider.rb +9 -9
  20. data/lib/puppet/provider/aix_object.rb +1 -1
  21. data/lib/puppet/provider/group/groupadd.rb +30 -9
  22. data/lib/puppet/provider/package/xbps.rb +127 -0
  23. data/lib/puppet/scheduler/splay_job.rb +9 -0
  24. data/lib/puppet/type/exec.rb +8 -0
  25. data/lib/puppet/util/command_line/trollop.rb +20 -2
  26. data/lib/puppet/util/rpm_compare.rb +1 -1
  27. data/lib/puppet/util/windows/com.rb +2 -2
  28. data/lib/puppet/version.rb +1 -1
  29. data/locales/puppet.pot +604 -600
  30. data/man/man5/puppet.conf.5 +2 -2
  31. data/man/man8/puppet-agent.8 +1 -1
  32. data/man/man8/puppet-apply.8 +1 -1
  33. data/man/man8/puppet-catalog.8 +1 -1
  34. data/man/man8/puppet-config.8 +1 -1
  35. data/man/man8/puppet-describe.8 +1 -1
  36. data/man/man8/puppet-device.8 +1 -1
  37. data/man/man8/puppet-doc.8 +1 -1
  38. data/man/man8/puppet-epp.8 +1 -1
  39. data/man/man8/puppet-facts.8 +1 -1
  40. data/man/man8/puppet-filebucket.8 +1 -1
  41. data/man/man8/puppet-generate.8 +1 -1
  42. data/man/man8/puppet-help.8 +1 -1
  43. data/man/man8/puppet-lookup.8 +1 -1
  44. data/man/man8/puppet-module.8 +1 -1
  45. data/man/man8/puppet-node.8 +1 -1
  46. data/man/man8/puppet-parser.8 +1 -1
  47. data/man/man8/puppet-plugin.8 +1 -1
  48. data/man/man8/puppet-report.8 +1 -1
  49. data/man/man8/puppet-resource.8 +1 -1
  50. data/man/man8/puppet-script.8 +1 -1
  51. data/man/man8/puppet-ssl.8 +1 -1
  52. data/man/man8/puppet.8 +2 -2
  53. metadata +39 -25
  54. data/examples/hiera/etc/hiera.yaml +0 -15
  55. data/examples/hiera/etc/hieradb/common.yaml +0 -3
  56. data/examples/hiera/etc/hieradb/dc1.yaml +0 -6
  57. data/examples/hiera/etc/hieradb/development.yaml +0 -2
  58. data/examples/hiera/etc/puppet.conf +0 -3
  59. data/examples/hiera/modules/data/manifests/common.pp +0 -4
  60. data/examples/hiera/modules/ntp/manifests/data.pp +0 -4
  61. data/examples/hiera/modules/ntp/templates/ntp.conf.erb +0 -3
  62. data/examples/hiera/modules/users/manifests/development.pp +0 -4
  63. data/tasks/benchmark.rake +0 -180
  64. data/tasks/cfpropertylist.rake +0 -15
  65. data/tasks/ci.rake +0 -24
  66. data/tasks/generate_ast_model.rake +0 -90
  67. data/tasks/generate_cert_fixtures.rake +0 -199
  68. data/tasks/manpages.rake +0 -67
  69. data/tasks/memwalk.rake +0 -195
  70. data/tasks/parallel.rake +0 -410
  71. data/tasks/parser.rake +0 -22
  72. data/tasks/yard.rake +0 -59
@@ -1,53 +1,8 @@
1
1
  ---
2
2
  project: 'puppet'
3
- author: 'Puppet Labs'
4
- email: 'info@puppetlabs.com'
5
- homepage: 'https://github.com/puppetlabs/puppet'
6
- summary: 'Puppet, an automated configuration management tool'
7
- description: 'Puppet, an automated configuration management tool'
8
- version_file: 'lib/puppet/version.rb'
9
- # files and gem_files are space separated lists
10
- files: '[A-Z]* install.rb bin lib conf man examples ext tasks locales'
11
- # Make sure these gem requirements are in sync with the gemspec and Gemfile
12
- gem_files: '[A-Z]* install.rb bin lib conf man examples ext tasks locales'
13
- gem_test_files:
14
- gem_executables: 'puppet'
15
- gem_default_executables: 'puppet'
16
- gem_license: 'Apache-2.0'
17
- gem_forge_project: 'puppet'
18
- gem_required_ruby_version: '>= 3.1.0'
19
- gem_required_rubygems_version: '> 1.3.1'
20
- gem_runtime_dependencies:
21
- facter: ['>= 4.3.0', '< 5']
22
- semantic_puppet: '~> 1.0'
23
- fast_gettext: ['>= 2.1', '< 3']
24
- locale: '~> 2.1'
25
- multi_json: '~> 1.13'
26
- puppet-resource_api: '~>1.5'
27
- concurrent-ruby: "~> 1.0"
28
- deep_merge: '~> 1.0'
29
- scanf: '~> 1.0'
30
3
  gem_rdoc_options:
31
4
  - --title
32
5
  - "Puppet - Configuration Management"
33
6
  - --main
34
7
  - README.md
35
8
  - --line-numbers
36
- gem_platform_dependencies:
37
- universal-darwin:
38
- gem_runtime_dependencies:
39
- CFPropertyList: '~> 2.2'
40
- x86-mingw32:
41
- gem_runtime_dependencies:
42
- ffi: '1.15.5'
43
- minitar: '~> 0.9'
44
- x64-mingw32:
45
- gem_runtime_dependencies:
46
- ffi: '1.15.5'
47
- minitar: '~> 0.9'
48
- bundle_platforms:
49
- universal-darwin: all
50
- x86-mingw32: mingw
51
- x64-mingw32: x64_mingw
52
- pre_tasks:
53
- 'package:apple': 'cfpropertylist'
data/lib/puppet/daemon.rb CHANGED
@@ -165,6 +165,7 @@ class Puppet::Daemon
165
165
  reparse_run = Puppet::Scheduler.create_job(Puppet[:filetimeout]) do
166
166
  Puppet.settings.reparse_config_files
167
167
  agent_run.run_interval = Puppet[:runinterval]
168
+ agent_run.splay_limit = Puppet[:splaylimit] if Puppet[:splay]
168
169
  if Puppet[:filetimeout] == 0
169
170
  reparse_run.disable
170
171
  else
@@ -46,9 +46,9 @@ class StaticLoader < Loader
46
46
 
47
47
  def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY)
48
48
  # Static loader only contains runtime types
49
- return EMPTY_ARRAY unless type == :type && name_authority == name_authority = Pcore::RUNTIME_NAME_AUTHORITY
49
+ return EMPTY_ARRAY unless type == :type && name_authority == Pcore::RUNTIME_NAME_AUTHORITY
50
50
 
51
- typed_names = type == :type && name_authority == Pcore::RUNTIME_NAME_AUTHORITY ? @loaded.keys : EMPTY_ARRAY
51
+ typed_names = @loaded.keys
52
52
  block_given? ? typed_names.select { |tn| yield(tn) } : typed_names
53
53
  end
54
54
 
@@ -47,16 +47,16 @@ class ModuleDataProvider < ConfiguredDataProvider
47
47
  def validate_data_hash(data_hash)
48
48
  super
49
49
  module_prefix = "#{module_name}::"
50
- data_hash.each_key.reduce(data_hash) do |memo, k|
51
- next memo if k == LOOKUP_OPTIONS || k.start_with?(module_prefix)
52
-
53
- msg = "#{yield} must use keys qualified with the name of the module"
54
- memo = memo.clone if memo.equal?(data_hash)
55
- memo.delete(k)
56
- Puppet.warning("Module '#{module_name}': #{msg}")
57
- memo
50
+ data_hash_to_return = {}
51
+ data_hash.keys.each do |k|
52
+ if k == LOOKUP_OPTIONS || k.start_with?(module_prefix)
53
+ data_hash_to_return[k] = data_hash[k]
54
+ else
55
+ msg = "#{yield} must use keys qualified with the name of the module"
56
+ Puppet.warning("Module '#{module_name}': #{msg}; got #{k}")
57
+ end
58
58
  end
59
- data_hash
59
+ data_hash_to_return
60
60
  end
61
61
 
62
62
  protected
@@ -131,7 +131,7 @@ class Puppet::Provider::AixObject < Puppet::Provider
131
131
 
132
132
  # AIX will do the right validation to ensure numeric attributes
133
133
  # can't be set to non-numeric values, so no need for the extra clutter.
134
- info[:attribute_to_property] = lambda do |value|
134
+ info[:attribute_to_property] = lambda do |value| # rubocop:disable Style/SymbolProc
135
135
  value.to_i
136
136
  end
137
137
 
@@ -17,11 +17,20 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
17
17
  value.is_a? Integer
18
18
  end
19
19
 
20
- optional_commands :localadd => "lgroupadd", :localdelete => "lgroupdel", :localmodify => "lgroupmod"
21
-
22
- has_feature :manages_local_users_and_groups, :manages_members if Puppet.features.libuser?
23
-
24
- options :members, :flag => '-M', :method => :mem
20
+ optional_commands :localadd => "lgroupadd", :localdelete => "lgroupdel", :localmodify => "lgroupmod", :purgemember => "usermod"
21
+
22
+ has_feature :manages_local_users_and_groups if Puppet.features.libuser?
23
+ has_feature :manages_members if Puppet.features.libuser? ||
24
+ (Puppet.runtime[:facter].value('os.name') == "Fedora" &&
25
+ Puppet.runtime[:facter].value('os.release.major').to_i >= 40)
26
+
27
+ # Libuser's modify command 'lgroupmod' requires '-M' flag for member additions.
28
+ # 'groupmod' command requires the '-aU' flags for it.
29
+ if Puppet.features.libuser?
30
+ options :members, :flag => '-M', :method => :mem
31
+ else
32
+ options :members, :flag => '-aU', :method => :mem
33
+ end
25
34
 
26
35
  def exists?
27
36
  return !!localgid if @resource.forcelocal?
@@ -63,7 +72,8 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
63
72
  end
64
73
 
65
74
  def addcmd
66
- if @resource.forcelocal?
75
+ # The localadd command (lgroupadd) must only be called when libuser is supported.
76
+ if Puppet.features.libuser? && @resource.forcelocal?
67
77
  cmd = [command(:localadd)]
68
78
  @custom_environment = Puppet::Util::Libuser.getenv
69
79
  else
@@ -91,7 +101,8 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
91
101
  end
92
102
 
93
103
  def modifycmd(param, value)
94
- if @resource.forcelocal? || @resource[:members]
104
+ # The localmodify command (lgroupmod) must only be called when libuser is supported.
105
+ if Puppet.features.libuser? && (@resource.forcelocal? || @resource[:members])
95
106
  cmd = [command(:localmodify)]
96
107
  @custom_environment = Puppet::Util::Libuser.getenv
97
108
  else
@@ -114,7 +125,8 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
114
125
  end
115
126
 
116
127
  def deletecmd
117
- if @resource.forcelocal?
128
+ # The localdelete command (lgroupdel) must only be called when libuser is supported.
129
+ if Puppet.features.libuser? && @resource.forcelocal?
118
130
  @custom_environment = Puppet::Util::Libuser.getenv
119
131
  [command(:localdelete), @resource[:name]]
120
132
  else
@@ -133,7 +145,16 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe
133
145
  end
134
146
 
135
147
  def purge_members
136
- localmodify('-m', members_to_s(members), @resource.name)
148
+ # The groupadd provider doesn't have the ability currently to remove members from a group, libuser does.
149
+ # Use libuser's lgroupmod command to achieve purging members if libuser is supported.
150
+ # Otherwise use the 'usermod' command.
151
+ if Puppet.features.libuser?
152
+ localmodify('-m', members_to_s(members), @resource.name)
153
+ else
154
+ members.each do |member|
155
+ purgemember('-rG', @resource.name, member)
156
+ end
157
+ end
137
158
  end
138
159
 
139
160
  private
@@ -0,0 +1,127 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../puppet/provider/package"
4
+
5
+ Puppet::Type.type(:package).provide :xbps, :parent => Puppet::Provider::Package do
6
+ desc "Support for the Package Manager Utility (xbps) used in VoidLinux.
7
+
8
+ This provider supports the `install_options` attribute, which allows command-line flags to be passed to xbps-install.
9
+ These options should be specified as an array where each element is either a string or a hash."
10
+
11
+ commands :xbps_install => "/usr/bin/xbps-install"
12
+ commands :xbps_remove => "/usr/bin/xbps-remove"
13
+ commands :xbps_query => "/usr/bin/xbps-query"
14
+ commands :xbps_pkgdb => "/usr/bin/xbps-pkgdb"
15
+
16
+ confine 'os.name' => :void
17
+ defaultfor 'os.name' => :void
18
+ has_feature :install_options, :uninstall_options, :upgradeable, :holdable, :virtual_packages
19
+
20
+ def self.defaultto_allow_virtual
21
+ false
22
+ end
23
+
24
+ # Fetch the list of packages that are currently installed on the system.
25
+ def self.instances
26
+ packages = []
27
+ execpipe([command(:xbps_query), "-l"]) do |pipe|
28
+ # xbps-query -l output is 'ii package-name-version desc'
29
+ regex = /^\S+\s(\S+)-(\S+)\s+\S+/
30
+ pipe.each_line do |line|
31
+ match = regex.match(line.chomp)
32
+ if match
33
+ packages << new({ name: match.captures[0], ensure: match.captures[1], provider: name })
34
+ else
35
+ warning(_("Failed to match line '%{line}'") % { line: line })
36
+ end
37
+ end
38
+ end
39
+
40
+ packages
41
+ rescue Puppet::ExecutionFailure
42
+ fail(_("Error getting installed packages"))
43
+ end
44
+
45
+ # Install a package quietly (without confirmation or progress bar) using 'xbps-install'.
46
+ def install
47
+ resource_name = @resource[:name]
48
+ resource_source = @resource[:source]
49
+
50
+ cmd = %w[-S -y]
51
+ cmd += install_options if @resource[:install_options]
52
+ cmd << "--repository=#{resource_source}" if resource_source
53
+ cmd << resource_name
54
+
55
+ unhold if properties[:mark] == :hold
56
+ begin
57
+ xbps_install(*cmd)
58
+ ensure
59
+ hold if @resource[:mark] == :hold
60
+ end
61
+ end
62
+
63
+ # Because Voidlinux is a rolling release based distro, installing a package
64
+ # should always result in the newest release.
65
+ def update
66
+ install
67
+ end
68
+
69
+ # Removes a package from the system.
70
+ def uninstall
71
+ resource_name = @resource[:name]
72
+
73
+ cmd = %w[-R -y]
74
+ cmd += uninstall_options if @resource[:uninstall_options]
75
+ cmd << resource_name
76
+
77
+ xbps_remove(*cmd)
78
+ end
79
+
80
+ # The latest version of a given package
81
+ def latest
82
+ query&.[] :ensure
83
+ end
84
+
85
+ # Queries information for a package
86
+ def query
87
+ resource_name = @resource[:name]
88
+ installed_packages = self.class.instances
89
+
90
+ installed_packages.each do |pkg|
91
+ return pkg.properties if @resource[:name].casecmp(pkg.name).zero?
92
+ end
93
+
94
+ return nil unless @resource.allow_virtual?
95
+
96
+ # Search for virtual package
97
+ output = xbps_query("-Rs", resource_name).chomp
98
+
99
+ # xbps-query -Rs output is '[*] package-name-version description'
100
+ regex = /^\[\*\]+\s(\S+)-(\S+)\s+\S+/
101
+ match = regex.match(output)
102
+
103
+ return nil unless match
104
+
105
+ { name: match.captures[0], ensure: match.captures[1], provider: self.class.name }
106
+ end
107
+
108
+ # Puts a package on hold, so it doesn't update by itself on system update
109
+ def hold
110
+ xbps_pkgdb("-m", "hold", @resource[:name])
111
+ end
112
+
113
+ # Puts a package out of hold
114
+ def unhold
115
+ xbps_pkgdb("-m", "unhold", @resource[:name])
116
+ end
117
+
118
+ private
119
+
120
+ def install_options
121
+ join_options(@resource[:install_options])
122
+ end
123
+
124
+ def uninstall_options
125
+ join_options(@resource[:uninstall_options])
126
+ end
127
+ end
@@ -25,6 +25,15 @@ module Puppet::Scheduler
25
25
  end
26
26
  end
27
27
 
28
+ # Recalculates splay.
29
+ #
30
+ # @param splay_limit [Integer] the maximum time (in seconds) to delay before an agent's first run.
31
+ # @return @splay [Integer] a random integer less than or equal to the splay limit that represents the seconds to
32
+ # delay before next agent run.
33
+ def splay_limit=(splay_limit)
34
+ @splay = calculate_splay(splay_limit)
35
+ end
36
+
28
37
  private
29
38
 
30
39
  def calculate_splay(limit)
@@ -436,6 +436,14 @@ module Puppet
436
436
  back by re-extracting the tarball. If `important.tar` does **not**
437
437
  actually contain `myfile`, the exec will keep running every time
438
438
  Puppet runs.
439
+
440
+ This parameter can also take an array of files and the command will
441
+ not run if **any** of these files exist. For example:
442
+
443
+ creates => ['/tmp/file1', '/tmp/file2'],
444
+
445
+ will only run the command if both files don't exist.
446
+
439
447
  EOT
440
448
 
441
449
  accept_arrays
@@ -335,9 +335,27 @@ class CommandLine
335
335
  when /^-([^-])$/
336
336
  @short[::Regexp.last_match(1)]
337
337
  when /^--no-([^-]\S*)$/
338
- @long["[no-]#{::Regexp.last_match(1)}"]
338
+ possible_match = @long["[no-]#{::Regexp.last_match(1)}"]
339
+ if !possible_match
340
+ partial_match = @long["[no-]#{::Regexp.last_match(1).tr('-', '_')}"] || @long["[no-]#{::Regexp.last_match(1).tr('_', '-')}"]
341
+ if partial_match
342
+ Puppet.deprecation_warning _("Partial argument match detected: correct argument is %{partial_match}, got %{arg}. Partial argument matching is deprecated and will be removed in a future release.") % { arg: arg, partial_match: partial_match }
343
+ end
344
+ partial_match
345
+ else
346
+ possible_match
347
+ end
339
348
  when /^--([^-]\S*)$/
340
- @long[::Regexp.last_match(1)] || @long["[no-]#{::Regexp.last_match(1)}"]
349
+ possible_match = @long[::Regexp.last_match(1)] || @long["[no-]#{::Regexp.last_match(1)}"]
350
+ if !possible_match
351
+ partial_match = @long[::Regexp.last_match(1).tr('-', '_')] || @long[::Regexp.last_match(1).tr('_', '-')] || @long["[no-]#{::Regexp.last_match(1).tr('-', '_')}"] || @long["[no-]#{::Regexp.last_match(1).tr('_', '-')}"]
352
+ if partial_match
353
+ Puppet.deprecation_warning _("Partial argument match detected: correct argument is %{partial_match}, got %{arg}. Partial argument matching is deprecated and will be removed in a future release.") % { arg: arg, partial_match: partial_match }
354
+ end
355
+ partial_match
356
+ else
357
+ possible_match
358
+ end
341
359
  else
342
360
  raise CommandlineError, _("invalid argument syntax: '%{arg}'") % { arg: arg }
343
361
  end
@@ -7,7 +7,7 @@ module Puppet::Util::RpmCompare
7
7
  armv5tejl armv6l armv7l m68kmint s390 s390x ia64 x86_64 sh3 sh4
8
8
  ].freeze
9
9
 
10
- ARCH_REGEX = Regexp.new(ARCH_LIST.join('|\.'))
10
+ ARCH_REGEX = Regexp.new(ARCH_LIST.map { |arch| "\\.#{arch}" }.join('|'))
11
11
 
12
12
  # This is an attempt at implementing RPM's
13
13
  # lib/rpmvercmp.c rpmvercmp(a, b) in Ruby.
@@ -141,7 +141,7 @@ module Puppet::Util::Windows::COM
141
141
 
142
142
  self::VTBL.members.each do |name|
143
143
  define_method(name) do |*args|
144
- if Puppet::Util::Windows::COM.FAILED(result = @vtbl[name].call(self, *args))
144
+ if Puppet::Util::Windows::COM.FAILED((result = @vtbl[name].call(self, *args)))
145
145
  raise Puppet::Util::Windows::Error.new(_("Failed to call %{klass}::%{name} with HRESULT: %{result}.") % { klass: self, name: name, result: result }, result)
146
146
  end
147
147
 
@@ -183,7 +183,7 @@ module Puppet::Util::Windows::COM
183
183
 
184
184
  self::VTBL.members.each do |name|
185
185
  define_method(name) do |*args|
186
- if Puppet::Util::Windows::COM.FAILED(result = @vtbl[name].call(self, *args))
186
+ if Puppet::Util::Windows::COM.FAILED((result = @vtbl[name].call(self, *args)))
187
187
  raise Puppet::Util::Windows::Error.new(_("Failed to call %{klass}::%{name} with HRESULT: %{result}.") % { klass: self, name: name, result: result }, result)
188
188
  end
189
189
 
@@ -8,7 +8,7 @@
8
8
  # Raketasks and such to set the version based on the output of `git describe`
9
9
 
10
10
  module Puppet
11
- PUPPETVERSION = '8.6.0'
11
+ PUPPETVERSION = '8.7.0'
12
12
 
13
13
  ##
14
14
  # version is a public API method intended to always provide a fast and