puppet 2.7.19 → 2.7.20.rc1

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 (324) hide show
  1. data/CONTRIBUTING.md +61 -238
  2. data/Gemfile +32 -0
  3. data/Gemfile.lock +44 -0
  4. data/LICENSE +1 -1
  5. data/README_DEVELOPER.md +300 -5
  6. data/Rakefile +41 -37
  7. data/ext/build_defaults.yaml +20 -0
  8. data/ext/debian/README.Debian +8 -0
  9. data/ext/debian/README.source +2 -0
  10. data/ext/debian/TODO.Debian +1 -0
  11. data/ext/debian/changelog.erb +1104 -0
  12. data/ext/debian/compat +1 -0
  13. data/ext/debian/control +142 -0
  14. data/ext/debian/copyright +361 -0
  15. data/ext/debian/docs +1 -0
  16. data/ext/debian/fileserver.conf +17 -0
  17. data/ext/debian/puppet-common.dirs +8 -0
  18. data/ext/debian/puppet-common.install +3 -0
  19. data/ext/debian/puppet-common.lintian-overrides +7 -0
  20. data/ext/debian/puppet-common.manpages +2 -0
  21. data/ext/debian/puppet-common.postinst +35 -0
  22. data/ext/debian/puppet-common.postrm +32 -0
  23. data/ext/debian/puppet-el.dirs +1 -0
  24. data/ext/debian/puppet-el.emacsen-install +25 -0
  25. data/ext/debian/puppet-el.emacsen-remove +11 -0
  26. data/ext/debian/puppet-el.emacsen-startup +9 -0
  27. data/ext/debian/puppet-el.install +1 -0
  28. data/ext/debian/puppet-testsuite.install +3 -0
  29. data/ext/debian/puppet-testsuite.lintian-overrides +4 -0
  30. data/ext/debian/puppet.NEWS +86 -0
  31. data/ext/debian/puppet.conf +14 -0
  32. data/ext/debian/puppet.default +7 -0
  33. data/ext/debian/puppet.dirs +1 -0
  34. data/ext/debian/puppet.init +118 -0
  35. data/ext/debian/puppet.install +4 -0
  36. data/ext/debian/puppet.lintian-overrides +3 -0
  37. data/ext/debian/puppet.logrotate +11 -0
  38. data/ext/debian/puppet.manpages +36 -0
  39. data/ext/debian/puppet.postinst +20 -0
  40. data/ext/debian/puppet.postrm +20 -0
  41. data/ext/debian/puppet.preinst +20 -0
  42. data/ext/debian/puppetmaster-common.install +5 -0
  43. data/ext/debian/puppetmaster-common.manpages +5 -0
  44. data/ext/debian/puppetmaster-common.puppetqd.default +27 -0
  45. data/ext/debian/puppetmaster-common.puppetqd.init +84 -0
  46. data/ext/debian/puppetmaster-passenger.dirs +4 -0
  47. data/ext/debian/puppetmaster-passenger.postinst +66 -0
  48. data/ext/debian/puppetmaster-passenger.postrm +33 -0
  49. data/ext/debian/puppetmaster.NEWS +13 -0
  50. data/ext/debian/puppetmaster.README.debian +16 -0
  51. data/ext/debian/puppetmaster.default +38 -0
  52. data/ext/debian/puppetmaster.dirs +1 -0
  53. data/ext/debian/puppetmaster.init +158 -0
  54. data/ext/debian/puppetmaster.install +1 -0
  55. data/ext/debian/puppetmaster.lintian-overrides +3 -0
  56. data/ext/debian/puppetmaster.manpages +1 -0
  57. data/ext/debian/puppetmaster.postinst +20 -0
  58. data/ext/debian/puppetmaster.postrm +5 -0
  59. data/ext/debian/puppetmaster.preinst +22 -0
  60. data/ext/debian/rules +127 -0
  61. data/ext/debian/source/format +1 -0
  62. data/ext/debian/source/options +1 -0
  63. data/ext/debian/vim-puppet.README.Debian +13 -0
  64. data/ext/debian/vim-puppet.dirs +3 -0
  65. data/ext/debian/vim-puppet.yaml +5 -0
  66. data/ext/debian/watch +2 -0
  67. data/ext/emacs/puppet-mode.el +1 -0
  68. data/{conf → ext}/osx/PackageInfo.plist +0 -0
  69. data/{conf → ext}/osx/createpackage.sh +0 -0
  70. data/ext/osx/file_mapping.yaml +38 -0
  71. data/ext/osx/preflight.erb +37 -0
  72. data/{tasks/rake/templates → ext/osx}/prototype.plist.erb +0 -0
  73. data/ext/packaging/README-Solaris.md +117 -0
  74. data/ext/packaging/README.md +255 -0
  75. data/ext/packaging/spec/spec_helper.rb +12 -0
  76. data/ext/packaging/spec/tasks/00_utils_spec.rb +66 -0
  77. data/ext/packaging/tasks/00_utils.rake +382 -0
  78. data/ext/packaging/tasks/10_setupvars.rake +71 -0
  79. data/ext/packaging/tasks/20_setupextravars.rake +25 -0
  80. data/ext/packaging/tasks/apple.rake +201 -0
  81. data/ext/packaging/tasks/clean.rake +5 -0
  82. data/ext/packaging/tasks/deb.rake +108 -0
  83. data/ext/packaging/tasks/doc.rake +20 -0
  84. data/ext/packaging/tasks/fetch.rake +18 -0
  85. data/ext/packaging/tasks/gem.rake +68 -0
  86. data/ext/packaging/tasks/ips.rake +80 -0
  87. data/ext/packaging/tasks/mock.rake +126 -0
  88. data/ext/packaging/tasks/pe_deb.rake +9 -0
  89. data/ext/packaging/tasks/pe_remote.rake +45 -0
  90. data/ext/packaging/tasks/pe_rpm.rake +21 -0
  91. data/ext/packaging/tasks/pe_ship.rake +30 -0
  92. data/ext/packaging/tasks/pe_sign.rake +27 -0
  93. data/ext/packaging/tasks/pe_sles.rake +96 -0
  94. data/ext/packaging/tasks/release.rake +73 -0
  95. data/ext/packaging/tasks/remote_build.rake +78 -0
  96. data/ext/packaging/tasks/rpm.rake +52 -0
  97. data/ext/packaging/tasks/ship.rake +78 -0
  98. data/ext/packaging/tasks/sign.rake +82 -0
  99. data/ext/packaging/tasks/tag.rake +8 -0
  100. data/ext/packaging/tasks/tar.rake +68 -0
  101. data/ext/packaging/tasks/template.rake +13 -0
  102. data/ext/packaging/tasks/update.rake +16 -0
  103. data/ext/packaging/tasks/version.rake +21 -0
  104. data/ext/project_data.yaml +24 -0
  105. data/{conf/redhat/puppet.spec → ext/redhat/puppet.spec.erb} +18 -10
  106. data/install.rb +8 -8
  107. data/lib/puppet.rb +2 -6
  108. data/lib/puppet/agent/locker.rb +2 -0
  109. data/lib/puppet/application.rb +1 -1
  110. data/lib/puppet/application/agent.rb +1 -1
  111. data/lib/puppet/application/apply.rb +1 -1
  112. data/lib/puppet/application/cert.rb +5 -6
  113. data/lib/puppet/application/describe.rb +1 -1
  114. data/lib/puppet/application/device.rb +1 -1
  115. data/lib/puppet/application/doc.rb +1 -1
  116. data/lib/puppet/application/filebucket.rb +1 -1
  117. data/lib/puppet/application/inspect.rb +1 -1
  118. data/lib/puppet/application/kick.rb +1 -1
  119. data/lib/puppet/application/master.rb +1 -1
  120. data/lib/puppet/application/resource.rb +1 -1
  121. data/lib/puppet/defaults.rb +21 -3
  122. data/lib/puppet/external/dot.rb +1 -1
  123. data/lib/puppet/face/help/global.erb +1 -1
  124. data/lib/puppet/face/module/install.rb +1 -1
  125. data/lib/puppet/face/module/list.rb +1 -1
  126. data/lib/puppet/face/module/uninstall.rb +1 -1
  127. data/lib/puppet/face/node/clean.rb +23 -18
  128. data/lib/puppet/face/parser.rb +11 -2
  129. data/lib/puppet/file_collection.rb +16 -27
  130. data/lib/puppet/file_collection/lookup.rb +6 -16
  131. data/lib/puppet/file_serving/base.rb +4 -4
  132. data/lib/puppet/indirector/catalog/static_compiler.rb +3 -4
  133. data/lib/puppet/indirector/certificate/disabled_ca.rb +22 -0
  134. data/lib/puppet/indirector/certificate_request/disabled_ca.rb +22 -0
  135. data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +22 -0
  136. data/lib/puppet/indirector/face.rb +2 -2
  137. data/lib/puppet/indirector/key/disabled_ca.rb +22 -0
  138. data/lib/puppet/indirector/node/exec.rb +13 -1
  139. data/lib/puppet/indirector/request.rb +4 -0
  140. data/lib/puppet/metatype/manager.rb +17 -10
  141. data/lib/puppet/network/authstore.rb +1 -1
  142. data/lib/puppet/network/rights.rb +1 -2
  143. data/lib/puppet/node/environment.rb +1 -0
  144. data/lib/puppet/parameter/value.rb +9 -3
  145. data/lib/puppet/parser/ast.rb +1 -4
  146. data/lib/puppet/parser/files.rb +1 -1
  147. data/lib/puppet/parser/functions.rb +68 -22
  148. data/lib/puppet/parser/functions/create_resources.rb +2 -3
  149. data/lib/puppet/parser/functions/shellquote.rb +21 -25
  150. data/lib/puppet/parser/lexer.rb +40 -6
  151. data/lib/puppet/parser/relationship.rb +3 -1
  152. data/lib/puppet/parser/resource.rb +2 -3
  153. data/lib/puppet/parser/resource/param.rb +3 -5
  154. data/lib/puppet/parser/scope.rb +7 -4
  155. data/lib/puppet/property.rb +5 -3
  156. data/lib/puppet/provider.rb +5 -5
  157. data/lib/puppet/provider/aixobject.rb +1 -1
  158. data/lib/puppet/provider/augeas/augeas.rb +1 -1
  159. data/lib/puppet/provider/exec/windows.rb +1 -1
  160. data/lib/puppet/provider/file/windows.rb +10 -29
  161. data/lib/puppet/provider/group/groupadd.rb +2 -3
  162. data/lib/puppet/provider/group/ldap.rb +1 -1
  163. data/lib/puppet/provider/group/windows_adsi.rb +1 -1
  164. data/lib/puppet/provider/ldap.rb +5 -1
  165. data/lib/puppet/provider/nameservice.rb +3 -3
  166. data/lib/puppet/provider/nameservice/directoryservice.rb +2 -2
  167. data/lib/puppet/provider/package/gem.rb +6 -2
  168. data/lib/puppet/provider/package/portage.rb +4 -2
  169. data/lib/puppet/provider/parsedfile.rb +1 -1
  170. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  171. data/lib/puppet/provider/service/base.rb +2 -41
  172. data/lib/puppet/provider/service/daemontools.rb +1 -1
  173. data/lib/puppet/provider/service/launchd.rb +1 -1
  174. data/lib/puppet/provider/service/redhat.rb +6 -5
  175. data/lib/puppet/provider/service/runit.rb +1 -1
  176. data/lib/puppet/provider/service/service.rb +43 -0
  177. data/lib/puppet/provider/service/windows.rb +1 -8
  178. data/lib/puppet/provider/user/user_role_add.rb +2 -1
  179. data/lib/puppet/provider/user/useradd.rb +8 -3
  180. data/lib/puppet/provider/user/windows_adsi.rb +12 -1
  181. data/lib/puppet/provider/zone/solaris.rb +1 -1
  182. data/lib/puppet/rails/inventory_node.rb +26 -13
  183. data/lib/puppet/reports.rb +1 -1
  184. data/lib/puppet/resource.rb +20 -5
  185. data/lib/puppet/resource/status.rb +1 -1
  186. data/lib/puppet/ssl/certificate_authority.rb +2 -0
  187. data/lib/puppet/ssl/host.rb +31 -6
  188. data/lib/puppet/test/test_helper.rb +3 -1
  189. data/lib/puppet/transaction/event.rb +1 -1
  190. data/lib/puppet/transaction/report.rb +2 -2
  191. data/lib/puppet/type.rb +30 -25
  192. data/lib/puppet/type/augeas.rb +1 -1
  193. data/lib/puppet/type/cron.rb +2 -2
  194. data/lib/puppet/type/exec.rb +6 -6
  195. data/lib/puppet/type/file.rb +5 -15
  196. data/lib/puppet/type/file/content.rb +1 -1
  197. data/lib/puppet/type/file/ensure.rb +1 -1
  198. data/lib/puppet/type/file/mode.rb +1 -1
  199. data/lib/puppet/type/file/selcontext.rb +6 -2
  200. data/lib/puppet/type/file/source.rb +1 -1
  201. data/lib/puppet/type/mount.rb +1 -1
  202. data/lib/puppet/type/package.rb +1 -1
  203. data/lib/puppet/type/schedule.rb +1 -1
  204. data/lib/puppet/type/scheduled_task.rb +1 -1
  205. data/lib/puppet/type/tidy.rb +1 -1
  206. data/lib/puppet/type/whit.rb +16 -9
  207. data/lib/puppet/util.rb +27 -11
  208. data/lib/puppet/util/adsi.rb +25 -23
  209. data/lib/puppet/util/autoload.rb +1 -1
  210. data/lib/puppet/util/classgen.rb +1 -1
  211. data/lib/puppet/util/feature.rb +3 -1
  212. data/lib/puppet/util/fileparsing.rb +9 -9
  213. data/lib/puppet/util/filetype.rb +55 -40
  214. data/lib/puppet/util/instance_loader.rb +5 -5
  215. data/lib/puppet/util/instrumentation.rb +3 -5
  216. data/lib/puppet/util/log_paths.rb +1 -3
  217. data/lib/puppet/util/monkey_patches.rb +34 -8
  218. data/lib/puppet/util/platform.rb +7 -0
  219. data/lib/puppet/util/posix.rb +3 -3
  220. data/lib/puppet/util/provider_features.rb +2 -3
  221. data/lib/puppet/util/rdoc.rb +4 -3
  222. data/lib/puppet/util/reference.rb +1 -1
  223. data/lib/puppet/util/selinux.rb +31 -36
  224. data/lib/puppet/util/tagging.rb +28 -6
  225. data/lib/puppet/util/windows.rb +1 -0
  226. data/lib/puppet/util/windows/error.rb +1 -1
  227. data/lib/puppet/util/windows/process.rb +3 -3
  228. data/lib/puppet/util/windows/security.rb +9 -46
  229. data/lib/puppet/util/windows/sid.rb +96 -0
  230. data/lib/puppet/util/windows/user.rb +65 -2
  231. data/lib/puppet/util/zaml.rb +109 -59
  232. data/lib/puppet/version.rb +18 -0
  233. data/spec/fixtures/unit/util/filetype/aixtab_output +44 -0
  234. data/spec/fixtures/unit/util/filetype/suntab_output +9 -0
  235. data/spec/integration/defaults_spec.rb +26 -7
  236. data/spec/integration/parser/functions_spec.rb +0 -4
  237. data/spec/integration/util/file_locking_spec.rb +1 -1
  238. data/spec/integration/util/windows/security_spec.rb +3 -23
  239. data/spec/lib/puppet_spec/files.rb +3 -3
  240. data/spec/shared_contexts/platform.rb +8 -0
  241. data/spec/spec_helper.rb +6 -1
  242. data/spec/unit/application/queue_spec.rb +2 -1
  243. data/spec/unit/configurer_spec.rb +1 -1
  244. data/spec/unit/face/{instrumentation_data.rb → instrumentation_data_spec.rb} +0 -0
  245. data/spec/unit/face/{instrumentation_listener.rb → instrumentation_listener_spec.rb} +0 -0
  246. data/spec/unit/face/{instrumentation_probe.rb → instrumentation_probe_spec.rb} +0 -0
  247. data/spec/unit/indirector/catalog/static_compiler_spec.rb +194 -0
  248. data/spec/unit/indirector/certificate/disabled_ca_spec.rb +33 -0
  249. data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +33 -0
  250. data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +33 -0
  251. data/spec/unit/indirector/key/disabled_ca_spec.rb +33 -0
  252. data/spec/unit/indirector/request_spec.rb +22 -0
  253. data/spec/unit/network/http/webrick_spec.rb +0 -7
  254. data/spec/unit/node/environment_spec.rb +8 -8
  255. data/spec/unit/parser/ast_spec.rb +0 -5
  256. data/spec/unit/parser/collector_spec.rb +1 -0
  257. data/spec/unit/parser/files_spec.rb +2 -2
  258. data/spec/unit/parser/functions/create_resources_spec.rb +3 -4
  259. data/spec/unit/parser/functions/require_spec.rb +0 -6
  260. data/spec/unit/parser/functions/shellquote_spec.rb +0 -5
  261. data/spec/unit/parser/functions/template_spec.rb +6 -1
  262. data/spec/unit/parser/functions_spec.rb +73 -23
  263. data/spec/unit/parser/lexer_spec.rb +133 -8
  264. data/spec/unit/parser/relationship_spec.rb +24 -0
  265. data/spec/unit/parser/resource_spec.rb +0 -4
  266. data/spec/unit/parser/scope_spec.rb +2 -2
  267. data/spec/unit/property_spec.rb +21 -1
  268. data/spec/unit/provider/exec/posix_spec.rb +7 -6
  269. data/spec/unit/provider/file/windows_spec.rb +29 -29
  270. data/spec/unit/provider/group/groupadd_spec.rb +36 -30
  271. data/spec/unit/provider/group/windows_adsi_spec.rb +2 -2
  272. data/spec/unit/provider/package/gem_spec.rb +12 -0
  273. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +14 -11
  274. data/spec/unit/provider/service/redhat_spec.rb +11 -1
  275. data/spec/unit/provider/service/windows_spec.rb +19 -0
  276. data/spec/unit/provider/user/ldap_spec.rb +22 -8
  277. data/spec/unit/provider/user/user_role_add_spec.rb +12 -0
  278. data/spec/unit/provider/user/useradd_spec.rb +146 -118
  279. data/spec/unit/provider/user/windows_adsi_spec.rb +24 -2
  280. data/spec/unit/puppet_spec.rb +10 -0
  281. data/spec/unit/resource/status_spec.rb +1 -1
  282. data/spec/unit/resource_spec.rb +73 -0
  283. data/spec/unit/ssl/certificate_authority_spec.rb +25 -1
  284. data/spec/unit/ssl/host_spec.rb +73 -27
  285. data/spec/unit/ssl/key_spec.rb +0 -4
  286. data/spec/unit/transaction/event_spec.rb +1 -1
  287. data/spec/unit/type/exec_spec.rb +1 -1
  288. data/spec/unit/type/file/content_spec.rb +6 -4
  289. data/spec/unit/type/file/{ctime.rb → ctime_spec.rb} +0 -0
  290. data/spec/unit/type/file/{mtime.rb → mtime_spec.rb} +0 -0
  291. data/spec/unit/type/file/{type.rb → type_spec.rb} +0 -0
  292. data/spec/unit/type/file_spec.rb +2 -12
  293. data/spec/unit/type/host_spec.rb +14 -5
  294. data/spec/unit/type/mount_spec.rb +8 -0
  295. data/spec/unit/type/scheduled_task_spec.rb +2 -2
  296. data/spec/unit/util/adsi_spec.rb +23 -8
  297. data/spec/unit/util/command_line_spec.rb +11 -2
  298. data/spec/unit/util/feature_spec.rb +12 -1
  299. data/spec/unit/util/filetype_spec.rb +161 -55
  300. data/spec/unit/util/log_spec.rb +1 -1
  301. data/spec/unit/util/monkey_patches_spec.rb +7 -0
  302. data/spec/unit/util/rdoc_spec.rb +8 -2
  303. data/spec/unit/util/selinux_spec.rb +24 -32
  304. data/spec/unit/util/windows/sid_spec.rb +100 -0
  305. data/spec/unit/util/zaml_spec.rb +165 -25
  306. data/spec/unit/util_spec.rb +3 -9
  307. data/spec/watchr.rb +2 -6
  308. data/tasks/rake/gem.rake +4 -2
  309. data/tasks/rake/sign.rake +1 -1
  310. data/test/language/parser.rb +1 -0
  311. data/test/language/scope.rb +0 -5
  312. data/test/language/snippets.rb +1 -2
  313. data/test/lib/puppettest.rb +16 -27
  314. data/test/lib/puppettest/parsertesting.rb +0 -1
  315. data/test/network/authstore.rb +2 -4
  316. data/test/puppet/defaults.rb +0 -4
  317. data/test/util/fileparsing.rb +2 -6
  318. metadata +1706 -1617
  319. data/conf/osx/preflight +0 -24
  320. data/spec/spec.opts +0 -4
  321. data/spec/unit/file_collection/lookup_spec.rb +0 -45
  322. data/spec/unit/file_collection_spec.rb +0 -52
  323. data/tasks/rake/apple.rake +0 -176
  324. data/test/puppet/errortest.rb +0 -19
@@ -1,8 +1,6 @@
1
1
  # Windows Service Control Manager (SCM) provider
2
2
 
3
- require 'win32/service' if Puppet.features.microsoft_windows?
4
-
5
- Puppet::Type.type(:service).provide :windows do
3
+ Puppet::Type.type(:service).provide :windows, :parent => :service do
6
4
 
7
5
  desc <<-EOT
8
6
  Support for Windows Service Control Manager (SCM). This provider can
@@ -86,11 +84,6 @@ Puppet::Type.type(:service).provide :windows do
86
84
  raise Puppet::Error.new("Cannot stop #{@resource[:name]}, error was: #{detail}" )
87
85
  end
88
86
 
89
- def restart
90
- self.stop
91
- self.start
92
- end
93
-
94
87
  def status
95
88
  w32ss = Win32::Service.status( @resource[:name] )
96
89
  raise Puppet::Error.new("Win32 service query of #{@resource[:name]} failed" ) unless( !w32ss.nil? && w32ss.instance_of?( Struct::ServiceStatus ) )
@@ -173,7 +173,8 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
173
173
  end
174
174
 
175
175
  def password_max_age
176
- shadow_entry ? shadow_entry[4] : :absent
176
+ return :absent unless shadow_entry
177
+ shadow_entry[4] || -1
177
178
  end
178
179
 
179
180
  # Read in /etc/shadow, find the line for our used and rewrite it with the
@@ -21,7 +21,8 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
21
21
  value !~ /\s/
22
22
  end
23
23
 
24
- has_features :manages_homedir, :allows_duplicates, :manages_expiry, :system_users
24
+ has_features :manages_homedir, :allows_duplicates, :manages_expiry
25
+ has_features :system_users unless %w{HP-UX Solaris}.include? Facter.value(:operatingsystem)
25
26
 
26
27
  has_features :manages_passwords, :manages_password_age if Puppet.features.libshadow?
27
28
 
@@ -33,7 +34,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
33
34
  cmd = []
34
35
  if @resource.managehome?
35
36
  cmd << "-m"
36
- elsif %w{Fedora RedHat CentOS OEL OVS}.include?(Facter.value("operatingsystem"))
37
+ elsif %w{Fedora RedHat CentOS OEL OVS}.include?(Facter.value(:operatingsystem))
37
38
  cmd << "-M"
38
39
  end
39
40
  cmd
@@ -49,7 +50,11 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
49
50
  end
50
51
 
51
52
  def check_system_users
52
- @resource.system? ? ["-r"] : []
53
+ if self.class.system_users? and resource.system?
54
+ ["-r"]
55
+ else
56
+ []
57
+ end
53
58
  end
54
59
 
55
60
  def add_properties
@@ -28,6 +28,10 @@ Puppet::Type.type(:user).provide :windows_adsi do
28
28
  [:comment, :home, :groups].each do |prop|
29
29
  send("#{prop}=", @resource[prop]) if @resource[prop]
30
30
  end
31
+
32
+ if @resource.managehome?
33
+ Puppet::Util::Windows::User.load_profile(@resource[:name], @resource[:password])
34
+ end
31
35
  end
32
36
 
33
37
  def exists?
@@ -35,7 +39,14 @@ Puppet::Type.type(:user).provide :windows_adsi do
35
39
  end
36
40
 
37
41
  def delete
42
+ # lookup sid before we delete account
43
+ sid = uid if @resource.managehome?
44
+
38
45
  Puppet::Util::ADSI::User.delete(@resource[:name])
46
+
47
+ if sid
48
+ Puppet::Util::ADSI::UserProfile.delete(sid)
49
+ end
39
50
  end
40
51
 
41
52
  # Only flush if we created or modified a user, not deleted
@@ -68,7 +79,7 @@ Puppet::Type.type(:user).provide :windows_adsi do
68
79
  end
69
80
 
70
81
  def uid
71
- Puppet::Util::ADSI.sid_for_account(@resource[:name])
82
+ Puppet::Util::Windows::Security.name_to_sid(@resource[:name])
72
83
  end
73
84
 
74
85
  def uid=(value)
@@ -19,7 +19,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
19
19
  # Configured but not installed zones do not have IDs
20
20
  properties.delete(:id) if properties[:id] == "-"
21
21
 
22
- properties[:ensure] = symbolize(properties[:ensure])
22
+ properties[:ensure] = properties[:ensure].intern
23
23
 
24
24
  properties
25
25
  end
@@ -4,23 +4,36 @@ class Puppet::Rails::InventoryNode < ::ActiveRecord::Base
4
4
  has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :foreign_key => :node_id, :dependent => :delete_all
5
5
 
6
6
  if Puppet::Util.activerecord_version < 3.0
7
- # For backward compatibility, add the newer name to older implementations.
8
- ActiveRecord::NamedScope::ClassMethods.module_eval { alias :scope :named_scope }
9
- end
7
+ # For backward compatibility, use the old named_scope with pre 3.0 activerecord
8
+ named_scope :has_fact_with_value, lambda { |name,value|
9
+ {
10
+ :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value.to_s],
11
+ :joins => :facts
12
+ }
13
+ }
10
14
 
11
- scope :has_fact_with_value, lambda { |name,value|
12
- {
13
- :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value.to_s],
14
- :joins => :facts
15
+ named_scope :has_fact_without_value, lambda { |name,value|
16
+ {
17
+ :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value.to_s],
18
+ :joins => :facts
19
+ }
20
+ }
21
+ else
22
+ # Use scope for activerecord >= 3.0
23
+ scope :has_fact_with_value, lambda { |name,value|
24
+ {
25
+ :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value.to_s],
26
+ :joins => :facts
27
+ }
15
28
  }
16
- }
17
29
 
18
- scope :has_fact_without_value, lambda { |name,value|
19
- {
20
- :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value.to_s],
21
- :joins => :facts
30
+ scope :has_fact_without_value, lambda { |name,value|
31
+ {
32
+ :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value.to_s],
33
+ :joins => :facts
34
+ }
22
35
  }
23
- }
36
+ end
24
37
 
25
38
  def facts_to_hash
26
39
  facts.inject({}) do |fact_hash,fact|
@@ -14,7 +14,7 @@ class Puppet::Reports
14
14
 
15
15
  # Add a new report type.
16
16
  def self.register_report(name, options = {}, &block)
17
- name = symbolize(name)
17
+ name = name.intern
18
18
 
19
19
  mod = genmodule(name, :extend => Puppet::Util::Docs, :hash => instance_hash(:report), :block => block)
20
20
 
@@ -431,14 +431,29 @@ class Puppet::Resource
431
431
  if type.respond_to? :title_patterns
432
432
  type.title_patterns.each { |regexp, symbols_and_lambdas|
433
433
  if captures = regexp.match(title.to_s)
434
- symbols_and_lambdas.zip(captures[1..-1]).each { |symbol_and_lambda,capture|
435
- sym, lam = symbol_and_lambda
436
- #self[sym] = lam.call(capture)
437
- h[sym] = lam.call(capture)
438
- }
434
+ symbols_and_lambdas.zip(captures[1..-1]).each do |symbol_and_lambda,capture|
435
+ symbol, proc = symbol_and_lambda
436
+ # Many types pass "identity" as the proc; we might as well give
437
+ # them a shortcut to delivering that without the extra cost.
438
+ #
439
+ # Especially because the global type defines title_patterns and
440
+ # uses the identity patterns.
441
+ #
442
+ # This was worth about 8MB of memory allocation saved in my
443
+ # testing, so is worth the complexity for the API.
444
+ if proc then
445
+ h[symbol] = proc.call(capture)
446
+ else
447
+ h[symbol] = capture
448
+ end
449
+ end
439
450
  return h
440
451
  end
441
452
  }
453
+ # If we've gotten this far, then none of the provided title patterns
454
+ # matched. Since there's no way to determine the title then the
455
+ # resource should fail here.
456
+ raise Puppet::Error, "No set of title patterns matched the title \"#{title}\"."
442
457
  else
443
458
  return { :name => title.to_s }
444
459
  end
@@ -66,7 +66,7 @@ module Puppet
66
66
  end
67
67
 
68
68
  def to_yaml_properties
69
- (YAML_ATTRIBUTES & instance_variables).sort
69
+ YAML_ATTRIBUTES & instance_variables
70
70
  end
71
71
 
72
72
  private
@@ -231,6 +231,8 @@ class Puppet::SSL::CertificateAuthority
231
231
 
232
232
  if cert = Puppet::SSL::Certificate.indirection.find(name)
233
233
  serial = cert.content.serial
234
+ elsif name =~ /^0x[0-9A-Fa-f]+$/
235
+ serial = name.hex
234
236
  elsif ! serial = inventory.serial(name)
235
237
  raise ArgumentError, "Could not find a serial number for #{name}"
236
238
  end
@@ -54,7 +54,7 @@ class Puppet::SSL::Host
54
54
  CertificateRequest.indirection.terminus_class = terminus
55
55
  CertificateRevocationList.indirection.terminus_class = terminus
56
56
 
57
- host_map = {:ca => :file, :file => nil, :rest => :rest}
57
+ host_map = {:ca => :file, :disabled_ca => nil, :file => nil, :rest => :rest}
58
58
  if term = host_map[terminus]
59
59
  self.indirection.terminus_class = term
60
60
  else
@@ -94,7 +94,7 @@ class Puppet::SSL::Host
94
94
  # We are the CA, so we don't have read/write access to the normal certificates.
95
95
  :only => [:ca],
96
96
  # We have no CA, so we just look in the local file store.
97
- :none => [:file]
97
+ :none => [:disabled_ca]
98
98
  }
99
99
 
100
100
  # Specify how we expect to interact with our certificate authority.
@@ -276,14 +276,39 @@ ERROR_STRING
276
276
  pson_hash[:state] = my_state
277
277
  pson_hash[:desired_state] = desired_state if desired_state
278
278
 
279
- if my_state == 'requested'
280
- pson_hash[:fingerprint] = certificate_request.fingerprint
281
- else
282
- pson_hash[:fingerprint] = my_cert.fingerprint
279
+ thing_to_use = (my_state == 'requested') ? certificate_request : my_cert
280
+
281
+ # this is for backwards-compatibility
282
+ # we should deprecate it and transition people to using
283
+ # pson[:fingerprints][:default]
284
+ # It appears that we have no internal consumers of this api
285
+ # --jeffweiss 30 aug 2012
286
+ pson_hash[:fingerprint] = thing_to_use.fingerprint
287
+
288
+ # The above fingerprint doesn't tell us what message digest algorithm was used
289
+ # No problem, except that the default is changing between 2.7 and 3.0. Also, as
290
+ # we move to FIPS 140-2 compliance, MD5 is no longer allowed (and, gasp, will
291
+ # segfault in rubies older than 1.9.3)
292
+ # So, when we add the newer fingerprints, we're explicit about the hashing
293
+ # algorithm used.
294
+ # --jeffweiss 31 july 2012
295
+ pson_hash[:fingerprints] = {}
296
+ pson_hash[:fingerprints][:default] = thing_to_use.fingerprint
297
+
298
+ suitable_message_digest_algorithms.each do |md|
299
+ pson_hash[:fingerprints][md] = thing_to_use.fingerprint md
283
300
  end
301
+ pson_hash[:dns_alt_names] = thing_to_use.subject_alt_names
284
302
 
285
303
  pson_hash.to_pson(*args)
286
304
  end
305
+
306
+ # eventually we'll probably want to move this somewhere else or make it
307
+ # configurable
308
+ # --jeffweiss 29 aug 2012
309
+ def suitable_message_digest_algorithms
310
+ [:SHA1, :SHA256, :SHA512]
311
+ end
287
312
 
288
313
  # Attempt to retrieve a cert, if we don't already have one.
289
314
  def wait_for_cert(time)
@@ -79,6 +79,9 @@ module Puppet::Test
79
79
  Puppet[:req_bits] = 512
80
80
  Puppet[:keylength] = 512
81
81
 
82
+ Puppet::Node::Environment.clear
83
+ Puppet::Parser::Functions.reset
84
+
82
85
  Puppet.clear_deprecation_warnings
83
86
  end
84
87
 
@@ -87,7 +90,6 @@ module Puppet::Test
87
90
  def self.after_each_test()
88
91
  clear_settings_after_each()
89
92
 
90
- Puppet::Node::Environment.clear
91
93
  Puppet::Util::Storage.clear
92
94
  Puppet::Util::ExecutionStub.reset
93
95
 
@@ -48,7 +48,7 @@ class Puppet::Transaction::Event
48
48
  end
49
49
 
50
50
  def to_yaml_properties
51
- (YAML_ATTRIBUTES.map {|ya| ya.to_s} & instance_variables.map{|iv| iv.to_s}).sort
51
+ YAML_ATTRIBUTES & instance_variables
52
52
  end
53
53
 
54
54
  private
@@ -76,7 +76,7 @@ class Puppet::Transaction::Report
76
76
  @host = Puppet[:node_name_value]
77
77
  @time = Time.now
78
78
  @kind = kind
79
- @report_format = 2
79
+ @report_format = 3
80
80
  @puppet_version = Puppet.version
81
81
  @configuration_version = configuration_version
82
82
  @environment = environment
@@ -141,7 +141,7 @@ class Puppet::Transaction::Report
141
141
  end
142
142
 
143
143
  def to_yaml_properties
144
- (instance_variables - ["@external_times"]).sort
144
+ (instance_variables - ["@external_times"])
145
145
  end
146
146
 
147
147
  private
@@ -9,7 +9,6 @@ require 'puppet/metatype/manager'
9
9
  require 'puppet/util/errors'
10
10
  require 'puppet/util/log_paths'
11
11
  require 'puppet/util/logging'
12
- require 'puppet/file_collection/lookup'
13
12
  require 'puppet/util/tagging'
14
13
 
15
14
  # see the bottom of the file for the rest of the inclusions
@@ -20,7 +19,6 @@ class Type
20
19
  include Puppet::Util::Errors
21
20
  include Puppet::Util::LogPaths
22
21
  include Puppet::Util::Logging
23
- include Puppet::FileCollection::Lookup
24
22
  include Puppet::Util::Tagging
25
23
 
26
24
  ###############################
@@ -56,14 +54,16 @@ class Type
56
54
 
57
55
  # Retrieve an attribute alias, if there is one.
58
56
  def self.attr_alias(param)
59
- @attr_aliases[symbolize(param)]
57
+ # Intern again, because this might be called by someone who doesn't
58
+ # understand the calling convention and all.
59
+ @attr_aliases[param.intern]
60
60
  end
61
61
 
62
62
  # Create an alias to an existing attribute. This will cause the aliased
63
63
  # attribute to be valid when setting and retrieving values on the instance.
64
64
  def self.set_attr_alias(hash)
65
65
  hash.each do |new, old|
66
- @attr_aliases[symbolize(new)] = symbolize(old)
66
+ @attr_aliases[new.intern] = old.intern
67
67
  end
68
68
  end
69
69
 
@@ -165,12 +165,14 @@ class Type
165
165
 
166
166
  # Is the parameter in question a meta-parameter?
167
167
  def self.metaparam?(param)
168
- @@metaparamhash.include?(symbolize(param))
168
+ @@metaparamhash.include?(param.intern)
169
169
  end
170
170
 
171
171
  # Find the metaparameter class associated with a given metaparameter name.
172
+ # Must accept a `nil` name, and return nil.
172
173
  def self.metaparamclass(name)
173
- @@metaparamhash[symbolize(name)]
174
+ return nil if name.nil?
175
+ @@metaparamhash[name.intern]
174
176
  end
175
177
 
176
178
  def self.metaparams
@@ -186,17 +188,15 @@ class Type
186
188
  def self.newmetaparam(name, options = {}, &block)
187
189
  @@metaparams ||= []
188
190
  @@metaparamhash ||= {}
189
- name = symbolize(name)
191
+ name = name.intern
190
192
 
191
-
192
- param = genclass(
193
- name,
193
+ param = genclass(
194
+ name,
194
195
  :parent => options[:parent] || Puppet::Parameter,
195
196
  :prefix => "MetaParam",
196
197
  :hash => @@metaparamhash,
197
198
  :array => @@metaparams,
198
199
  :attributes => options[:attributes],
199
-
200
200
  &block
201
201
  )
202
202
 
@@ -219,15 +219,15 @@ class Type
219
219
  end
220
220
 
221
221
  def self.key_attributes
222
- key_attribute_parameters.collect { |p| p.name }
222
+ # This is a cache miss around 0.05 percent of the time. --daniel 2012-07-17
223
+ @key_attributes_cache ||= key_attribute_parameters.collect { |p| p.name }
223
224
  end
224
225
 
225
226
  def self.title_patterns
226
227
  case key_attributes.length
227
228
  when 0; []
228
229
  when 1;
229
- identity = lambda {|x| x}
230
- [ [ /(.*)/m, [ [key_attributes.first, identity ] ] ] ]
230
+ [ [ /(.*)/m, [ [key_attributes.first] ] ] ]
231
231
  else
232
232
  raise Puppet::DevError,"you must specify title patterns when there are two or more key attributes"
233
233
  end
@@ -274,7 +274,7 @@ class Type
274
274
  # * <tt>:retrieve</tt>: The method to call on the provider or @parent object (if
275
275
  # the provider is not set) to retrieve the current value.
276
276
  def self.newproperty(name, options = {}, &block)
277
- name = symbolize(name)
277
+ name = name.intern
278
278
 
279
279
  # This is here for types that might still have the old method of defining
280
280
  # a parent class.
@@ -337,7 +337,7 @@ class Type
337
337
  end
338
338
 
339
339
  def self.validattr?(name)
340
- name = symbolize(name)
340
+ name = name.intern
341
341
  return true if name == :name
342
342
  @validattrs ||= {}
343
343
 
@@ -350,7 +350,7 @@ class Type
350
350
 
351
351
  # does the name reflect a valid property?
352
352
  def self.validproperty?(name)
353
- name = symbolize(name)
353
+ name = name.intern
354
354
  @validproperties.include?(name) && @validproperties[name]
355
355
  end
356
356
 
@@ -374,7 +374,7 @@ class Type
374
374
 
375
375
  # Return either the attribute alias or the attribute.
376
376
  def attr_alias(name)
377
- name = symbolize(name)
377
+ name = name.intern
378
378
  if synonym = self.class.attr_alias(name)
379
379
  return synonym
380
380
  else
@@ -448,7 +448,7 @@ class Type
448
448
  # make sure the parameter doesn't have any errors
449
449
  property.value = value
450
450
  rescue => detail
451
- error = Puppet::Error.new("Parameter #{name} failed: #{detail}")
451
+ error = Puppet::Error.new("Parameter #{name} failed on #{ref}: #{detail}")
452
452
  error.set_backtrace(detail.backtrace)
453
453
  raise error
454
454
  end
@@ -460,7 +460,7 @@ class Type
460
460
  # remove a property from the object; useful in testing or in cleanup
461
461
  # when an error has been encountered
462
462
  def delete(attr)
463
- attr = symbolize(attr)
463
+ attr = attr.intern
464
464
  if @parameters.has_key?(attr)
465
465
  @parameters.delete(attr)
466
466
  else
@@ -531,7 +531,7 @@ class Type
531
531
  # LAK:NOTE(20081028) Since the 'parameter' method is now a superset of this method,
532
532
  # this one should probably go away at some point.
533
533
  def property(name)
534
- (obj = @parameters[symbolize(name)] and obj.is_a?(Puppet::Property)) ? obj : nil
534
+ (obj = @parameters[name.intern] and obj.is_a?(Puppet::Property)) ? obj : nil
535
535
  end
536
536
 
537
537
  # For any parameters or properties that have defaults and have not yet been
@@ -1432,7 +1432,7 @@ class Type
1432
1432
 
1433
1433
  # Retrieve a provider by name.
1434
1434
  def self.provider(name)
1435
- name = Puppet::Util.symbolize(name)
1435
+ name = name.intern
1436
1436
 
1437
1437
  # If we don't have it yet, try loading it.
1438
1438
  @providerloader.load(name) unless provider_hash.has_key?(name)
@@ -1445,7 +1445,7 @@ class Type
1445
1445
  end
1446
1446
 
1447
1447
  def self.validprovider?(name)
1448
- name = Puppet::Util.symbolize(name)
1448
+ name = name.intern
1449
1449
 
1450
1450
  (provider_hash.has_key?(name) && provider_hash[name].suitable?)
1451
1451
  end
@@ -1453,7 +1453,7 @@ class Type
1453
1453
  # Create a new provider of a type. This method must be called
1454
1454
  # directly on the type that it's implementing.
1455
1455
  def self.provide(name, options = {}, &block)
1456
- name = Puppet::Util.symbolize(name)
1456
+ name = name.intern
1457
1457
 
1458
1458
  if unprovide(name)
1459
1459
  Puppet.debug "Reloading #{name} #{self.name} provider"
@@ -1742,6 +1742,9 @@ class Type
1742
1742
  #@validate = block
1743
1743
  end
1744
1744
 
1745
+ # Origin information.
1746
+ attr_accessor :file, :line
1747
+
1745
1748
  # The catalog that this resource is stored in.
1746
1749
  attr_accessor :catalog
1747
1750
 
@@ -1880,7 +1883,9 @@ class Type
1880
1883
 
1881
1884
  # Return the "type[name]" style reference.
1882
1885
  def ref
1883
- "#{self.class.name.to_s.capitalize}[#{self.title}]"
1886
+ # memoizing this is worthwhile ~ 3 percent of calls are the "first time
1887
+ # around" in an average run of Puppet. --daniel 2012-07-17
1888
+ @ref ||= "#{self.class.name.to_s.capitalize}[#{self.title}]"
1884
1889
  end
1885
1890
 
1886
1891
  def self_refresh?