puppet 2.7.3 → 2.7.4

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 (337) hide show
  1. data/CHANGELOG +166 -0
  2. data/install.rb +27 -7
  3. data/lib/puppet/application/agent.rb +29 -29
  4. data/lib/puppet/application/doc.rb +1 -1
  5. data/lib/puppet/application/inspect.rb +9 -1
  6. data/lib/puppet/application/master.rb +2 -0
  7. data/lib/puppet/application/queue.rb +1 -1
  8. data/lib/puppet/application/resource.rb +3 -0
  9. data/lib/puppet/application.rb +4 -5
  10. data/lib/puppet/configurer.rb +1 -4
  11. data/lib/puppet/defaults.rb +45 -15
  12. data/lib/puppet/feature/base.rb +28 -17
  13. data/lib/puppet/feature/rails.rb +0 -3
  14. data/lib/puppet/feature/rubygems.rb +0 -3
  15. data/lib/puppet/file_bucket/dipper.rb +3 -2
  16. data/lib/puppet/file_bucket/file.rb +3 -3
  17. data/lib/puppet/file_serving/base.rb +4 -5
  18. data/lib/puppet/file_serving/configuration.rb +7 -13
  19. data/lib/puppet/file_serving/content.rb +0 -4
  20. data/lib/puppet/file_serving/fileset.rb +7 -6
  21. data/lib/puppet/file_serving/indirection_hooks.rb +1 -4
  22. data/lib/puppet/file_serving/metadata.rb +0 -4
  23. data/lib/puppet/file_serving/mount/file.rb +9 -12
  24. data/lib/puppet/file_serving/mount.rb +0 -5
  25. data/lib/puppet/file_serving/terminus_helper.rb +0 -4
  26. data/lib/puppet/file_serving.rb +0 -4
  27. data/lib/puppet/indirector/catalog/compiler.rb +0 -18
  28. data/lib/puppet/indirector/catalog/store_configs.rb +5 -0
  29. data/lib/puppet/indirector/direct_file_server.rb +0 -4
  30. data/lib/puppet/indirector/facts/facter.rb +2 -2
  31. data/lib/puppet/indirector/facts/store_configs.rb +5 -0
  32. data/lib/puppet/indirector/file_content/file.rb +0 -4
  33. data/lib/puppet/indirector/file_content/file_server.rb +0 -4
  34. data/lib/puppet/indirector/file_content/rest.rb +0 -4
  35. data/lib/puppet/indirector/file_metadata/file.rb +0 -4
  36. data/lib/puppet/indirector/file_metadata/file_server.rb +0 -4
  37. data/lib/puppet/indirector/file_metadata/rest.rb +0 -4
  38. data/lib/puppet/indirector/file_server.rb +1 -5
  39. data/lib/puppet/indirector/indirection.rb +3 -5
  40. data/lib/puppet/indirector/node/store_configs.rb +5 -0
  41. data/lib/puppet/indirector/request.rb +3 -1
  42. data/lib/puppet/indirector/resource/active_record.rb +97 -0
  43. data/lib/puppet/indirector/resource/store_configs.rb +3 -0
  44. data/lib/puppet/indirector/ssl_file.rb +5 -1
  45. data/lib/puppet/indirector/store_configs.rb +30 -0
  46. data/lib/puppet/indirector/yaml.rb +5 -0
  47. data/lib/puppet/indirector.rb +7 -0
  48. data/lib/puppet/network/client.rb +0 -5
  49. data/lib/puppet/network/http_pool.rb +0 -56
  50. data/lib/puppet/node/environment.rb +9 -11
  51. data/lib/puppet/parameter/path.rb +1 -5
  52. data/lib/puppet/parameter.rb +1 -7
  53. data/lib/puppet/parser/ast/collection.rb +2 -2
  54. data/lib/puppet/parser/ast/collexpr.rb +10 -39
  55. data/lib/puppet/parser/collector.rb +41 -90
  56. data/lib/puppet/parser/compiler.rb +0 -3
  57. data/lib/puppet/parser/functions/create_resources.rb +22 -10
  58. data/lib/puppet/parser/functions/versioncmp.rb +9 -6
  59. data/lib/puppet/parser/resource.rb +1 -1
  60. data/lib/puppet/parser/type_loader.rb +2 -1
  61. data/lib/puppet/provider/augeas/augeas.rb +5 -3
  62. data/lib/puppet/provider/cron/crontab.rb +2 -2
  63. data/lib/puppet/provider/exec/posix.rb +23 -96
  64. data/lib/puppet/provider/exec/shell.rb +11 -2
  65. data/lib/puppet/provider/exec/windows.rb +35 -0
  66. data/lib/puppet/provider/exec.rb +79 -0
  67. data/lib/puppet/provider/group/windows_adsi.rb +48 -0
  68. data/lib/puppet/provider/host/parsed.rb +3 -0
  69. data/lib/puppet/provider/macauthorization/macauthorization.rb +4 -4
  70. data/lib/puppet/provider/mount.rb +0 -3
  71. data/lib/puppet/provider/naginator.rb +0 -3
  72. data/lib/puppet/provider/package/appdmg.rb +0 -1
  73. data/lib/puppet/provider/package/apple.rb +3 -7
  74. data/lib/puppet/provider/package/apt.rb +0 -1
  75. data/lib/puppet/provider/package/aptitude.rb +0 -1
  76. data/lib/puppet/provider/package/aptrpm.rb +0 -1
  77. data/lib/puppet/provider/package/blastwave.rb +0 -1
  78. data/lib/puppet/provider/package/dpkg.rb +5 -6
  79. data/lib/puppet/provider/package/fink.rb +3 -4
  80. data/lib/puppet/provider/package/freebsd.rb +0 -1
  81. data/lib/puppet/provider/package/gem.rb +0 -1
  82. data/lib/puppet/provider/package/hpux.rb +3 -3
  83. data/lib/puppet/provider/package/macports.rb +0 -1
  84. data/lib/puppet/provider/package/msi.rb +82 -0
  85. data/lib/puppet/provider/package/openbsd.rb +18 -19
  86. data/lib/puppet/provider/package/pip.rb +0 -1
  87. data/lib/puppet/provider/package/pkg.rb +0 -1
  88. data/lib/puppet/provider/package/pkgdmg.rb +9 -7
  89. data/lib/puppet/provider/package/pkgutil.rb +0 -1
  90. data/lib/puppet/provider/package/ports.rb +0 -1
  91. data/lib/puppet/provider/package/portupgrade.rb +183 -193
  92. data/lib/puppet/provider/package/rpm.rb +1 -1
  93. data/lib/puppet/provider/package/sun.rb +0 -1
  94. data/lib/puppet/provider/package/sunfreeware.rb +0 -2
  95. data/lib/puppet/provider/package/up2date.rb +0 -1
  96. data/lib/puppet/provider/package/urpmi.rb +0 -1
  97. data/lib/puppet/provider/package/yum.rb +1 -1
  98. data/lib/puppet/provider/package.rb +4 -3
  99. data/lib/puppet/provider/service/systemd.rb +64 -0
  100. data/lib/puppet/provider/service/windows.rb +110 -0
  101. data/lib/puppet/provider/user/windows_adsi.rb +71 -0
  102. data/lib/puppet/rails/resource.rb +1 -1
  103. data/lib/puppet/relationship.rb +0 -3
  104. data/lib/puppet/reports/tagmail.rb +15 -11
  105. data/lib/puppet/resource/catalog.rb +17 -24
  106. data/lib/puppet/ssl/certificate_authority.rb +7 -5
  107. data/lib/puppet/ssl/host.rb +6 -10
  108. data/lib/puppet/type/augeas.rb +19 -13
  109. data/lib/puppet/type/cron.rb +13 -12
  110. data/lib/puppet/type/exec.rb +17 -17
  111. data/lib/puppet/type/file/content.rb +7 -3
  112. data/lib/puppet/type/file/source.rb +14 -9
  113. data/lib/puppet/type/file.rb +44 -23
  114. data/lib/puppet/type/filebucket.rb +13 -5
  115. data/lib/puppet/type/package.rb +14 -1
  116. data/lib/puppet/type/service.rb +11 -1
  117. data/lib/puppet/type/ssh_authorized_key.rb +3 -1
  118. data/lib/puppet/type.rb +8 -17
  119. data/lib/puppet/util/adsi.rb +278 -0
  120. data/lib/puppet/util/autoload.rb +0 -2
  121. data/lib/puppet/util/cacher.rb +15 -67
  122. data/lib/puppet/util/feature.rb +0 -3
  123. data/lib/puppet/util/graph.rb +0 -3
  124. data/lib/puppet/util/ldap/connection.rb +0 -3
  125. data/lib/puppet/util/ldap/generator.rb +0 -3
  126. data/lib/puppet/util/ldap.rb +0 -3
  127. data/lib/puppet/util/log_paths.rb +0 -3
  128. data/lib/puppet/util/network_device/cisco/device.rb +2 -1
  129. data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
  130. data/lib/puppet/util/pidlock.rb +5 -1
  131. data/lib/puppet/util/rdoc/parser.rb +3 -1
  132. data/lib/puppet/util/run_mode.rb +2 -2
  133. data/lib/puppet/util/settings/file_setting.rb +3 -2
  134. data/lib/puppet/util/settings.rb +4 -6
  135. data/lib/puppet/util/suidmanager.rb +62 -15
  136. data/lib/puppet/util.rb +113 -131
  137. data/lib/puppet.rb +1 -1
  138. data/spec/integration/application/doc_spec.rb +1 -1
  139. data/spec/integration/defaults_spec.rb +22 -17
  140. data/spec/integration/file_serving/content_spec.rb +0 -6
  141. data/spec/integration/file_serving/metadata_spec.rb +0 -6
  142. data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
  143. data/spec/integration/indirector/direct_file_server_spec.rb +5 -7
  144. data/spec/integration/indirector/file_content/file_server_spec.rb +2 -6
  145. data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -5
  146. data/spec/integration/network/server/webrick_spec.rb +6 -9
  147. data/spec/integration/node/facts_spec.rb +0 -6
  148. data/spec/integration/node_spec.rb +3 -4
  149. data/spec/integration/parser/compiler_spec.rb +2 -1
  150. data/spec/integration/parser/parser_spec.rb +2 -4
  151. data/spec/integration/provider/mount_spec.rb +1 -1
  152. data/spec/integration/provider/package_spec.rb +13 -3
  153. data/spec/integration/provider/ssh_authorized_key_spec.rb +4 -4
  154. data/spec/integration/reports_spec.rb +0 -4
  155. data/spec/integration/resource/catalog_spec.rb +0 -5
  156. data/spec/integration/ssl/certificate_authority_spec.rb +6 -14
  157. data/spec/integration/ssl/certificate_request_spec.rb +10 -17
  158. data/spec/integration/ssl/certificate_revocation_list_spec.rb +8 -13
  159. data/spec/integration/ssl/host_spec.rb +8 -14
  160. data/spec/integration/transaction/report_spec.rb +0 -5
  161. data/spec/integration/transaction_spec.rb +11 -13
  162. data/spec/integration/type/file_spec.rb +16 -16
  163. data/spec/integration/type/tidy_spec.rb +1 -1
  164. data/spec/integration/util/settings_spec.rb +2 -2
  165. data/spec/integration/util_spec.rb +13 -0
  166. data/spec/lib/puppet_spec/files.rb +18 -10
  167. data/spec/shared_behaviours/file_server_terminus.rb +1 -5
  168. data/spec/shared_behaviours/file_serving.rb +0 -4
  169. data/spec/shared_behaviours/memory_terminus.rb +0 -4
  170. data/spec/shared_behaviours/path_parameters.rb +20 -18
  171. data/spec/shared_behaviours/store_configs_terminus.rb +21 -0
  172. data/spec/spec_helper.rb +31 -0
  173. data/spec/unit/agent_spec.rb +0 -4
  174. data/spec/unit/application/apply_spec.rb +8 -2
  175. data/spec/unit/application/certificate_spec.rb +2 -0
  176. data/spec/unit/application/device_spec.rb +8 -6
  177. data/spec/unit/application/inspect_spec.rb +2 -1
  178. data/spec/unit/application/master_spec.rb +7 -2
  179. data/spec/unit/application/queue_spec.rb +3 -4
  180. data/spec/unit/application/resource_spec.rb +26 -0
  181. data/spec/unit/application/secret_agent_spec.rb +3 -1
  182. data/spec/unit/application_spec.rb +4 -0
  183. data/spec/unit/configurer/downloader_spec.rb +4 -3
  184. data/spec/unit/configurer_spec.rb +11 -4
  185. data/spec/unit/daemon_spec.rb +3 -1
  186. data/spec/unit/face/ca_spec.rb +1 -1
  187. data/spec/unit/face/node_spec.rb +5 -1
  188. data/spec/unit/face/secret_agent_spec.rb +3 -1
  189. data/spec/unit/file_bucket/dipper_spec.rb +4 -4
  190. data/spec/unit/file_bucket/file_spec.rb +9 -3
  191. data/spec/unit/file_serving/configuration_spec.rb +26 -37
  192. data/spec/unit/file_serving/fileset_spec.rb +71 -55
  193. data/spec/unit/file_serving/indirection_hooks_spec.rb +0 -4
  194. data/spec/unit/file_serving/mount/file_spec.rb +163 -169
  195. data/spec/unit/file_serving/terminus_helper_spec.rb +0 -4
  196. data/spec/unit/indirector/catalog/compiler_spec.rb +0 -22
  197. data/spec/unit/indirector/catalog/store_configs_spec.rb +17 -0
  198. data/spec/unit/indirector/certificate/ca_spec.rb +0 -4
  199. data/spec/unit/indirector/certificate/file_spec.rb +0 -4
  200. data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -5
  201. data/spec/unit/indirector/certificate_request/file_spec.rb +0 -4
  202. data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +0 -4
  203. data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +0 -4
  204. data/spec/unit/indirector/certificate_status/file_spec.rb +1 -1
  205. data/spec/unit/indirector/direct_file_server_spec.rb +0 -4
  206. data/spec/unit/indirector/facts/facter_spec.rb +0 -4
  207. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +3 -0
  208. data/spec/unit/indirector/facts/store_configs_spec.rb +17 -0
  209. data/spec/unit/indirector/file_bucket_file/file_spec.rb +3 -3
  210. data/spec/unit/indirector/file_content/file_server_spec.rb +0 -4
  211. data/spec/unit/indirector/file_content/file_spec.rb +0 -4
  212. data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -4
  213. data/spec/unit/indirector/file_metadata/file_spec.rb +0 -4
  214. data/spec/unit/indirector/file_server_spec.rb +1 -5
  215. data/spec/unit/indirector/indirection_spec.rb +0 -4
  216. data/spec/unit/indirector/key/ca_spec.rb +0 -4
  217. data/spec/unit/indirector/key/file_spec.rb +0 -4
  218. data/spec/unit/indirector/node/store_configs_spec.rb +16 -0
  219. data/spec/unit/indirector/report/processor_spec.rb +0 -4
  220. data/spec/unit/indirector/resource/active_record_spec.rb +192 -0
  221. data/spec/unit/indirector/resource/ral_spec.rb +1 -1
  222. data/spec/unit/indirector/resource/store_configs_spec.rb +12 -0
  223. data/spec/unit/indirector/resource_type/parser_spec.rb +3 -3
  224. data/spec/unit/indirector/ssl_file_spec.rb +25 -6
  225. data/spec/unit/indirector/store_configs_spec.rb +8 -0
  226. data/spec/unit/indirector/yaml_spec.rb +14 -0
  227. data/spec/unit/module_spec.rb +2 -2
  228. data/spec/unit/network/handler/fileserver_spec.rb +5 -5
  229. data/spec/unit/network/http/mongrel_spec.rb +0 -4
  230. data/spec/unit/network/http/webrick_spec.rb +5 -9
  231. data/spec/unit/network/http_pool_spec.rb +4 -75
  232. data/spec/unit/network/http_spec.rb +0 -4
  233. data/spec/unit/network/server_spec.rb +0 -4
  234. data/spec/unit/node/environment_spec.rb +18 -31
  235. data/spec/unit/node/facts_spec.rb +0 -4
  236. data/spec/unit/node_spec.rb +1 -8
  237. data/spec/unit/other/selinux_spec.rb +3 -1
  238. data/spec/unit/parameter_spec.rb +0 -10
  239. data/spec/unit/parser/ast/collexpr_spec.rb +17 -13
  240. data/spec/unit/parser/collector_spec.rb +147 -263
  241. data/spec/unit/parser/compiler_spec.rb +3 -1
  242. data/spec/unit/parser/files_spec.rb +7 -4
  243. data/spec/unit/parser/functions/extlookup_spec.rb +6 -3
  244. data/spec/unit/parser/functions/sprintf_spec.rb +2 -1
  245. data/spec/unit/parser/type_loader_spec.rb +7 -7
  246. data/spec/unit/property_spec.rb +1 -1
  247. data/spec/unit/provider/augeas/augeas_spec.rb +14 -0
  248. data/spec/unit/provider/exec/posix_spec.rb +102 -106
  249. data/spec/unit/provider/exec/shell_spec.rb +1 -1
  250. data/spec/unit/provider/exec/windows_spec.rb +119 -0
  251. data/spec/unit/provider/group/ldap_spec.rb +0 -4
  252. data/spec/unit/provider/group/windows_adsi_spec.rb +79 -0
  253. data/spec/unit/provider/ldap_spec.rb +0 -4
  254. data/spec/unit/provider/macauthorization_spec.rb +5 -0
  255. data/spec/unit/provider/mount/parsed_spec.rb +1 -5
  256. data/spec/unit/provider/package/msi_spec.rb +170 -0
  257. data/spec/unit/provider/service/redhat_spec.rb +2 -0
  258. data/spec/unit/provider/service/smf_spec.rb +3 -0
  259. data/spec/unit/provider/service/systemd_spec.rb +25 -0
  260. data/spec/unit/provider/service/windows_spec.rb +166 -0
  261. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
  262. data/spec/unit/provider/user/ldap_spec.rb +0 -4
  263. data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
  264. data/spec/unit/provider/user/useradd_spec.rb +1 -1
  265. data/spec/unit/provider/user/windows_adsi_spec.rb +110 -0
  266. data/spec/unit/relationship_spec.rb +0 -4
  267. data/spec/unit/resource/catalog_spec.rb +37 -25
  268. data/spec/unit/resource/status_spec.rb +4 -2
  269. data/spec/unit/resource_spec.rb +5 -5
  270. data/spec/unit/simple_graph_spec.rb +0 -4
  271. data/spec/unit/ssl/certificate_authority_spec.rb +2 -2
  272. data/spec/unit/ssl/host_spec.rb +12 -13
  273. data/spec/unit/ssl/inventory_spec.rb +2 -2
  274. data/spec/unit/sslcertificates/ca_spec.rb +6 -10
  275. data/spec/unit/transaction/event_manager_spec.rb +4 -2
  276. data/spec/unit/transaction/event_spec.rb +3 -1
  277. data/spec/unit/transaction/report_spec.rb +2 -6
  278. data/spec/unit/transaction/resource_harness_spec.rb +9 -5
  279. data/spec/unit/transaction_spec.rb +3 -1
  280. data/spec/unit/type/cron_spec.rb +1 -1
  281. data/spec/unit/type/exec_spec.rb +80 -47
  282. data/spec/unit/type/file/checksum_spec.rb +9 -8
  283. data/spec/unit/type/file/content_spec.rb +2 -1
  284. data/spec/unit/type/file/selinux_spec.rb +10 -8
  285. data/spec/unit/type/file/source_spec.rb +18 -36
  286. data/spec/unit/type/file_spec.rb +170 -217
  287. data/spec/unit/type/group_spec.rb +1 -1
  288. data/spec/unit/type/mount_spec.rb +5 -5
  289. data/spec/unit/type/noop_metaparam_spec.rb +3 -1
  290. data/spec/unit/type/package_spec.rb +15 -3
  291. data/spec/unit/type/resources_spec.rb +2 -2
  292. data/spec/unit/type/service_spec.rb +19 -4
  293. data/spec/unit/type/ssh_authorized_key_spec.rb +10 -4
  294. data/spec/unit/type/tidy_spec.rb +3 -1
  295. data/spec/unit/type/user_spec.rb +1 -1
  296. data/spec/unit/type_spec.rb +29 -34
  297. data/spec/unit/util/adsi_spec.rb +202 -0
  298. data/spec/unit/util/autoload_spec.rb +23 -19
  299. data/spec/unit/util/backups_spec.rb +16 -13
  300. data/spec/unit/util/cacher_spec.rb +64 -141
  301. data/spec/unit/util/checksums_spec.rb +0 -4
  302. data/spec/unit/util/constant_inflector_spec.rb +0 -4
  303. data/spec/unit/util/execution_stub_spec.rb +1 -1
  304. data/spec/unit/util/ldap/connection_spec.rb +0 -4
  305. data/spec/unit/util/ldap/generator_spec.rb +0 -4
  306. data/spec/unit/util/ldap/manager_spec.rb +0 -4
  307. data/spec/unit/util/log_spec.rb +4 -2
  308. data/spec/unit/util/logging_spec.rb +2 -2
  309. data/spec/unit/util/nagios_maker_spec.rb +0 -4
  310. data/spec/unit/util/network_device/cisco/device_spec.rb +2 -1
  311. data/spec/unit/util/network_device/cisco/facts_spec.rb +3 -1
  312. data/spec/unit/util/network_device/config_spec.rb +5 -3
  313. data/spec/unit/util/rdoc/parser_spec.rb +7 -1
  314. data/spec/unit/util/run_mode_spec.rb +6 -2
  315. data/spec/unit/util/settings/file_setting_spec.rb +29 -2
  316. data/spec/unit/util/settings_spec.rb +28 -15
  317. data/spec/unit/util/storage_spec.rb +1 -1
  318. data/spec/unit/util/suidmanager_spec.rb +310 -0
  319. data/spec/unit/util/tagging_spec.rb +0 -4
  320. data/spec/unit/util_spec.rb +335 -0
  321. data/test/language/ast/variable.rb +0 -4
  322. data/test/lib/puppettest/support/resources.rb +0 -4
  323. data/test/lib/puppettest/testcase.rb +0 -4
  324. data/test/lib/puppettest.rb +0 -1
  325. data/test/network/handler/master.rb +0 -5
  326. data/test/network/server/webrick.rb +5 -22
  327. data/test/ral/manager/attributes.rb +0 -4
  328. data/test/ral/manager/instances.rb +0 -4
  329. data/test/ral/manager/manager.rb +0 -4
  330. data/test/ral/providers/cron/crontab.rb +1 -0
  331. data/test/ral/providers/service/base.rb +0 -4
  332. data/test/ral/type/filesources.rb +0 -1
  333. data/test/ral/type/resources.rb +0 -4
  334. data/test/util/utiltest.rb +0 -13
  335. metadata +36 -9
  336. data/spec/unit/network/client_spec.rb +0 -45
  337. data/test/puppet/tc_suidmanager.rb +0 -120
@@ -23,7 +23,7 @@ Puppet::Type.newtype(:file) do
23
23
  location, rather than using native resources, please contact
24
24
  Puppet Labs and we can hopefully work with you to develop a
25
25
  native resource to support what you are doing.
26
-
26
+
27
27
  **Autorequires:** If Puppet is managing the user or group that owns a file, the file resource will autorequire them. If Puppet is managing any parent directories of a file, the file resource will autorequire them."
28
28
 
29
29
  def self.title_patterns
@@ -36,7 +36,7 @@ Puppet::Type.newtype(:file) do
36
36
 
37
37
  validate do |value|
38
38
  # accept various path syntaxes: lone slash, posix, win32, unc
39
- unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/))
39
+ unless (Puppet.features.posix? and value =~ /^\//) or (value =~ /^[A-Za-z]:\// or value =~ /^\/\/[^\/]+\/[^\/]+/)
40
40
  fail Puppet::Error, "File paths must be fully qualified, not '#{value}'"
41
41
  end
42
42
  end
@@ -44,7 +44,21 @@ Puppet::Type.newtype(:file) do
44
44
  # convert the current path in an index into the collection and the last
45
45
  # path name. The aim is to use less storage for all common paths in a hierarchy
46
46
  munge do |value|
47
- path, name = ::File.split(value.gsub(/\/+/,'/'))
47
+ # We need to save off, and remove the volume designator in the
48
+ # path if it is there, since File.split does not handle paths
49
+ # with volume designators properly, except when run on Windows.
50
+ # Since we are potentially compiling a catalog for a Windows
51
+ # machine on a non-Windows master, we need to handle this
52
+ # ourselves.
53
+ optional_volume_designator = value.match(/^([a-z]:)[\/\\].*/i)
54
+ value_without_designator = value.sub(/^(?:[a-z]:)?(.*)/i, '\1')
55
+
56
+ path, name = ::File.split(value_without_designator.gsub(/\/+/,'/'))
57
+
58
+ if optional_volume_designator
59
+ path = optional_volume_designator[1] + path
60
+ end
61
+
48
62
  { :index => Puppet::FileCollection.collection.index(path), :name => name }
49
63
  end
50
64
 
@@ -75,16 +89,18 @@ Puppet::Type.newtype(:file) do
75
89
 
76
90
  Puppet automatically creates a local filebucket named `puppet` and
77
91
  defaults to backing up there. To use a server-based filebucket,
78
- you must specify one in your configuration
92
+ you must specify one in your configuration.
79
93
 
80
94
  filebucket { main:
81
- server => puppet
95
+ server => puppet,
96
+ path => false,
97
+ # The path => false line works around a known issue with the filebucket type.
82
98
  }
83
99
 
84
100
  The `puppet master` daemon creates a filebucket by default,
85
101
  so you can usually back up to your main server with this
86
102
  configuration. Once you've described the bucket in your
87
- configuration, you can use it in any file
103
+ configuration, you can use it in any file's backup attribute:
88
104
 
89
105
  file { \"/my/file\":
90
106
  source => \"/path/in/nfs/or/something\",
@@ -93,12 +109,12 @@ Puppet::Type.newtype(:file) do
93
109
 
94
110
  This will back the file up to the central server.
95
111
 
96
- At this point, the benefits of using a filebucket are that you do not
97
- have backup files lying around on each of your machines, a given
98
- version of a file is only backed up once, and you can restore
99
- any given file manually, no matter how old. Eventually,
100
- transactional support will be able to automatically restore
101
- filebucketed files.
112
+ At this point, the benefits of using a central filebucket are that you
113
+ do not have backup files lying around on each of your machines, a given
114
+ version of a file is only backed up once, you can restore any given file
115
+ manually (no matter how old), and you can use Puppet Dashboard to view
116
+ file contents. Eventually, transactional support will be able to
117
+ automatically restore filebucketed files.
102
118
  "
103
119
 
104
120
  defaultto "puppet"
@@ -316,8 +332,8 @@ Puppet::Type.newtype(:file) do
316
332
  super(path.gsub(/\/+/, '/').sub(/\/$/, ''))
317
333
  end
318
334
 
319
- def self.instances(base = '/')
320
- return self.new(:name => base, :recurse => true, :recurselimit => 1, :audit => :all).recurse_local.values
335
+ def self.instances
336
+ return []
321
337
  end
322
338
 
323
339
  # Determine the user to write files as.
@@ -394,7 +410,7 @@ Puppet::Type.newtype(:file) do
394
410
  @parameters.each do |name, param|
395
411
  param.flush if param.respond_to?(:flush)
396
412
  end
397
- @stat = nil
413
+ @stat = :needs_stat
398
414
  end
399
415
 
400
416
  def initialize(hash)
@@ -413,7 +429,7 @@ Puppet::Type.newtype(:file) do
413
429
  end
414
430
  end
415
431
 
416
- @stat = nil
432
+ @stat = :needs_stat
417
433
  end
418
434
 
419
435
  # Configure discovered resources to be purged.
@@ -623,7 +639,7 @@ Puppet::Type.newtype(:file) do
623
639
  else
624
640
  self.fail "Could not back up files of type #{s.ftype}"
625
641
  end
626
- expire
642
+ @stat = :needs_stat
627
643
  end
628
644
 
629
645
  def retrieve
@@ -674,22 +690,27 @@ Puppet::Type.newtype(:file) do
674
690
  # use either 'stat' or 'lstat', and we expect the properties to use the
675
691
  # resulting stat object accordingly (mostly by testing the 'ftype'
676
692
  # value).
677
- cached_attr(:stat) do
693
+ #
694
+ # We use the initial value :needs_stat to ensure we only stat the file once,
695
+ # but can also keep track of a failed stat (@stat == nil). This also allows
696
+ # us to re-stat on demand by setting @stat = :needs_stat.
697
+ def stat
698
+ return @stat unless @stat == :needs_stat
699
+
678
700
  method = :stat
679
701
 
680
702
  # Files are the only types that support links
681
703
  if (self.class.name == :file and self[:links] != :follow) or self.class.name == :tidy
682
704
  method = :lstat
683
705
  end
684
- path = self[:path]
685
706
 
686
- begin
707
+ @stat = begin
687
708
  ::File.send(method, self[:path])
688
709
  rescue Errno::ENOENT => error
689
- return nil
710
+ nil
690
711
  rescue Errno::EACCES => error
691
712
  warning "Could not stat; permission denied"
692
- return nil
713
+ nil
693
714
  end
694
715
  end
695
716
 
@@ -776,7 +797,7 @@ Puppet::Type.newtype(:file) do
776
797
  next unless [:mode, :owner, :group, :seluser, :selrole, :seltype, :selrange].include?(thing.name)
777
798
 
778
799
  # Make sure we get a new stat objct
779
- expire
800
+ @stat = :needs_stat
780
801
  currentvalue = thing.retrieve
781
802
  thing.sync unless thing.safe_insync?(currentvalue)
782
803
  end
@@ -11,15 +11,20 @@ module Puppet
11
11
  it can be specified as the value of *backup* in a **file** object.
12
12
 
13
13
  Currently, filebuckets are only useful for manual retrieval of
14
- accidentally removed files (e.g., you look in the log for the md5 sum and retrieve the file with that sum from the filebucket), but
15
- when transactions are fully supported filebuckets will be used to
16
- undo transactions.
14
+ accidentally removed files (e.g., you look in the log for the md5 sum
15
+ and retrieve the file with that sum from the filebucket), but when
16
+ transactions are fully supported filebuckets will be used to undo
17
+ transactions.
17
18
 
18
19
  You will normally want to define a single filebucket for your
19
20
  whole network and then use that as the default backup location:
20
21
 
21
22
  # Define the bucket
22
- filebucket { main: server => puppet }
23
+ filebucket { 'main':
24
+ server => puppet,
25
+ path => false,
26
+ # Due to a known issue, path must be set to false for remote filebuckets.
27
+ }
23
28
 
24
29
  # Specify it as the default target
25
30
  File { backup => main }
@@ -36,7 +41,10 @@ module Puppet
36
41
  desc "The server providing the remote filebucket. If this is not
37
42
  specified then *path* is checked. If it is set, then the
38
43
  bucket is local. Otherwise the puppetmaster server specified
39
- in the config or at the commandline is used."
44
+ in the config or at the commandline is used.
45
+
46
+ Due to a known issue, you currently must set the `path` attribute to
47
+ false if you wish to specify a `server` attribute."
40
48
  defaultto { Puppet[:server] }
41
49
  end
42
50
 
@@ -16,7 +16,7 @@ module Puppet
16
16
  using the `provider` parameter; each provider defines what it
17
17
  requires in order to function, and you must meet those requirements
18
18
  to use a given provider.
19
-
19
+
20
20
  **Autorequires:** If Puppet is managing the files specified as a package's
21
21
  `adminfile`, `responsefile`, or `source`, the package resource will autorequire
22
22
  those files."
@@ -44,6 +44,8 @@ module Puppet
44
44
  a user or another package. Held is considered a superset of
45
45
  installed.",
46
46
  :methods => [:hold]
47
+ feature :install_options, "The provider accepts options to be
48
+ passed to the installer command."
47
49
 
48
50
  ensurable do
49
51
  desc "What state the package should be in.
@@ -221,9 +223,11 @@ module Puppet
221
223
  (or on a network file system) or a URL that your specific
222
224
  packaging type understands; Puppet will not retrieve files for you."
223
225
  end
226
+
224
227
  newparam(:instance) do
225
228
  desc "A read-only parameter set by the package."
226
229
  end
230
+
227
231
  newparam(:status) do
228
232
  desc "A read-only parameter set by the package."
229
233
  end
@@ -291,6 +295,15 @@ module Puppet
291
295
  further specifications for which type of package you want."
292
296
  end
293
297
 
298
+ newparam(:install_options, :required_features => :install_options) do
299
+ desc "A hash of options to be handled by the provider when
300
+ installing a package."
301
+ end
302
+
303
+ validate do
304
+ provider.validate_source(self[:source])
305
+ end
306
+
294
307
  autorequire(:file) do
295
308
  autos = []
296
309
  [:responsefile, :adminfile].each { |param|
@@ -47,9 +47,19 @@ module Puppet
47
47
  provider.disable
48
48
  end
49
49
 
50
+ newvalue(:manual, :event => :service_manual_start) do
51
+ provider.manual_start
52
+ end
53
+
50
54
  def retrieve
51
55
  provider.enabled?
52
56
  end
57
+
58
+ validate do |value|
59
+ if value == :manual and !Puppet.features.microsoft_windows?
60
+ raise Puppet::Error.new("Setting enable to manual is only supported on Microsoft Windows.")
61
+ end
62
+ end
53
63
  end
54
64
 
55
65
  # Handle whether the service should actually be running right now.
@@ -121,7 +131,7 @@ module Puppet
121
131
  value = [value] unless value.is_a?(Array)
122
132
  # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
123
133
  # It affects stand-alone blocks, too.
124
- paths = value.flatten.collect { |p| x = p.split(":") }.flatten
134
+ paths = value.flatten.collect { |p| x = p.split(File::PATH_SEPARATOR) }.flatten
125
135
  end
126
136
 
127
137
  defaultto { provider.class.defpath if provider.class.respond_to?(:defpath) }
@@ -92,7 +92,9 @@ module Puppet
92
92
  end
93
93
 
94
94
  validate do |value|
95
- raise Puppet::Error, "Options must be provided as an array, not a comma separated list" if value != :absent and value.include?(',')
95
+ unless value == :absent or value =~ /^[-a-z0-9A-Z_]+(?:=\".*?\")?$/
96
+ raise Puppet::Error, "Option #{value} is not valid. A single option must either be of the form 'option' or 'option=\"value\". Multiple options must be provided as an array"
97
+ end
96
98
  end
97
99
  end
98
100
 
data/lib/puppet/type.rb CHANGED
@@ -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/util/cacher'
13
12
  require 'puppet/file_collection/lookup'
14
13
  require 'puppet/util/tagging'
15
14
 
@@ -21,7 +20,6 @@ class Type
21
20
  include Puppet::Util::Errors
22
21
  include Puppet::Util::LogPaths
23
22
  include Puppet::Util::Logging
24
- include Puppet::Util::Cacher
25
23
  include Puppet::FileCollection::Lookup
26
24
  include Puppet::Util::Tagging
27
25
 
@@ -228,15 +226,14 @@ class Type
228
226
  def self.newparam(name, options = {}, &block)
229
227
  options[:attributes] ||= {}
230
228
 
231
- param = genclass(
232
- name,
233
- :parent => options[:parent] || Puppet::Parameter,
229
+ param = genclass(
230
+ name,
231
+ :parent => options[:parent] || Puppet::Parameter,
234
232
  :attributes => options[:attributes],
235
- :block => block,
236
- :prefix => "Parameter",
237
- :array => @parameters,
238
-
239
- :hash => @paramhash
233
+ :block => block,
234
+ :prefix => "Parameter",
235
+ :array => @parameters,
236
+ :hash => @paramhash
240
237
  )
241
238
 
242
239
  handle_param_options(name, options)
@@ -469,12 +466,6 @@ class Type
469
466
  Puppet::Transaction::Event.new({:resource => self, :file => file, :line => line, :tags => tags}.merge(options))
470
467
  end
471
468
 
472
- # Let the catalog determine whether a given cached value is
473
- # still valid or has expired.
474
- def expirer
475
- catalog
476
- end
477
-
478
469
  # retrieve the 'should' value for a specified property
479
470
  def should(name)
480
471
  name = attr_alias(name)
@@ -980,7 +971,7 @@ class Type
980
971
 
981
972
  newmetaparam(:audit) do
982
973
  desc "Marks a subset of this resource's unmanaged attributes for auditing. Accepts an
983
- attribute name or a list of attribute names.
974
+ attribute name, an array of attribute names, or `all`.
984
975
 
985
976
  Auditing a resource attribute has two effects: First, whenever a catalog
986
977
  is applied with puppet apply or puppet agent, Puppet will check whether
@@ -0,0 +1,278 @@
1
+ module Puppet::Util::ADSI
2
+ class << self
3
+ def connectable?(uri)
4
+ begin
5
+ !! connect(uri)
6
+ rescue
7
+ false
8
+ end
9
+ end
10
+
11
+ def connect(uri)
12
+ begin
13
+ WIN32OLE.connect(uri)
14
+ rescue Exception => e
15
+ raise Puppet::Error.new( "ADSI connection error: #{e}" )
16
+ end
17
+ end
18
+
19
+ def create(name, resource_type)
20
+ Puppet::Util::ADSI.connect(computer_uri).Create(resource_type, name)
21
+ end
22
+
23
+ def delete(name, resource_type)
24
+ Puppet::Util::ADSI.connect(computer_uri).Delete(resource_type, name)
25
+ end
26
+
27
+ def computer_name
28
+ unless @computer_name
29
+ buf = " " * 128
30
+ Win32API.new('kernel32', 'GetComputerName', ['P','P'], 'I').call(buf, buf.length.to_s)
31
+ @computer_name = buf.unpack("A*")
32
+ end
33
+ @computer_name
34
+ end
35
+
36
+ def computer_uri
37
+ "WinNT://#{computer_name}"
38
+ end
39
+
40
+ def wmi_resource_uri( host = '.' )
41
+ "winmgmts:{impersonationLevel=impersonate}!//#{host}/root/cimv2"
42
+ end
43
+
44
+ def uri(resource_name, resource_type)
45
+ "#{computer_uri}/#{resource_name},#{resource_type}"
46
+ end
47
+
48
+ def execquery(query)
49
+ connect(wmi_resource_uri).execquery(query)
50
+ end
51
+ end
52
+
53
+ class User
54
+ extend Enumerable
55
+
56
+ attr_accessor :native_user
57
+ attr_reader :name
58
+ def initialize(name, native_user = nil)
59
+ @name = name
60
+ @native_user = native_user
61
+ end
62
+
63
+ def native_user
64
+ @native_user ||= Puppet::Util::ADSI.connect(uri)
65
+ end
66
+
67
+ def self.uri(name)
68
+ Puppet::Util::ADSI.uri(name, 'user')
69
+ end
70
+
71
+ def uri
72
+ self.class.uri(name)
73
+ end
74
+
75
+ def self.logon(name, password)
76
+ fLOGON32_LOGON_NETWORK = 3
77
+ fLOGON32_PROVIDER_DEFAULT = 0
78
+
79
+ logon_user = Win32API.new("advapi32", "LogonUser", ['P', 'P', 'P', 'L', 'L', 'P'], 'L')
80
+ close_handle = Win32API.new("kernel32", "CloseHandle", ['P'], 'V')
81
+
82
+ token = ' ' * 4
83
+ if logon_user.call(name, "", password, fLOGON32_LOGON_NETWORK, fLOGON32_PROVIDER_DEFAULT, token) != 0
84
+ close_handle.call(token.unpack('L')[0])
85
+ true
86
+ else
87
+ false
88
+ end
89
+ end
90
+
91
+ def [](attribute)
92
+ native_user.Get(attribute)
93
+ end
94
+
95
+ def []=(attribute, value)
96
+ native_user.Put(attribute, value)
97
+ end
98
+
99
+ def commit
100
+ begin
101
+ native_user.SetInfo unless native_user.nil?
102
+ rescue Exception => e
103
+ raise Puppet::Error.new( "User update failed: #{e}" )
104
+ end
105
+ self
106
+ end
107
+
108
+ def password_is?(password)
109
+ self.class.logon(name, password)
110
+ end
111
+
112
+ def add_flag(flag_name, value)
113
+ flag = native_user.Get(flag_name) rescue 0
114
+
115
+ native_user.Put(flag_name, flag | value)
116
+
117
+ commit
118
+ end
119
+
120
+ def password=(password)
121
+ native_user.SetPassword(password)
122
+ commit
123
+ fADS_UF_DONT_EXPIRE_PASSWD = 0x10000
124
+ add_flag("UserFlags", fADS_UF_DONT_EXPIRE_PASSWD)
125
+ end
126
+
127
+ def groups
128
+ # WIN32OLE objects aren't enumerable, so no map
129
+ groups = []
130
+ native_user.Groups.each {|g| groups << g.Name}
131
+ groups
132
+ end
133
+
134
+ def add_to_groups(*group_names)
135
+ group_names.each do |group_name|
136
+ Puppet::Util::ADSI::Group.new(group_name).add_member(@name)
137
+ end
138
+ end
139
+ alias add_to_group add_to_groups
140
+
141
+ def remove_from_groups(*group_names)
142
+ group_names.each do |group_name|
143
+ Puppet::Util::ADSI::Group.new(group_name).remove_member(@name)
144
+ end
145
+ end
146
+ alias remove_from_group remove_from_groups
147
+
148
+ def set_groups(desired_groups, minimum = true)
149
+ return if desired_groups.nil? or desired_groups.empty?
150
+
151
+ desired_groups = desired_groups.split(',').map(&:strip)
152
+
153
+ current_groups = self.groups
154
+
155
+ # First we add the user to all the groups it should be in but isn't
156
+ groups_to_add = desired_groups - current_groups
157
+ add_to_groups(*groups_to_add)
158
+
159
+ # Then we remove the user from all groups it is in but shouldn't be, if
160
+ # that's been requested
161
+ groups_to_remove = current_groups - desired_groups
162
+ remove_from_groups(*groups_to_remove) unless minimum
163
+ end
164
+
165
+ def self.create(name)
166
+ new(name, Puppet::Util::ADSI.create(name, 'user'))
167
+ end
168
+
169
+ def self.exists?(name)
170
+ Puppet::Util::ADSI::connectable?(User.uri(name))
171
+ end
172
+
173
+ def self.delete(name)
174
+ Puppet::Util::ADSI.delete(name, 'user')
175
+ end
176
+
177
+ def self.each(&block)
178
+ wql = Puppet::Util::ADSI.execquery("select * from win32_useraccount")
179
+
180
+ users = []
181
+ wql.each do |u|
182
+ users << new(u.name, u)
183
+ end
184
+
185
+ users.each(&block)
186
+ end
187
+ end
188
+
189
+ class Group
190
+ extend Enumerable
191
+
192
+ attr_accessor :native_group
193
+ attr_reader :name
194
+ def initialize(name, native_group = nil)
195
+ @name = name
196
+ @native_group = native_group
197
+ end
198
+
199
+ def uri
200
+ self.class.uri(name)
201
+ end
202
+
203
+ def self.uri(name)
204
+ Puppet::Util::ADSI.uri(name, 'group')
205
+ end
206
+
207
+ def native_group
208
+ @native_group ||= Puppet::Util::ADSI.connect(uri)
209
+ end
210
+
211
+ def commit
212
+ begin
213
+ native_group.SetInfo unless native_group.nil?
214
+ rescue Exception => e
215
+ raise Puppet::Error.new( "Group update failed: #{e}" )
216
+ end
217
+ self
218
+ end
219
+
220
+ def add_members(*names)
221
+ names.each do |name|
222
+ native_group.Add(Puppet::Util::ADSI::User.uri(name))
223
+ end
224
+ end
225
+ alias add_member add_members
226
+
227
+ def remove_members(*names)
228
+ names.each do |name|
229
+ native_group.Remove(Puppet::Util::ADSI::User.uri(name))
230
+ end
231
+ end
232
+ alias remove_member remove_members
233
+
234
+ def members
235
+ # WIN32OLE objects aren't enumerable, so no map
236
+ members = []
237
+ native_group.Members.each {|m| members << m.Name}
238
+ members
239
+ end
240
+
241
+ def set_members(desired_members)
242
+ return if desired_members.nil? or desired_members.empty?
243
+
244
+ current_members = self.members
245
+
246
+ # First we add all missing members
247
+ members_to_add = desired_members - current_members
248
+ add_members(*members_to_add)
249
+
250
+ # Then we remove all extra members
251
+ members_to_remove = current_members - desired_members
252
+ remove_members(*members_to_remove)
253
+ end
254
+
255
+ def self.create(name)
256
+ new(name, Puppet::Util::ADSI.create(name, 'group'))
257
+ end
258
+
259
+ def self.exists?(name)
260
+ Puppet::Util::ADSI.connectable?(Group.uri(name))
261
+ end
262
+
263
+ def self.delete(name)
264
+ Puppet::Util::ADSI.delete(name, 'group')
265
+ end
266
+
267
+ def self.each(&block)
268
+ wql = Puppet::Util::ADSI.execquery( "select * from win32_group" )
269
+
270
+ groups = []
271
+ wql.each do |g|
272
+ groups << new(g.name, g)
273
+ end
274
+
275
+ groups.each(&block)
276
+ end
277
+ end
278
+ end
@@ -1,5 +1,4 @@
1
1
  require 'puppet/util/warnings'
2
- require 'puppet/util/cacher'
3
2
 
4
3
  # Autoload paths, either based on names or all at once.
5
4
  class Puppet::Util::Autoload
@@ -7,7 +6,6 @@ class Puppet::Util::Autoload
7
6
 
8
7
  include Puppet::Util
9
8
  include Puppet::Util::Warnings
10
- include Puppet::Util::Cacher
11
9
  include Puppet::Util::Autoload::FileCache
12
10
 
13
11
  @autoloaders = {}