puppet 8.7.0-universal-darwin → 8.9.0-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +57 -43
  4. data/ext/project_data.yaml +12 -0
  5. data/ext/windows/service/daemon.rb +9 -2
  6. data/install.rb +3 -74
  7. data/lib/puppet/application/apply.rb +1 -0
  8. data/lib/puppet/application/doc.rb +1 -5
  9. data/lib/puppet/application/filebucket.rb +6 -4
  10. data/lib/puppet/application/lookup.rb +2 -0
  11. data/lib/puppet/application/ssl.rb +4 -4
  12. data/lib/puppet/daemon.rb +0 -1
  13. data/lib/puppet/defaults.rb +67 -71
  14. data/lib/puppet/face/catalog.rb +24 -8
  15. data/lib/puppet/face/help.rb +43 -23
  16. data/lib/puppet/file_serving/http_metadata.rb +2 -0
  17. data/lib/puppet/functions/capitalize.rb +1 -1
  18. data/lib/puppet/functions/find_file.rb +4 -0
  19. data/lib/puppet/functions/hiera.rb +1 -0
  20. data/lib/puppet/functions/index.rb +2 -2
  21. data/lib/puppet/functions/lookup.rb +1 -1
  22. data/lib/puppet/functions/new.rb +1 -1
  23. data/lib/puppet/functions/regsubst.rb +11 -14
  24. data/lib/puppet/functions/unique.rb +3 -2
  25. data/lib/puppet/functions/yaml_data.rb +1 -0
  26. data/lib/puppet/indirector/catalog/compiler.rb +2 -35
  27. data/lib/puppet/interface/action_manager.rb +1 -1
  28. data/lib/puppet/module_tool/tar/gnu.rb +10 -8
  29. data/lib/puppet/node/server_facts.rb +43 -0
  30. data/lib/puppet/parser/functions/generate.rb +2 -1
  31. data/lib/puppet/pops/evaluator/deferred_resolver.rb +41 -6
  32. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
  33. data/lib/puppet/pops/evaluator/runtime3_support.rb +0 -6
  34. data/lib/puppet/provider/file/posix.rb +16 -2
  35. data/lib/puppet/provider/package/gem.rb +1 -0
  36. data/lib/puppet/provider/package/pacman.rb +9 -10
  37. data/lib/puppet/provider/package/pkgutil.rb +6 -5
  38. data/lib/puppet/provider/package/puppet_gem.rb +4 -15
  39. data/lib/puppet/reference/configuration.rb +6 -1
  40. data/lib/puppet/resource/type.rb +15 -1
  41. data/lib/puppet/scheduler/splay_job.rb +0 -9
  42. data/lib/puppet/settings.rb +2 -2
  43. data/lib/puppet/transaction/resource_harness.rb +7 -3
  44. data/lib/puppet/type/exec.rb +3 -4
  45. data/lib/puppet/type/file/checksum.rb +4 -2
  46. data/lib/puppet/type/file/ctime.rb +2 -2
  47. data/lib/puppet/type/file/mtime.rb +2 -2
  48. data/lib/puppet/type/file/selcontext.rb +8 -7
  49. data/lib/puppet/type/file/target.rb +9 -11
  50. data/lib/puppet/type/package.rb +4 -3
  51. data/lib/puppet/type/user.rb +1 -1
  52. data/lib/puppet/util/checksums.rb +1 -0
  53. data/lib/puppet/util/execution.rb +1 -1
  54. data/lib/puppet/util/profiler/aggregate.rb +2 -2
  55. data/lib/puppet/util/profiler/wall_clock.rb +2 -2
  56. data/lib/puppet/util/reference.rb +1 -31
  57. data/lib/puppet/util/run_mode.rb +40 -0
  58. data/lib/puppet/util/selinux.rb +38 -16
  59. data/lib/puppet/util/windows/daemon.rb +15 -32
  60. data/lib/puppet/version.rb +1 -1
  61. data/locales/puppet.pot +141 -145
  62. data/man/man5/puppet.conf.5 +18 -18
  63. data/man/man8/puppet-agent.8 +1 -1
  64. data/man/man8/puppet-apply.8 +2 -1
  65. data/man/man8/puppet-catalog.8 +5 -2
  66. data/man/man8/puppet-config.8 +1 -1
  67. data/man/man8/puppet-describe.8 +1 -1
  68. data/man/man8/puppet-device.8 +1 -1
  69. data/man/man8/puppet-doc.8 +1 -1
  70. data/man/man8/puppet-epp.8 +1 -1
  71. data/man/man8/puppet-facts.8 +1 -1
  72. data/man/man8/puppet-filebucket.8 +10 -1
  73. data/man/man8/puppet-generate.8 +1 -1
  74. data/man/man8/puppet-help.8 +1 -1
  75. data/man/man8/puppet-lookup.8 +1 -1
  76. data/man/man8/puppet-module.8 +1 -1
  77. data/man/man8/puppet-node.8 +1 -1
  78. data/man/man8/puppet-parser.8 +1 -1
  79. data/man/man8/puppet-plugin.8 +1 -1
  80. data/man/man8/puppet-report.8 +1 -1
  81. data/man/man8/puppet-resource.8 +1 -1
  82. data/man/man8/puppet-script.8 +1 -1
  83. data/man/man8/puppet-ssl.8 +3 -3
  84. data/man/man8/puppet.8 +128 -9
  85. metadata +44 -29
@@ -13,7 +13,7 @@ class Puppet::Util::Reference
13
13
  instance_load(:reference, 'puppet/reference')
14
14
 
15
15
  def self.modes
16
- %w[pdf text]
16
+ %w[text]
17
17
  end
18
18
 
19
19
  def self.newreference(name, options = {}, &block)
@@ -32,35 +32,6 @@ class Puppet::Util::Reference
32
32
  end
33
33
  end
34
34
 
35
- def self.pdf(text)
36
- puts _("creating pdf")
37
- rst2latex = which('rst2latex') || which('rst2latex.py') ||
38
- raise(_("Could not find rst2latex"))
39
-
40
- cmd = %(#{rst2latex} /tmp/puppetdoc.txt > /tmp/puppetdoc.tex)
41
- Puppet::Util.replace_file("/tmp/puppetdoc.txt") { |f| f.puts text }
42
- # There used to be an attempt to use secure_open / replace_file to secure
43
- # the target, too, but that did nothing: the race was still here. We can
44
- # get exactly the same benefit from running this effort:
45
- begin
46
- Puppet::FileSystem.unlink('/tmp/puppetdoc.tex')
47
- rescue
48
- nil
49
- end
50
- output = %x(#{cmd})
51
- unless $CHILD_STATUS == 0
52
- $stderr.puts _("rst2latex failed")
53
- $stderr.puts output
54
- exit(1)
55
- end
56
- $stderr.puts output
57
-
58
- # Now convert to pdf
59
- Dir.chdir("/tmp") do
60
- %x(texi2pdf puppetdoc.tex >/dev/null 2>/dev/null)
61
- end
62
- end
63
-
64
35
  def self.references(environment)
65
36
  instance_loader(:reference).loadall(environment)
66
37
  loaded_instances(:reference).sort_by(&:to_s)
@@ -113,7 +84,6 @@ class Puppet::Util::Reference
113
84
  def to_markdown(withcontents = true)
114
85
  # First the header
115
86
  text = markdown_header(@title, 1)
116
- text << _("\n\n**This page is autogenerated; any changes will get overwritten**\n\n")
117
87
 
118
88
  text << @header
119
89
 
@@ -87,6 +87,22 @@ module Puppet
87
87
  def log_dir
88
88
  which_dir("/var/log/puppetlabs/puppet", "~/.puppetlabs/var/log")
89
89
  end
90
+
91
+ def pkg_config_path
92
+ '/opt/puppetlabs/puppet/lib/pkgconfig'
93
+ end
94
+
95
+ def gem_cmd
96
+ '/opt/puppetlabs/puppet/bin/gem'
97
+ end
98
+
99
+ def common_module_dir
100
+ '/opt/puppetlabs/puppet/modules'
101
+ end
102
+
103
+ def vendor_module_dir
104
+ '/opt/puppetlabs/puppet/vendor_modules'
105
+ end
90
106
  end
91
107
 
92
108
  class WindowsRunMode < RunMode
@@ -114,8 +130,32 @@ module Puppet
114
130
  which_dir(File.join(windows_common_base("puppet/var/log")), "~/.puppetlabs/var/log")
115
131
  end
116
132
 
133
+ def pkg_config_path
134
+ nil
135
+ end
136
+
137
+ def gem_cmd
138
+ if (puppet_dir = ENV.fetch('PUPPET_DIR', nil))
139
+ File.join(puppet_dir.to_s, 'bin', 'gem.bat')
140
+ else
141
+ File.join(Gem.default_bindir, 'gem.bat')
142
+ end
143
+ end
144
+
145
+ def common_module_dir
146
+ "#{installdir}/puppet/modules" if installdir
147
+ end
148
+
149
+ def vendor_module_dir
150
+ "#{installdir}\\puppet\\vendor_modules" if installdir
151
+ end
152
+
117
153
  private
118
154
 
155
+ def installdir
156
+ ENV.fetch('FACTER_env_windows_installdir', nil)
157
+ end
158
+
119
159
  def windows_common_base(*extra)
120
160
  [ENV.fetch('ALLUSERSPROFILE', nil), "PuppetLabs"] + extra
121
161
  end
@@ -46,6 +46,7 @@ module Puppet::Util::SELinux
46
46
 
47
47
  # Retrieve and return the default context of the file. If we don't have
48
48
  # SELinux support or if the SELinux call fails to file a default then return nil.
49
+ # @deprecated matchpathcon is a deprecated method, selabel_lookup is preferred
49
50
  def get_selinux_default_context(file, resource_ensure = nil)
50
51
  return nil unless selinux_support?
51
52
  # If the filesystem has no support for SELinux labels, return a default of nil
@@ -54,25 +55,30 @@ module Puppet::Util::SELinux
54
55
 
55
56
  # If the file exists we should pass the mode to matchpathcon for the most specific
56
57
  # matching. If not, we can pass a mode of 0.
57
- begin
58
- filestat = file_lstat(file)
59
- mode = filestat.mode
60
- rescue Errno::EACCES
61
- mode = 0
62
- rescue Errno::ENOENT
63
- if resource_ensure
64
- mode = get_create_mode(resource_ensure)
65
- else
66
- mode = 0
67
- end
68
- end
58
+ mode = file_mode(file, resource_ensure)
69
59
 
70
60
  retval = Selinux.matchpathcon(file, mode)
71
- if retval == -1
72
- return nil
73
- end
61
+ retval == -1 ? nil : retval[1]
62
+ end
74
63
 
75
- retval[1]
64
+ # Retrieve and return the default context of the file using an selinux handle.
65
+ # If we don't have SELinux support or if the SELinux call fails to file a
66
+ # default then return nil.
67
+ def get_selinux_default_context_with_handle(file, handle, resource_ensure = nil)
68
+ return nil unless selinux_support?
69
+ # If the filesystem has no support for SELinux labels, return a default of nil
70
+ # instead of what selabel_lookup would return
71
+ return nil unless selinux_label_support?(file)
72
+
73
+ # Handle is needed for selabel_lookup
74
+ raise ArgumentError, _("Cannot get default context with nil handle") unless handle
75
+
76
+ # If the file exists we should pass the mode to selabel_lookup for the most specific
77
+ # matching. If not, we can pass a mode of 0.
78
+ mode = file_mode(file, resource_ensure)
79
+
80
+ retval = Selinux.selabel_lookup(handle, file, mode)
81
+ retval == -1 ? nil : retval[1]
76
82
  end
77
83
 
78
84
  # Take the full SELinux context returned from the tools and parse it
@@ -235,6 +241,22 @@ module Puppet::Util::SELinux
235
241
  mode
236
242
  end
237
243
 
244
+ # If the file/directory/symlink exists, return its mode. Otherwise, get the default mode
245
+ # that should be used to create the file/directory/symlink taking into account the desired
246
+ # file type specified in +resource_ensure+.
247
+ def file_mode(file, resource_ensure)
248
+ filestat = file_lstat(file)
249
+ filestat.mode
250
+ rescue Errno::EACCES
251
+ 0
252
+ rescue Errno::ENOENT
253
+ if resource_ensure
254
+ get_create_mode(resource_ensure)
255
+ else
256
+ 0
257
+ end
258
+ end
259
+
238
260
  # Internal helper function to read and parse /proc/mounts
239
261
  def read_mounts
240
262
  mounts = ''.dup
@@ -187,25 +187,6 @@ module Puppet::Util::Windows
187
187
  SetTheServiceStatus.call(SERVICE_STOPPED, NO_ERROR, 0, 0)
188
188
  end
189
189
 
190
- ThreadProc = FFI::Function.new(:ulong, [:pointer]) do |lpParameter|
191
- ste = FFI::MemoryPointer.new(SERVICE_TABLE_ENTRYW, 2)
192
-
193
- s = SERVICE_TABLE_ENTRYW.new(ste[0])
194
- s[:lpServiceName] = FFI::MemoryPointer.from_string('')
195
- s[:lpServiceProc] = lpParameter
196
-
197
- s = SERVICE_TABLE_ENTRYW.new(ste[1])
198
- s[:lpServiceName] = nil
199
- s[:lpServiceProc] = nil
200
-
201
- # No service to step, no service handle, no ruby exceptions, just terminate the thread..
202
- unless StartServiceCtrlDispatcherW(ste)
203
- return 1
204
- end
205
-
206
- return 0
207
- end
208
-
209
190
  # This is a shortcut for Daemon.new + Daemon#mainloop.
210
191
  #
211
192
  def self.mainloop
@@ -255,26 +236,28 @@ module Puppet::Util::Windows
255
236
  raise SystemCallError.new('CreateEvent', FFI.errno)
256
237
  end
257
238
 
258
- hThread = CreateThread(nil, 0, ThreadProc, Service_Main, 0, nil)
239
+ hThread = Thread.new do
240
+ ste = FFI::MemoryPointer.new(SERVICE_TABLE_ENTRYW, 2)
259
241
 
260
- if hThread == 0
261
- raise SystemCallError.new('CreateThread', FFI.errno)
262
- end
242
+ s = SERVICE_TABLE_ENTRYW.new(ste[0])
243
+ s[:lpServiceName] = FFI::MemoryPointer.from_string("")
244
+ s[:lpServiceProc] = Service_Main
263
245
 
264
- events = FFI::MemoryPointer.new(:pointer, 2)
265
- events.put_pointer(0, FFI::Pointer.new(hThread))
266
- events.put_pointer(FFI::Pointer.size, FFI::Pointer.new(@@hStartEvent))
246
+ s = SERVICE_TABLE_ENTRYW.new(ste[1])
247
+ s[:lpServiceName] = nil
248
+ s[:lpServiceProc] = nil
267
249
 
268
- while (index = WaitForMultipleObjects(2, events, 0, 1000)) == WAIT_TIMEOUT
250
+ # No service to step, no service handle, no ruby exceptions, just terminate the thread..
251
+ StartServiceCtrlDispatcherW(ste)
269
252
  end
270
253
 
271
- if index == WAIT_FAILED
272
- raise SystemCallError.new('WaitForMultipleObjects', FFI.errno)
254
+ while (index = WaitForSingleObject(@@hStartEvent, 1000)) == WAIT_TIMEOUT
255
+ # The thread exited, so the show is off.
256
+ raise "Service_Main thread exited abnormally" unless hThread.alive?
273
257
  end
274
258
 
275
- # The thread exited, so the show is off.
276
- if index == WAIT_OBJECT_0
277
- raise "Service_Main thread exited abnormally"
259
+ if index == WAIT_FAILED
260
+ raise SystemCallError.new("WaitForSingleObject", FFI.errno)
278
261
  end
279
262
 
280
263
  thr = Thread.new do
@@ -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.7.0'
11
+ PUPPETVERSION = '8.9.0'
12
12
 
13
13
  ##
14
14
  # version is a public API method intended to always provide a fast and