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
data/lib/puppet/util.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'English'
4
4
  require 'puppet/util/monkey_patches'
5
5
  require 'sync'
6
+ require 'tempfile'
6
7
  require 'puppet/external/lock'
7
8
  require 'monitor'
8
9
  require 'puppet/util/execution_stub'
@@ -33,12 +34,12 @@ module Util
33
34
  def self.synchronize_on(x,type)
34
35
  sync_object,users = 0,1
35
36
  begin
36
- @@sync_objects.synchronize {
37
+ @@sync_objects.synchronize {
37
38
  (@@sync_objects[x] ||= [Sync.new,0])[users] += 1
38
39
  }
39
40
  @@sync_objects[x][sync_object].synchronize(type) { yield }
40
41
  ensure
41
- @@sync_objects.synchronize {
42
+ @@sync_objects.synchronize {
42
43
  @@sync_objects.delete(x) unless (@@sync_objects[x][users] -= 1) > 0
43
44
  }
44
45
  end
@@ -47,35 +48,24 @@ module Util
47
48
  # Change the process to a different user
48
49
  def self.chuser
49
50
  if group = Puppet[:group]
50
- group = self.gid(group)
51
- raise Puppet::Error, "No such group #{Puppet[:group]}" unless group
52
- unless Puppet::Util::SUIDManager.gid == group
53
- begin
54
- Puppet::Util::SUIDManager.egid = group
55
- Puppet::Util::SUIDManager.gid = group
56
- rescue => detail
57
- Puppet.warning "could not change to group #{group.inspect}: #{detail}"
58
- $stderr.puts "could not change to group #{group.inspect}"
59
-
60
- # Don't exit on failed group changes, since it's
61
- # not fatal
62
- #exit(74)
63
- end
51
+ begin
52
+ Puppet::Util::SUIDManager.change_group(group, true)
53
+ rescue => detail
54
+ Puppet.warning "could not change to group #{group.inspect}: #{detail}"
55
+ $stderr.puts "could not change to group #{group.inspect}"
56
+
57
+ # Don't exit on failed group changes, since it's
58
+ # not fatal
59
+ #exit(74)
64
60
  end
65
61
  end
66
62
 
67
63
  if user = Puppet[:user]
68
- user = self.uid(user)
69
- raise Puppet::Error, "No such user #{Puppet[:user]}" unless user
70
- unless Puppet::Util::SUIDManager.uid == user
71
- begin
72
- Puppet::Util::SUIDManager.initgroups(user)
73
- Puppet::Util::SUIDManager.uid = user
74
- Puppet::Util::SUIDManager.euid = user
75
- rescue => detail
76
- $stderr.puts "Could not change to user #{user}: #{detail}"
77
- exit(74)
78
- end
64
+ begin
65
+ Puppet::Util::SUIDManager.change_user(user, true)
66
+ rescue => detail
67
+ $stderr.puts "Could not change to user #{user}: #{detail}"
68
+ exit(74)
79
69
  end
80
70
  end
81
71
  end
@@ -90,18 +80,14 @@ module Util
90
80
  if useself
91
81
 
92
82
  Puppet::Util::Log.create(
93
-
94
83
  :level => level,
95
84
  :source => self,
96
-
97
85
  :message => args
98
86
  )
99
87
  else
100
88
 
101
89
  Puppet::Util::Log.create(
102
-
103
90
  :level => level,
104
-
105
91
  :message => args
106
92
  )
107
93
  end
@@ -200,7 +186,7 @@ module Util
200
186
  end
201
187
 
202
188
  def which(bin)
203
- if bin =~ /^\//
189
+ if absolute_path?(bin)
204
190
  return bin if FileTest.file? bin and FileTest.executable? bin
205
191
  else
206
192
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|
@@ -212,6 +198,22 @@ module Util
212
198
  end
213
199
  module_function :which
214
200
 
201
+ # Determine in a platform-specific way whether a path is absolute. This
202
+ # defaults to the local platform if none is specified.
203
+ def absolute_path?(path, platform=nil)
204
+ # Escape once for the string literal, and once for the regex.
205
+ slash = '[\\\\/]'
206
+ name = '[^\\\\/]+'
207
+ regexes = {
208
+ :windows => %r!^([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name})!i,
209
+ :posix => %r!^/!,
210
+ }
211
+ platform ||= Puppet.features.microsoft_windows? ? :windows : :posix
212
+
213
+ !! (path =~ regexes[platform])
214
+ end
215
+ module_function :absolute_path?
216
+
215
217
  # Execute the provided command in a pipe, yielding the pipe object.
216
218
  def execpipe(command, failonfail = true)
217
219
  if respond_to? :debug
@@ -240,6 +242,41 @@ module Util
240
242
  raise exception, output
241
243
  end
242
244
 
245
+ def execute_posix(command, arguments, stdin, stdout, stderr)
246
+ child_pid = Kernel.fork do
247
+ command = Array(command)
248
+ Process.setsid
249
+ begin
250
+ $stdin.reopen(stdin)
251
+ $stdout.reopen(stdout)
252
+ $stderr.reopen(stderr)
253
+
254
+ 3.upto(256){|fd| IO::new(fd).close rescue nil}
255
+
256
+ Puppet::Util::SUIDManager.change_group(arguments[:gid], true) if arguments[:gid]
257
+ Puppet::Util::SUIDManager.change_user(arguments[:uid], true) if arguments[:uid]
258
+
259
+ ENV['LANG'] = ENV['LC_ALL'] = ENV['LC_MESSAGES'] = ENV['LANGUAGE'] = 'C'
260
+ Kernel.exec(*command)
261
+ rescue => detail
262
+ puts detail.to_s
263
+ exit!(1)
264
+ end
265
+ end
266
+ child_pid
267
+ end
268
+ module_function :execute_posix
269
+
270
+ def execute_windows(command, arguments, stdin, stdout, stderr)
271
+ command = command.map do |part|
272
+ part.include?(' ') ? %Q["#{part.gsub(/"/, '\"')}"] : part
273
+ end.join(" ") if command.is_a?(Array)
274
+
275
+ process_info = Process.create( :command_line => command, :startup_info => {:stdin => stdin, :stdout => stdout, :stderr => stderr} )
276
+ process_info.process_id
277
+ end
278
+ module_function :execute_windows
279
+
243
280
  # Execute the desired command, and return the status and output.
244
281
  # def execute(command, failonfail = true, uid = nil, gid = nil)
245
282
  # :combine sets whether or not to combine stdout/stderr in the output
@@ -247,13 +284,10 @@ module Util
247
284
  # for stdin is not currently supported.
248
285
  def execute(command, arguments = {:failonfail => true, :combine => true})
249
286
  if command.is_a?(Array)
250
- command = command.flatten.collect { |i| i.to_s }
287
+ command = command.flatten.map(&:to_s)
251
288
  str = command.join(" ")
252
- else
253
- # We require an array here so we know where we're incorrectly
254
- # using a string instead of an array. Once everything is
255
- # switched to an array, we might relax this requirement.
256
- raise ArgumentError, "Must pass an array to execute()"
289
+ elsif command.is_a?(String)
290
+ str = command
257
291
  end
258
292
 
259
293
  if respond_to? :debug
@@ -262,108 +296,35 @@ module Util
262
296
  Puppet.debug "Executing '#{str}'"
263
297
  end
264
298
 
265
- arguments[:uid] = Puppet::Util::SUIDManager.convert_xid(:uid, arguments[:uid]) if arguments[:uid]
266
- arguments[:gid] = Puppet::Util::SUIDManager.convert_xid(:gid, arguments[:gid]) if arguments[:gid]
299
+ null_file = Puppet.features.microsoft_windows? ? 'NUL' : '/dev/null'
267
300
 
268
- if execution_stub = Puppet::Util::ExecutionStub.current_value
269
- return execution_stub.call(command, arguments)
270
- end
301
+ stdin = File.open(arguments[:stdinfile] || null_file, 'r')
302
+ stdout = arguments[:squelch] ? File.open(null_file, 'w') : Tempfile.new('puppet')
303
+ stderr = arguments[:combine] ? stdout : File.open(null_file, 'w')
271
304
 
272
- @@os ||= Facter.value(:operatingsystem)
273
- output = nil
274
- child_pid, child_status = nil
275
- # There are problems with read blocking with badly behaved children
276
- # read.partialread doesn't seem to capture either stdout or stderr
277
- # We hack around this using a temporary file
278
-
279
- # The idea here is to avoid IO#read whenever possible.
280
- output_file="/dev/null"
281
- error_file="/dev/null"
282
- if ! arguments[:squelch]
283
- require "tempfile"
284
- output_file = Tempfile.new("puppet")
285
- error_file=output_file if arguments[:combine]
286
- end
287
305
 
288
- if Puppet.features.posix?
289
- oldverb = $VERBOSE
290
- $VERBOSE = nil
291
- child_pid = Kernel.fork
292
- $VERBOSE = oldverb
293
- if child_pid
294
- # Parent process executes this
295
- child_status = (Process.waitpid2(child_pid)[1]).to_i >> 8
296
- else
297
- # Child process executes this
298
- Process.setsid
299
- begin
300
- if arguments[:stdinfile]
301
- $stdin.reopen(arguments[:stdinfile])
302
- else
303
- $stdin.reopen("/dev/null")
304
- end
305
- $stdout.reopen(output_file)
306
- $stderr.reopen(error_file)
307
-
308
- 3.upto(256){|fd| IO::new(fd).close rescue nil}
309
- if arguments[:gid]
310
- Process.egid = arguments[:gid]
311
- Process.gid = arguments[:gid] unless @@os == "Darwin"
312
- end
313
- if arguments[:uid]
314
- Process.euid = arguments[:uid]
315
- Process.uid = arguments[:uid] unless @@os == "Darwin"
316
- end
317
- ENV['LANG'] = ENV['LC_ALL'] = ENV['LC_MESSAGES'] = ENV['LANGUAGE'] = 'C'
318
- if command.is_a?(Array)
319
- Kernel.exec(*command)
320
- else
321
- Kernel.exec(command)
322
- end
323
- rescue => detail
324
- puts detail.to_s
325
- exit!(1)
326
- end
327
- end
306
+ exec_args = [command, arguments, stdin, stdout, stderr]
307
+
308
+ if execution_stub = Puppet::Util::ExecutionStub.current_value
309
+ return execution_stub.call(*exec_args)
310
+ elsif Puppet.features.posix?
311
+ child_pid = execute_posix(*exec_args)
328
312
  elsif Puppet.features.microsoft_windows?
329
- command = command.collect {|part| '"' + part.gsub(/"/, '\\"') + '"'}.join(" ") if command.is_a?(Array)
330
- Puppet.debug "Creating process '#{command}'"
331
- processinfo = Process.create( :command_line => command )
332
- child_status = (Process.waitpid2(child_pid)[1]).to_i >> 8
313
+ child_pid = execute_windows(*exec_args)
333
314
  end
334
315
 
335
- # read output in if required
336
- if ! arguments[:squelch]
337
-
338
- # Make sure the file's actually there. This is
339
- # basically a race condition, and is probably a horrible
340
- # way to handle it, but, well, oh well.
341
- unless FileTest.exists?(output_file.path)
342
- Puppet.warning "sleeping"
343
- sleep 0.5
344
- unless FileTest.exists?(output_file.path)
345
- Puppet.warning "sleeping 2"
346
- sleep 1
347
- unless FileTest.exists?(output_file.path)
348
- Puppet.warning "Could not get output"
349
- output = ""
350
- end
351
- end
352
- end
353
- unless output
354
- # We have to explicitly open here, so that it reopens
355
- # after the child writes.
356
- output = output_file.open.read
316
+ child_status = Process.waitpid2(child_pid).last
357
317
 
358
- # The 'true' causes the file to get unlinked right away.
359
- output_file.close(true)
360
- end
318
+ [stdin, stdout, stderr].each {|io| io.close rescue nil}
319
+
320
+ # read output in if required
321
+ unless arguments[:squelch]
322
+ output = wait_for_output(stdout)
323
+ Puppet.warning "Could not get output" unless output
361
324
  end
362
325
 
363
- if arguments[:failonfail]
364
- unless child_status == 0
365
- raise ExecutionFailure, "Execution of '#{str}' returned #{child_status}: #{output}"
366
- end
326
+ if arguments[:failonfail] and child_status != 0
327
+ raise ExecutionFailure, "Execution of '#{str}' returned #{child_status.exitstatus}: #{output}"
367
328
  end
368
329
 
369
330
  output
@@ -371,6 +332,27 @@ module Util
371
332
 
372
333
  module_function :execute
373
334
 
335
+ def wait_for_output(stdout)
336
+ # Make sure the file's actually been written. This is basically a race
337
+ # condition, and is probably a horrible way to handle it, but, well, oh
338
+ # well.
339
+ 2.times do |try|
340
+ if File.exists?(stdout.path)
341
+ output = stdout.open.read
342
+
343
+ stdout.close(true)
344
+
345
+ return output
346
+ else
347
+ time_to_sleep = try / 2.0
348
+ Puppet.warning "Waiting for output; will sleep #{time_to_sleep} seconds"
349
+ sleep(time_to_sleep)
350
+ end
351
+ end
352
+ nil
353
+ end
354
+ module_function :wait_for_output
355
+
374
356
  # Create an exclusive lock.
375
357
  def threadlock(resource, type = Sync::EX)
376
358
  Puppet::Util.synchronize_on(resource,type) { yield }
data/lib/puppet.rb CHANGED
@@ -24,7 +24,7 @@ require 'puppet/util/run_mode'
24
24
  # it's also a place to find top-level commands like 'debug'
25
25
 
26
26
  module Puppet
27
- PUPPETVERSION = '2.7.3'
27
+ PUPPETVERSION = '2.7.4'
28
28
 
29
29
  def Puppet.version
30
30
  PUPPETVERSION
@@ -5,7 +5,7 @@ require 'puppet_spec/files'
5
5
  describe Puppet::Application::Doc do
6
6
  include PuppetSpec::Files
7
7
 
8
- it "should not generate an error when module dir overlaps parent of site.pp (#4798)", :'fails_on_ruby_1.9.2' => true do
8
+ it "should not generate an error when module dir overlaps parent of site.pp (#4798)", :'fails_on_ruby_1.9.2' => true, :unless => Puppet.features.microsoft_windows? do
9
9
  begin
10
10
  # Note: the directory structure below is more complex than it
11
11
  # needs to be, but it's representative of the directory structure
@@ -144,31 +144,26 @@ describe "Puppet defaults" do
144
144
  Puppet.features.stubs(:rails?).returns true
145
145
  end
146
146
 
147
- it "should set the Catalog cache class to :active_record" do
148
- Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:active_record)
147
+ it "should set the Catalog cache class to :store_configs" do
148
+ Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:store_configs)
149
149
  Puppet.settings[:storeconfigs] = true
150
150
  end
151
151
 
152
- it "should not set the Catalog cache class to :active_record if asynchronous storeconfigs is enabled" do
153
- Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:active_record).never
152
+ it "should not set the Catalog cache class to :store_configs if asynchronous storeconfigs is enabled" do
153
+ Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:store_configs).never
154
154
  Puppet.settings.expects(:value).with(:async_storeconfigs).returns true
155
155
  Puppet.settings[:storeconfigs] = true
156
156
  end
157
157
 
158
- it "should set the Facts cache class to :active_record" do
159
- Puppet::Node::Facts.indirection.expects(:cache_class=).with(:active_record)
158
+ it "should set the Facts cache class to :store_configs" do
159
+ Puppet::Node::Facts.indirection.expects(:cache_class=).with(:store_configs)
160
160
  Puppet.settings[:storeconfigs] = true
161
161
  end
162
162
 
163
- it "should set the Node cache class to :active_record" do
164
- Puppet::Node.indirection.expects(:cache_class=).with(:active_record)
163
+ it "should set the Node cache class to :store_configs" do
164
+ Puppet::Node.indirection.expects(:cache_class=).with(:store_configs)
165
165
  Puppet.settings[:storeconfigs] = true
166
166
  end
167
-
168
- it "should fail if rails is not available" do
169
- Puppet.features.stubs(:rails?).returns false
170
- lambda { Puppet.settings[:storeconfigs] = true }.should raise_error
171
- end
172
167
  end
173
168
 
174
169
  describe "when enabling asynchronous storeconfigs" do
@@ -189,13 +184,13 @@ describe "Puppet defaults" do
189
184
  Puppet.settings[:async_storeconfigs] = true
190
185
  end
191
186
 
192
- it "should set the Facts cache class to :active_record" do
193
- Puppet::Node::Facts.indirection.expects(:cache_class=).with(:active_record)
187
+ it "should set the Facts cache class to :store_configs" do
188
+ Puppet::Node::Facts.indirection.expects(:cache_class=).with(:store_configs)
194
189
  Puppet.settings[:storeconfigs] = true
195
190
  end
196
191
 
197
- it "should set the Node cache class to :active_record" do
198
- Puppet::Node.indirection.expects(:cache_class=).with(:active_record)
192
+ it "should set the Node cache class to :store_configs" do
193
+ Puppet::Node.indirection.expects(:cache_class=).with(:store_configs)
199
194
  Puppet.settings[:storeconfigs] = true
200
195
  end
201
196
  end
@@ -277,4 +272,14 @@ describe "Puppet defaults" do
277
272
  subject { Puppet.settings[:reporturl] }
278
273
  it { should == "http://localhost:3000/reports/upload" }
279
274
  end
275
+
276
+ describe "when configuring color" do
277
+ it "should default to ansi", :unless => Puppet.features.microsoft_windows? do
278
+ Puppet.settings[:color].should == 'ansi'
279
+ end
280
+
281
+ it "should default to false", :if => Puppet.features.microsoft_windows? do
282
+ Puppet.settings[:color].should == 'false'
283
+ end
284
+ end
280
285
  end
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-10-18.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/file_serving/content'
@@ -15,6 +11,4 @@ describe Puppet::FileServing::Content, " when finding files" do
15
11
  @test_class = Puppet::FileServing::Content
16
12
  @indirection = Puppet::FileServing::Content.indirection
17
13
  end
18
-
19
- after { Puppet::Util::Cacher.expire }
20
14
  end
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-10-18.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/file_serving/metadata'
@@ -16,6 +12,4 @@ describe Puppet::FileServing::Metadata, " when finding files" do
16
12
  @test_class = Puppet::FileServing::Metadata
17
13
  @indirection = Puppet::FileServing::Metadata.indirection
18
14
  end
19
-
20
- after { Puppet::Util::Cacher.expire }
21
15
  end
@@ -10,7 +10,7 @@ class TerminusHelperIntegrationTester
10
10
  end
11
11
  end
12
12
 
13
- describe Puppet::FileServing::TerminusHelper do
13
+ describe Puppet::FileServing::TerminusHelper, :fails_on_windows => true do
14
14
  it "should be able to recurse on a single file" do
15
15
  @path = Tempfile.new("fileset_integration")
16
16
  request = Puppet::Indirector::Request.new(:metadata, :find, @path.path, :recurse => true)
@@ -1,18 +1,16 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-10-19.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/indirector/file_content/file'
9
5
 
10
- describe Puppet::Indirector::DirectFileServer, " when interacting with the filesystem and the model" do
6
+ describe Puppet::Indirector::DirectFileServer, " when interacting with the filesystem and the model", :fails_on_windows => true do
7
+ include PuppetSpec::Files
8
+
11
9
  before do
12
10
  # We just test a subclass, since it's close enough.
13
11
  @terminus = Puppet::Indirector::FileContent::File.new
14
12
 
15
- @filepath = "/path/to/my/file"
13
+ @filepath = make_absolute("/path/to/my/file")
16
14
  end
17
15
 
18
16
  it "should return an instance of the model" do
@@ -32,7 +30,7 @@ describe Puppet::Indirector::DirectFileServer, " when interacting with the files
32
30
  end
33
31
  end
34
32
 
35
- describe Puppet::Indirector::DirectFileServer, " when interacting with FileServing::Fileset and the model" do
33
+ describe Puppet::Indirector::DirectFileServer, " when interacting with FileServing::Fileset and the model", :fails_on_windows => true do
36
34
  before do
37
35
  @terminus = Puppet::Indirector::FileContent::File.new
38
36
 
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-10-18.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/indirector/file_content/file_server'
@@ -10,13 +6,14 @@ require 'shared_behaviours/file_server_terminus'
10
6
 
11
7
  require 'puppet_spec/files'
12
8
 
13
- describe Puppet::Indirector::FileContent::FileServer, " when finding files" do
9
+ describe Puppet::Indirector::FileContent::FileServer, " when finding files", :fails_on_windows => true do
14
10
  it_should_behave_like "Puppet::Indirector::FileServerTerminus"
15
11
  include PuppetSpec::Files
16
12
 
17
13
  before do
18
14
  @terminus = Puppet::Indirector::FileContent::FileServer.new
19
15
  @test_class = Puppet::FileServing::Content
16
+ Puppet::FileServing::Configuration.instance_variable_set(:@configuration, nil)
20
17
  end
21
18
 
22
19
  it "should find plugin file content in the environment specified in the request" do
@@ -62,7 +59,6 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do
62
59
  end
63
60
 
64
61
  it "should find file content in files when node name expansions are used" do
65
- Puppet::Util::Cacher.expire
66
62
  FileTest.stubs(:exists?).returns true
67
63
  FileTest.stubs(:exists?).with(Puppet[:fileserverconfig]).returns(true)
68
64
 
@@ -1,14 +1,10 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-10-18.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/indirector/file_metadata/file_server'
9
5
  require 'shared_behaviours/file_server_terminus'
10
6
 
11
- describe Puppet::Indirector::FileMetadata::FileServer, " when finding files" do
7
+ describe Puppet::Indirector::FileMetadata::FileServer, " when finding files", :fails_on_windows => true do
12
8
  it_should_behave_like "Puppet::Indirector::FileServerTerminus"
13
9
 
14
10
  before do
@@ -4,7 +4,9 @@ require 'puppet/network/server'
4
4
  require 'puppet/ssl/certificate_authority'
5
5
  require 'socket'
6
6
 
7
- describe Puppet::Network::Server do
7
+ describe Puppet::Network::Server, :unless => Puppet.features.microsoft_windows? do
8
+ include PuppetSpec::Files
9
+
8
10
  describe "when using webrick" do
9
11
  before :each do
10
12
  Puppet[:servertype] = 'webrick'
@@ -12,11 +14,10 @@ describe Puppet::Network::Server do
12
14
  @params = { :port => 34343, :handlers => [ :node ], :xmlrpc_handlers => [ :status ] }
13
15
 
14
16
  # Get a safe temporary file
15
- @tmpfile = Tempfile.new("webrick_integration_testing")
16
- @dir = @tmpfile.path + "_dir"
17
+ dir = tmpdir("webrick_integration_testing")
17
18
 
18
- Puppet.settings[:confdir] = @dir
19
- Puppet.settings[:vardir] = @dir
19
+ Puppet.settings[:confdir] = dir
20
+ Puppet.settings[:vardir] = dir
20
21
  Puppet.settings[:group] = Process.gid
21
22
 
22
23
  Puppet::SSL::Host.ca_location = :local
@@ -26,13 +27,9 @@ describe Puppet::Network::Server do
26
27
  end
27
28
 
28
29
  after do
29
- @tmpfile.delete
30
30
  Puppet.settings.clear
31
31
 
32
- system("rm -rf #{@dir}")
33
-
34
32
  Puppet::SSL::Host.ca_location = :none
35
- Puppet::Util::Cacher.expire
36
33
  end
37
34
 
38
35
  describe "before listening" do
@@ -1,14 +1,8 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2008-4-8.
4
- # Copyright (c) 2008. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  describe Puppet::Node::Facts do
9
5
  describe "when using the indirector" do
10
- after(:each) { Puppet::Util::Cacher.expire }
11
-
12
6
  it "should expire any cached node instances when it is saved" do
13
7
  Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml
14
8
 
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-9-23.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/node'
@@ -10,6 +6,9 @@ require 'puppet/node'
10
6
  describe Puppet::Node do
11
7
  describe "when delegating indirection calls" do
12
8
  before do
9
+ Puppet::Node.indirection.reset_terminus_class
10
+ Puppet::Node.indirection.cache_class = nil
11
+
13
12
  @name = "me"
14
13
  @node = Puppet::Node.new(@name)
15
14
  end
@@ -13,11 +13,12 @@ describe Puppet::Parser::Compiler do
13
13
  Puppet.settings.clear
14
14
  end
15
15
 
16
- it "should be able to determine the configuration version from a local version control repository" do
16
+ it "should be able to determine the configuration version from a local version control repository", :fails_on_windows => true do
17
17
  # This should always work, because we should always be
18
18
  # in the puppet repo when we run this.
19
19
  version = %x{git rev-parse HEAD}.chomp
20
20
 
21
+ # REMIND: this fails on Windows due to #8410, re-enable the test when it is fixed
21
22
  Puppet.settings[:config_version] = 'git rev-parse HEAD'
22
23
 
23
24
  @parser = Puppet::Parser::Parser.new "development"
@@ -140,11 +140,9 @@ describe Puppet::Parser::Parser do
140
140
 
141
141
  describe "collections" do
142
142
  it "should find resources according to an expression" do
143
- %q{
144
- File <| mode == 0700 + 0050 + 0050 |>
145
- }.should parse_with { |coll|
143
+ %q{ File <| mode == 0700 + 0050 + 0050 |> }.should parse_with { |coll|
146
144
  coll.is_a?(Puppet::Parser::AST::Collection) &&
147
- coll.query.evaluate(stub 'scope').first == "param_values.value = '528' and param_names.name = 'mode'"
145
+ coll.query.evaluate(stub 'scope').first == ["mode", "==", 0700 + 0050 + 0050]
148
146
  }
149
147
  end
150
148
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  require 'puppet/file_bucket/dipper'
4
4
 
5
- describe "mount provider (integration)" do
5
+ describe "mount provider (integration)", :unless => Puppet.features.microsoft_windows? do
6
6
  include PuppetSpec::Files
7
7
 
8
8
  def create_fake_fstab(initially_contains_entry)