puppet 2.7.9 → 2.7.11

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 (187) hide show
  1. data/CHANGELOG +413 -0
  2. data/README_DEVELOPER.md +28 -0
  3. data/conf/redhat/puppet.spec +10 -1
  4. data/conf/solaris/pkginfo +1 -1
  5. data/conf/suse/puppet.spec +7 -4
  6. data/ext/envpuppet.bat +13 -0
  7. data/ext/rack/files/apache2.conf +4 -0
  8. data/install.rb +4 -8
  9. data/lib/puppet.rb +1 -1
  10. data/lib/puppet/agent.rb +7 -0
  11. data/lib/puppet/agent/disabler.rb +27 -0
  12. data/lib/puppet/agent/locker.rb +0 -10
  13. data/lib/puppet/application.rb +3 -0
  14. data/lib/puppet/application/agent.rb +13 -3
  15. data/lib/puppet/application/apply.rb +6 -6
  16. data/lib/puppet/application/cert.rb +5 -5
  17. data/lib/puppet/application/instrumentation_data.rb +4 -0
  18. data/lib/puppet/application/instrumentation_listener.rb +4 -0
  19. data/lib/puppet/application/instrumentation_probe.rb +4 -0
  20. data/lib/puppet/configurer.rb +3 -1
  21. data/lib/puppet/configurer/downloader.rb +4 -2
  22. data/lib/puppet/configurer/fact_handler.rb +0 -21
  23. data/lib/puppet/daemon.rb +3 -4
  24. data/lib/puppet/defaults.rb +2 -2
  25. data/lib/puppet/face/instrumentation_data.rb +28 -0
  26. data/lib/puppet/face/instrumentation_listener.rb +96 -0
  27. data/lib/puppet/face/instrumentation_probe.rb +77 -0
  28. data/lib/puppet/face/module/list.rb +64 -0
  29. data/lib/puppet/face/module/uninstall.rb +50 -0
  30. data/lib/puppet/face/node/clean.rb +1 -4
  31. data/lib/puppet/feature/base.rb +1 -0
  32. data/lib/puppet/file_serving/content.rb +1 -1
  33. data/lib/puppet/indirector/facts/facter.rb +20 -7
  34. data/lib/puppet/indirector/facts/inventory_active_record.rb +14 -11
  35. data/lib/puppet/indirector/indirection.rb +7 -0
  36. data/lib/puppet/indirector/instrumentation_data.rb +3 -0
  37. data/lib/puppet/indirector/instrumentation_data/local.rb +19 -0
  38. data/lib/puppet/indirector/instrumentation_data/rest.rb +5 -0
  39. data/lib/puppet/indirector/instrumentation_listener.rb +3 -0
  40. data/lib/puppet/indirector/instrumentation_listener/local.rb +23 -0
  41. data/lib/puppet/indirector/instrumentation_listener/rest.rb +5 -0
  42. data/lib/puppet/indirector/instrumentation_probe.rb +3 -0
  43. data/lib/puppet/indirector/instrumentation_probe/local.rb +24 -0
  44. data/lib/puppet/indirector/instrumentation_probe/rest.rb +5 -0
  45. data/lib/puppet/indirector/rest.rb +1 -1
  46. data/lib/puppet/module.rb +13 -17
  47. data/lib/puppet/module_tool/applications.rb +1 -0
  48. data/lib/puppet/module_tool/applications/uninstaller.rb +33 -0
  49. data/lib/puppet/module_tool/contents_description.rb +1 -1
  50. data/lib/puppet/network/server.rb +2 -3
  51. data/lib/puppet/node/environment.rb +16 -3
  52. data/lib/puppet/parser/ast/leaf.rb +1 -1
  53. data/lib/puppet/parser/functions/create_resources.rb +1 -1
  54. data/lib/puppet/parser/type_loader.rb +1 -1
  55. data/lib/puppet/property.rb +46 -14
  56. data/lib/puppet/provider.rb +13 -4
  57. data/lib/puppet/provider/augeas/augeas.rb +6 -4
  58. data/lib/puppet/provider/group/pw.rb +24 -10
  59. data/lib/puppet/provider/nameservice/directoryservice.rb +146 -37
  60. data/lib/puppet/provider/package/pip.rb +1 -1
  61. data/lib/puppet/provider/package/yum.rb +1 -2
  62. data/lib/puppet/provider/service/debian.rb +14 -0
  63. data/lib/puppet/provider/service/launchd.rb +1 -1
  64. data/lib/puppet/provider/service/smf.rb +2 -2
  65. data/lib/puppet/provider/user/pw.rb +56 -2
  66. data/lib/puppet/provider/user/user_role_add.rb +32 -22
  67. data/lib/puppet/provider/user/windows_adsi.rb +1 -0
  68. data/lib/puppet/rails/benchmark.rb +1 -1
  69. data/lib/puppet/reports/store.rb +8 -1
  70. data/lib/puppet/resource/catalog.rb +5 -1
  71. data/lib/puppet/simple_graph.rb +11 -14
  72. data/lib/puppet/transaction.rb +10 -4
  73. data/lib/puppet/transaction/report.rb +9 -3
  74. data/lib/puppet/type.rb +19 -7
  75. data/lib/puppet/type/exec.rb +1 -1
  76. data/lib/puppet/type/file.rb +4 -1
  77. data/lib/puppet/type/file/ensure.rb +5 -1
  78. data/lib/puppet/type/file/mode.rb +45 -10
  79. data/lib/puppet/type/file/source.rb +4 -0
  80. data/lib/puppet/type/host.rb +17 -3
  81. data/lib/puppet/type/k5login.rb +3 -2
  82. data/lib/puppet/type/schedule.rb +3 -2
  83. data/lib/puppet/util.rb +83 -27
  84. data/lib/puppet/util/anonymous_filelock.rb +36 -0
  85. data/lib/puppet/util/docs.rb +18 -2
  86. data/lib/puppet/util/instrumentation.rb +173 -0
  87. data/lib/puppet/util/instrumentation/data.rb +34 -0
  88. data/lib/puppet/util/instrumentation/indirection_probe.rb +29 -0
  89. data/lib/puppet/util/instrumentation/instrumentable.rb +143 -0
  90. data/lib/puppet/util/instrumentation/listener.rb +60 -0
  91. data/lib/puppet/util/instrumentation/listeners/log.rb +29 -0
  92. data/lib/puppet/util/instrumentation/listeners/performance.rb +30 -0
  93. data/lib/puppet/util/monkey_patches.rb +8 -0
  94. data/lib/puppet/util/pidlock.rb +21 -25
  95. data/lib/puppet/util/rdoc/parser.rb +2 -2
  96. data/lib/puppet/util/reference.rb +8 -23
  97. data/lib/puppet/util/retryaction.rb +48 -0
  98. data/lib/puppet/util/suidmanager.rb +70 -39
  99. data/lib/puppet/util/symbolic_file_mode.rb +140 -0
  100. data/spec/integration/configurer_spec.rb +5 -0
  101. data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
  102. data/spec/integration/indirector/file_content/file_server_spec.rb +7 -7
  103. data/spec/integration/provider/package_spec.rb +7 -0
  104. data/spec/unit/agent/disabler_spec.rb +60 -0
  105. data/spec/unit/agent/locker_spec.rb +0 -12
  106. data/spec/unit/agent_spec.rb +8 -0
  107. data/spec/unit/application/agent_spec.rb +38 -1
  108. data/spec/unit/application/apply_spec.rb +34 -40
  109. data/spec/unit/application/cert_spec.rb +1 -1
  110. data/spec/unit/application_spec.rb +6 -0
  111. data/spec/unit/configurer/downloader_spec.rb +29 -10
  112. data/spec/unit/configurer/fact_handler_spec.rb +5 -29
  113. data/spec/unit/configurer_spec.rb +8 -8
  114. data/spec/unit/daemon_spec.rb +12 -26
  115. data/spec/unit/face/instrumentation_data.rb +7 -0
  116. data/spec/unit/face/instrumentation_listener.rb +38 -0
  117. data/spec/unit/face/instrumentation_probe.rb +21 -0
  118. data/spec/unit/face/node_spec.rb +111 -111
  119. data/spec/unit/file_serving/content_spec.rb +2 -2
  120. data/spec/unit/indirector/facts/facter_spec.rb +25 -3
  121. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +14 -4
  122. data/spec/unit/indirector/instrumentation_data/local_spec.rb +52 -0
  123. data/spec/unit/indirector/instrumentation_data/rest_spec.rb +11 -0
  124. data/spec/unit/indirector/instrumentation_listener/local_spec.rb +65 -0
  125. data/spec/unit/indirector/instrumentation_listener/rest_spec.rb +11 -0
  126. data/spec/unit/indirector/instrumentation_probe/local_spec.rb +65 -0
  127. data/spec/unit/indirector/instrumentation_probe/rest_spec.rb +11 -0
  128. data/spec/unit/module_spec.rb +39 -125
  129. data/spec/unit/module_tool/uninstaller_spec.rb +44 -0
  130. data/spec/unit/network/server_spec.rb +2 -20
  131. data/spec/unit/node/environment_spec.rb +76 -58
  132. data/spec/unit/parser/ast/asthash_spec.rb +1 -2
  133. data/spec/unit/parser/ast/leaf_spec.rb +16 -0
  134. data/spec/unit/property/keyvalue_spec.rb +5 -2
  135. data/spec/unit/property_spec.rb +260 -159
  136. data/spec/unit/provider/augeas/augeas_spec.rb +2 -2
  137. data/spec/unit/provider/group/pw_spec.rb +81 -0
  138. data/spec/unit/provider/nameservice/directoryservice_spec.rb +102 -0
  139. data/spec/unit/provider/package/pip_spec.rb +7 -0
  140. data/spec/unit/provider/package/yum_spec.rb +45 -1
  141. data/spec/unit/provider/service/debian_spec.rb +15 -0
  142. data/spec/unit/provider/service/launchd_spec.rb +48 -43
  143. data/spec/unit/provider/service/smf_spec.rb +3 -3
  144. data/spec/unit/provider/user/pw_spec.rb +183 -0
  145. data/spec/unit/provider/user/user_role_add_spec.rb +46 -39
  146. data/spec/unit/provider/user/windows_adsi_spec.rb +1 -0
  147. data/spec/unit/provider_spec.rb +32 -0
  148. data/spec/unit/reports/store_spec.rb +19 -1
  149. data/spec/unit/simple_graph_spec.rb +34 -19
  150. data/spec/unit/ssl/certificate_factory_spec.rb +3 -3
  151. data/spec/unit/transaction/report_spec.rb +29 -1
  152. data/spec/unit/transaction_spec.rb +32 -46
  153. data/spec/unit/type/file/mode_spec.rb +1 -1
  154. data/spec/unit/type/file/source_spec.rb +28 -3
  155. data/spec/unit/type/file_spec.rb +17 -16
  156. data/spec/unit/type/host_spec.rb +527 -0
  157. data/spec/unit/type/k5login_spec.rb +115 -0
  158. data/spec/unit/type/schedule_spec.rb +6 -6
  159. data/spec/unit/type_spec.rb +51 -0
  160. data/spec/unit/util/anonymous_filelock_spec.rb +78 -0
  161. data/spec/unit/util/execution_stub_spec.rb +2 -1
  162. data/spec/unit/util/instrumentation/data_spec.rb +44 -0
  163. data/spec/unit/util/instrumentation/indirection_probe_spec.rb +19 -0
  164. data/spec/unit/util/instrumentation/instrumentable_spec.rb +186 -0
  165. data/spec/unit/util/instrumentation/listener_spec.rb +100 -0
  166. data/spec/unit/util/instrumentation/listeners/log_spec.rb +34 -0
  167. data/spec/unit/util/instrumentation/listeners/performance_spec.rb +36 -0
  168. data/spec/unit/util/instrumentation_spec.rb +181 -0
  169. data/spec/unit/util/pidlock_spec.rb +208 -0
  170. data/spec/unit/util/rdoc/parser_spec.rb +1 -1
  171. data/spec/unit/util/reference_spec.rb +16 -6
  172. data/spec/unit/util/retryaction_spec.rb +62 -0
  173. data/spec/unit/util/suidmanager_spec.rb +101 -83
  174. data/spec/unit/util/symbolic_file_mode_spec.rb +182 -0
  175. data/spec/unit/util_spec.rb +126 -0
  176. data/tasks/rake/apple.rake +176 -0
  177. data/tasks/rake/templates/prototype.plist.erb +38 -0
  178. metadata +61 -13
  179. data/lib/puppet/application/module.rb +0 -3
  180. data/lib/puppet/face/module.rb +0 -12
  181. data/spec/unit/face/module/build_spec.rb +0 -30
  182. data/spec/unit/face/module/changes_spec.rb +0 -30
  183. data/spec/unit/face/module/clean_spec.rb +0 -30
  184. data/spec/unit/face/module/generate_spec.rb +0 -30
  185. data/spec/unit/face/module/install_spec.rb +0 -75
  186. data/spec/unit/face/module/search_spec.rb +0 -40
  187. data/test/util/pidlock.rb +0 -126
@@ -0,0 +1,28 @@
1
+ require 'puppet/indirector/face'
2
+
3
+ Puppet::Indirector::Face.define(:instrumentation_data, '0.0.1') do
4
+ copyright "Puppet Labs", 2011
5
+ license "Apache 2 license; see COPYING"
6
+
7
+ summary "Manage instrumentation listener accumulated data."
8
+ description <<-EOT
9
+ This subcommand allows to retrieve the various listener data.
10
+ EOT
11
+
12
+ get_action(:destroy).summary "Invalid for this subcommand."
13
+ get_action(:save).summary "Invalid for this subcommand."
14
+ get_action(:search).summary "Invalid for this subcommand."
15
+
16
+ find = get_action(:find)
17
+ find.summary "Retrieve listener data."
18
+ find.render_as = :pson
19
+ find.returns <<-EOT
20
+ The data of an instrumentation listener
21
+ EOT
22
+ find.examples <<-EOT
23
+ Retrieve listener data:
24
+
25
+ $ puppet instrumentation_data find performance --terminus rest
26
+ EOT
27
+
28
+ end
@@ -0,0 +1,96 @@
1
+ require 'puppet/indirector/face'
2
+
3
+ Puppet::Indirector::Face.define(:instrumentation_listener, '0.0.1') do
4
+ copyright "Puppet Labs", 2011
5
+ license "Apache 2 license; see COPYING"
6
+
7
+ summary "Manage instrumentation listeners."
8
+ description <<-EOT
9
+ This subcommand enables/disables or list instrumentation listeners.
10
+ EOT
11
+
12
+ get_action(:destroy).summary "Invalid for this subcommand."
13
+
14
+ find = get_action(:find)
15
+ find.summary "Retrieve a single listener."
16
+ find.render_as = :pson
17
+ find.returns <<-EOT
18
+ The status of an instrumentation listener
19
+ EOT
20
+ find.examples <<-EOT
21
+ Retrieve a given listener:
22
+
23
+ $ puppet instrumentation_listener find performance --terminus rest
24
+ EOT
25
+
26
+ search = get_action(:search)
27
+ search.summary "Retrieve all instrumentation listeners statuses."
28
+ search.arguments "<dummy_text>"
29
+ search.render_as = :pson
30
+ search.returns <<-EOT
31
+ The statuses of all instrumentation listeners
32
+ EOT
33
+ search.short_description <<-EOT
34
+ This retrieves all instrumentation listeners
35
+ EOT
36
+ search.notes <<-EOT
37
+ Although this action always returns all instrumentation listeners, it requires a dummy search
38
+ key; this is a known bug.
39
+ EOT
40
+ search.examples <<-EOT
41
+ Retrieve the state of the listeners running in the remote puppet master:
42
+
43
+ $ puppet instrumentation_listener search x --terminus rest
44
+ EOT
45
+
46
+ def manage(name, activate)
47
+ Puppet::Util::Instrumentation::Listener.indirection.terminus_class = :rest
48
+ listener = Puppet::Face[:instrumentation_listener, '0.0.1'].find(name)
49
+ if listener
50
+ listener.enabled = activate
51
+ Puppet::Face[:instrumentation_listener, '0.0.1'].save(listener)
52
+ end
53
+ end
54
+
55
+ action :enable do
56
+ summary "Enable a given instrumentation listener."
57
+ arguments "<listener>"
58
+ returns "Nothing."
59
+ description <<-EOT
60
+ Enable a given instrumentation listener. After being enabled the listener
61
+ will start receiving instrumentation notifications from the probes if those
62
+ are enabled.
63
+ EOT
64
+ examples <<-EOT
65
+ Enable the "performance" listener in the running master:
66
+
67
+ $ puppet instrumentation_listener enable performance --terminus rest
68
+ EOT
69
+
70
+ when_invoked do |name, options|
71
+ manage(name, true)
72
+ end
73
+ end
74
+
75
+ action :disable do
76
+ summary "Disable a given instrumentation listener."
77
+ arguments "<listener>"
78
+ returns "Nothing."
79
+ description <<-EOT
80
+ Disable a given instrumentation listener. After being disabled the listener
81
+ will stop receiving instrumentation notifications from the probes.
82
+ EOT
83
+ examples <<-EOT
84
+ Disable the "performance" listener in the running master:
85
+
86
+ $ puppet instrumentation_listener disable performance --terminus rest
87
+ EOT
88
+
89
+ when_invoked do |name, options|
90
+ manage(name, false)
91
+ end
92
+ end
93
+
94
+ get_action(:save).summary "API only: modify an instrumentation listener status."
95
+ get_action(:save).arguments "<listener>"
96
+ end
@@ -0,0 +1,77 @@
1
+ require 'puppet/indirector/face'
2
+
3
+ Puppet::Indirector::Face.define(:instrumentation_probe, '0.0.1') do
4
+ copyright "Puppet Labs", 2011
5
+ license "Apache 2 license; see COPYING"
6
+
7
+ summary "Manage instrumentation probes."
8
+ description <<-EOT
9
+ This subcommand enables/disables or list instrumentation listeners.
10
+ EOT
11
+
12
+ get_action(:find).summary "Invalid for this subcommand."
13
+
14
+ search = get_action(:search)
15
+ search.summary "Retrieve all probe statuses."
16
+ search.arguments "<dummy_text>"
17
+ search.render_as = :pson
18
+ search.returns <<-EOT
19
+ The statuses of all instrumentation probes
20
+ EOT
21
+ search.short_description <<-EOT
22
+ This retrieves all instrumentation probes
23
+ EOT
24
+ search.notes <<-EOT
25
+ Although this action always returns all instrumentation probes, it requires a dummy search
26
+ key; this is a known bug.
27
+ EOT
28
+ search.examples <<-EOT
29
+ Retrieve the state of the probes running in the remote puppet master:
30
+
31
+ $ puppet instrumentation_probe search x --terminus rest
32
+ EOT
33
+
34
+ action :enable do
35
+ summary "Enable all instrumentation probes."
36
+ arguments "<dummy>"
37
+ returns "Nothing."
38
+ description <<-EOT
39
+ Enable all instrumentation probes. After being enabled, all enabled listeners
40
+ will start receiving instrumentation notifications from the probes.
41
+ EOT
42
+ examples <<-EOT
43
+ Enable the probes for the running master:
44
+
45
+ $ puppet instrumentation_probe enable x --terminus rest
46
+ EOT
47
+
48
+ when_invoked do |name, options|
49
+ Puppet::Face[:instrumentation_probe, '0.0.1'].save(nil)
50
+ end
51
+ end
52
+
53
+ action :disable do
54
+ summary "Disable all instrumentation probes."
55
+ arguments "<dummy>"
56
+ returns "Nothing."
57
+ description <<-EOT
58
+ Disable all instrumentation probes. After being disabled, no listeners
59
+ will receive instrumentation notifications.
60
+ EOT
61
+ examples <<-EOT
62
+ Disable the probes for the running master:
63
+
64
+ $ puppet instrumentation_probe disable x --terminus rest
65
+ EOT
66
+
67
+ when_invoked do |name, options|
68
+ Puppet::Face[:instrumentation_probe, '0.0.1'].destroy(nil)
69
+ end
70
+ end
71
+
72
+ get_action(:save).summary "API only: enable all instrumentation probes."
73
+ get_action(:save).arguments "<dummy>"
74
+
75
+ get_action(:destroy).summary "API only: disable all instrumentation probes."
76
+ get_action(:destroy).arguments "<dummy>"
77
+ end
@@ -0,0 +1,64 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:list) do
3
+ summary "List installed modules"
4
+ description <<-HEREDOC
5
+ List puppet modules from a specific environment, specified modulepath or
6
+ default to listing modules in the default modulepath:
7
+ #{Puppet.settings[:modulepath]}
8
+ HEREDOC
9
+ returns "hash of paths to module objects"
10
+
11
+ option "--env ENVIRONMENT" do
12
+ summary "Which environments' modules to list"
13
+ end
14
+
15
+ option "--modulepath MODULEPATH" do
16
+ summary "Which directories to look for modules in"
17
+ end
18
+
19
+ examples <<-EOT
20
+ List installed modules:
21
+
22
+ $ puppet module list
23
+ /etc/puppet/modules
24
+ bacula (0.0.2)
25
+ /usr/share/puppet/modules
26
+ apache (0.0.3)
27
+ bacula (0.0.1)
28
+
29
+ List installed modules from a specified environment:
30
+
31
+ $ puppet module list --env 'test'
32
+ /tmp/puppet/modules
33
+ rrd (0.0.2)
34
+
35
+ List installed modules from a specified modulepath:
36
+
37
+ $ puppet module list --modulepath /tmp/facts1:/tmp/facts2
38
+ /tmp/facts1
39
+ stdlib
40
+ /tmp/facts2
41
+ nginx (1.0.0)
42
+ EOT
43
+
44
+ when_invoked do |options|
45
+ Puppet[:modulepath] = options[:modulepath] if options[:modulepath]
46
+ environment = Puppet::Node::Environment.new(options[:env])
47
+
48
+ environment.modules_by_path
49
+ end
50
+
51
+ when_rendering :console do |modules_by_path|
52
+ output = ''
53
+ modules_by_path.each do |path, modules|
54
+ output << "#{path}\n"
55
+ modules.each do |mod|
56
+ version_string = mod.version ? "(#{mod.version})" : ''
57
+ output << " #{mod.name} #{version_string}\n"
58
+ end
59
+ end
60
+ output
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,50 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:uninstall) do
3
+ summary "Uninstall a puppet module."
4
+ description <<-EOT
5
+ Uninstall a puppet module from the modulepath or a specific
6
+ target directory which defaults to
7
+ #{Puppet.settings[:modulepath].split(File::PATH_SEPARATOR).join(', ')}.
8
+ EOT
9
+
10
+ returns "Array of strings representing paths of uninstalled files."
11
+
12
+ examples <<-EOT
13
+ Uninstall a module from all directories in the modulepath:
14
+
15
+ $ puppet module uninstall ssh
16
+ Removed /etc/puppet/modules/ssh
17
+
18
+ Uninstall a module from a specific directory:
19
+
20
+ $ puppet module uninstall --target-directory /usr/share/puppet/modules ssh
21
+ Removed /usr/share/puppet/modules/ssh
22
+ EOT
23
+
24
+ arguments "<name>"
25
+
26
+ option "--target-directory=", "-t=" do
27
+ default_to { Puppet.settings[:modulepath].split(File::PATH_SEPARATOR) }
28
+ summary "The target directory to search from modules."
29
+ description <<-EOT
30
+ The target directory to search for modules.
31
+ EOT
32
+ end
33
+
34
+ when_invoked do |name, options|
35
+
36
+ if options[:target_directory].is_a?(Array)
37
+ options[:target_directories] = options[:target_directory]
38
+ else
39
+ options[:target_directories] = [ options[:target_directory] ]
40
+ end
41
+ options.delete(:target_directory)
42
+
43
+ Puppet::Module::Tool::Applications::Uninstaller.run(name, options)
44
+ end
45
+
46
+ when_rendering :console do |removed_modules|
47
+ removed_modules.map { |path| "Removed #{path}" }.join('\n')
48
+ end
49
+ end
50
+ end
@@ -54,10 +54,7 @@ Puppet::Face.define(:node, '0.0.1') do
54
54
  clean_cached_facts(node)
55
55
  clean_cached_node(node)
56
56
  clean_reports(node)
57
-
58
- # This is roughly functional, but seems to introduce order-dependent test
59
- # failures; this can be re-added when those issues are resolved.
60
- # clean_storeconfigs(node, unexport)
57
+ clean_storeconfigs(node, unexport)
61
58
  end
62
59
 
63
60
  # clean signed cert for +host+
@@ -23,6 +23,7 @@ Puppet.features.add(:microsoft_windows) do
23
23
  require 'win32ole'
24
24
  require 'win32/api'
25
25
  require 'win32/taskscheduler'
26
+ require 'puppet/util/windows/security'
26
27
  true
27
28
  rescue LoadError => err
28
29
  warn "Cannot run on Microsoft Windows without the sys-admin, win32-process, win32-dir, win32-service and win32-taskscheduler gems: #{err}" unless Puppet.features.posix?
@@ -35,7 +35,7 @@ class Puppet::FileServing::Content < Puppet::FileServing::Base
35
35
  # This stat can raise an exception, too.
36
36
  raise(ArgumentError, "Cannot read the contents of links unless following links") if stat.ftype == "symlink"
37
37
 
38
- @content = ::File.read(full_path)
38
+ @content = Puppet::Util.binread(full_path)
39
39
  end
40
40
  @content
41
41
  end
@@ -7,6 +7,22 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
7
7
  returns the local host's facts, regardless of what you attempt to find."
8
8
 
9
9
 
10
+ # Clear out all of the loaded facts. Reload facter but not puppet facts.
11
+ # NOTE: This is clumsy and shouldn't be required for later (1.5.x) versions
12
+ # of Facter.
13
+ def self.reload_facter
14
+ Facter.clear
15
+
16
+ # Reload everything.
17
+ if Facter.respond_to? :loadfacts
18
+ Facter.loadfacts
19
+ elsif Facter.respond_to? :load
20
+ Facter.load
21
+ else
22
+ Puppet.warning "You should upgrade your version of Facter to at least 1.3.8"
23
+ end
24
+ end
25
+
10
26
  def self.load_fact_plugins
11
27
  # Add any per-module fact directories to the factpath
12
28
  module_fact_dirs = Puppet[:modulepath].split(File::PATH_SEPARATOR).collect do |d|
@@ -15,7 +31,7 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
15
31
  end
16
32
  end.flatten
17
33
  dirs = module_fact_dirs + Puppet[:factpath].split(File::PATH_SEPARATOR)
18
- x = dirs.each do |dir|
34
+ x = dirs.uniq.each do |dir|
19
35
  load_facts_in_dir(dir)
20
36
  end
21
37
  end
@@ -27,7 +43,7 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
27
43
  Dir.glob("*.rb").each do |file|
28
44
  fqfile = ::File.join(dir, file)
29
45
  begin
30
- Puppet.info "Loading facts in #{::File.basename(file.sub(".rb",''))}"
46
+ Puppet.info "Loading facts in #{fqfile}"
31
47
  Timeout::timeout(self.timeout) do
32
48
  load file
33
49
  end
@@ -57,17 +73,14 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
57
73
  timeout
58
74
  end
59
75
 
60
- def initialize(*args)
61
- super
62
- self.class.load_fact_plugins
63
- end
64
-
65
76
  def destroy(facts)
66
77
  raise Puppet::DevError, "You cannot destroy facts in the code store; it is only used for getting facts from Facter"
67
78
  end
68
79
 
69
80
  # Look a host's facts up in Facter.
70
81
  def find(request)
82
+ self.class.reload_facter
83
+ self.class.load_fact_plugins
71
84
  result = Puppet::Node::Facts.new(request.key, Facter.to_hash)
72
85
 
73
86
  result.add_local_facts
@@ -2,6 +2,7 @@ require 'puppet/rails'
2
2
  require 'puppet/rails/inventory_node'
3
3
  require 'puppet/rails/inventory_fact'
4
4
  require 'puppet/indirector/active_record'
5
+ require 'puppet/util/retryaction'
5
6
 
6
7
  class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRecord
7
8
  def find(request)
@@ -13,19 +14,21 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec
13
14
  end
14
15
 
15
16
  def save(request)
16
- facts = request.instance
17
- node = Puppet::Rails::InventoryNode.find_by_name(request.key) || Puppet::Rails::InventoryNode.create(:name => request.key, :timestamp => facts.timestamp)
18
- node.timestamp = facts.timestamp
17
+ Puppet::Util::RetryAction.retry_action :retries => 4, :retry_exceptions => {ActiveRecord::StatementInvalid => 'MySQL Error. Retrying'} do
18
+ facts = request.instance
19
+ node = Puppet::Rails::InventoryNode.find_by_name(request.key) || Puppet::Rails::InventoryNode.create(:name => request.key, :timestamp => facts.timestamp)
20
+ node.timestamp = facts.timestamp
19
21
 
20
- ActiveRecord::Base.transaction do
21
- Puppet::Rails::InventoryFact.delete_all(:node_id => node.id)
22
- # We don't want to save internal values as facts, because those are
23
- # metadata that belong on the node
24
- facts.values.each do |name,value|
25
- next if name.to_s =~ /^_/
26
- node.facts.build(:name => name, :value => value)
22
+ ActiveRecord::Base.transaction do
23
+ Puppet::Rails::InventoryFact.delete_all(:node_id => node.id)
24
+ # We don't want to save internal values as facts, because those are
25
+ # metadata that belong on the node
26
+ facts.values.each do |name,value|
27
+ next if name.to_s =~ /^_/
28
+ node.facts.build(:name => name, :value => value)
29
+ end
30
+ node.save
27
31
  end
28
- node.save
29
32
  end
30
33
  end
31
34