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
@@ -4,14 +4,16 @@ require 'spec_helper'
4
4
  require 'puppet/resource/status'
5
5
 
6
6
  describe Puppet::Resource::Status do
7
+ include PuppetSpec::Files
8
+
7
9
  before do
8
- @resource = Puppet::Type.type(:file).new :path => "/my/file"
10
+ @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file")
9
11
  @status = Puppet::Resource::Status.new(@resource)
10
12
  end
11
13
 
12
14
  it "should compute type and title correctly" do
13
15
  @status.resource_type.should == "File"
14
- @status.title.should == "/my/file"
16
+ @status.title.should == make_absolute("/my/file")
15
17
  end
16
18
 
17
19
  [:node, :file, :line, :current_values, :status, :evaluation_time].each do |attr|
@@ -3,9 +3,10 @@ require 'spec_helper'
3
3
  require 'puppet/resource'
4
4
 
5
5
  describe Puppet::Resource do
6
+ include PuppetSpec::Files
6
7
 
7
8
  before do
8
- @basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath"
9
+ @basepath = make_absolute("/somepath")
9
10
  end
10
11
 
11
12
  [:catalog, :file, :line].each do |attr|
@@ -106,9 +107,8 @@ describe Puppet::Resource do
106
107
  end
107
108
 
108
109
  it "should fail if the title is a hash and the type is not a valid resource reference string" do
109
- lambda { Puppet::Resource.new({:type => "foo", :title => "bar"}) }.should raise_error(ArgumentError,
110
- 'Puppet::Resource.new does not take a hash as the first argument. Did you mean ("foo", "bar") ?'
111
- )
110
+ expect { Puppet::Resource.new({:type => "foo", :title => "bar"}) }.
111
+ to raise_error ArgumentError, /Puppet::Resource.new does not take a hash/
112
112
  end
113
113
 
114
114
  it "should be able to produce a backward-compatible reference array" do
@@ -778,7 +778,7 @@ type: File
778
778
  end
779
779
 
780
780
  it "should have a default terminus" do
781
- Puppet::Resource.indirection.terminus_class.should == :ral
781
+ Puppet::Resource.indirection.terminus_class.should be
782
782
  end
783
783
 
784
784
  it "should have a name" do
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-11-1.
4
- # Copyright (c) 2006. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
  require 'puppet/simple_graph'
8
4
 
@@ -5,7 +5,7 @@ require 'puppet/ssl/certificate_authority'
5
5
 
6
6
  describe Puppet::SSL::CertificateAuthority do
7
7
  after do
8
- Puppet::Util::Cacher.expire
8
+ Puppet::SSL::CertificateAuthority.instance_variable_set(:@singleton_instance, nil)
9
9
  Puppet.settings.clearused
10
10
  end
11
11
 
@@ -25,7 +25,7 @@ describe Puppet::SSL::CertificateAuthority do
25
25
  describe "when finding an existing instance" do
26
26
  describe "and the host is a CA host and the run_mode is master" do
27
27
  before do
28
- Puppet.settings.stubs(:value).with(:ca).returns true
28
+ Puppet[:ca] = true
29
29
  Puppet.run_mode.stubs(:master?).returns true
30
30
 
31
31
  @ca = mock('ca')
@@ -5,15 +5,24 @@ require 'puppet/ssl/host'
5
5
  require 'puppet/sslcertificates'
6
6
  require 'puppet/sslcertificates/ca'
7
7
 
8
- describe Puppet::SSL::Host do
8
+ # REMIND: Fails on windows because there is no user provider yet
9
+ describe Puppet::SSL::Host, :fails_on_windows => true do
10
+ include PuppetSpec::Files
11
+
9
12
  before do
10
13
  Puppet::SSL::Host.indirection.terminus_class = :file
14
+
15
+ # Get a safe temporary file
16
+ dir = tmpdir("ssl_host_testing")
17
+ Puppet.settings[:confdir] = dir
18
+ Puppet.settings[:vardir] = dir
19
+
11
20
  @host = Puppet::SSL::Host.new("myname")
12
21
  end
13
22
 
14
23
  after do
15
24
  # Cleaned out any cached localhost instance.
16
- Puppet::Util::Cacher.expire
25
+ Puppet::SSL::Host.instance_variable_set(:@localhost, nil)
17
26
  Puppet::SSL::Host.ca_location = :none
18
27
  end
19
28
 
@@ -82,16 +91,6 @@ describe Puppet::SSL::Host do
82
91
  Puppet::SSL::Host.localhost.should == Puppet::SSL::Host.localhost
83
92
  end
84
93
 
85
- it "should be able to expire the cached instance" do
86
- one = stub 'host1', :certificate => "eh", :key => 'foo'
87
- two = stub 'host2', :certificate => "eh", :key => 'foo'
88
- Puppet::SSL::Host.expects(:new).times(2).returns(one).then.returns(two)
89
-
90
- Puppet::SSL::Host.localhost.should equal(one)
91
- Puppet::Util::Cacher.expire
92
- Puppet::SSL::Host.localhost.should equal(two)
93
- end
94
-
95
94
  it "should be able to verify its certificate matches its key" do
96
95
  Puppet::SSL::Host.new("foo").should respond_to(:certificate_matches_key?)
97
96
  end
@@ -711,7 +710,7 @@ describe Puppet::SSL::Host do
711
710
  end
712
711
  end
713
712
 
714
- describe "when handling PSON" do
713
+ describe "when handling PSON", :unless => Puppet.features.microsoft_windows? do
715
714
  include PuppetSpec::Files
716
715
 
717
716
  before do
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  require 'puppet/ssl/inventory'
5
5
 
6
- describe Puppet::SSL::Inventory do
6
+ describe Puppet::SSL::Inventory, :unless => Puppet.features.microsoft_windows? do
7
7
  before do
8
8
  @class = Puppet::SSL::Inventory
9
9
  end
@@ -118,7 +118,7 @@ describe Puppet::SSL::Inventory do
118
118
  end
119
119
  end
120
120
 
121
- describe "and formatting a certificate" do
121
+ describe "and formatting a certificate", :fails_on_windows => true do
122
122
  before do
123
123
  @cert = stub 'cert', :not_before => Time.now, :not_after => Time.now, :subject => "mycert", :serial => 15
124
124
  end
@@ -5,27 +5,23 @@ require 'puppet'
5
5
  require 'puppet/sslcertificates'
6
6
  require 'puppet/sslcertificates/ca'
7
7
 
8
- describe Puppet::SSLCertificates::CA do
8
+ describe Puppet::SSLCertificates::CA, :unless => Puppet.features.microsoft_windows? do
9
+ include PuppetSpec::Files
10
+
9
11
  before :all do
10
12
  @hosts = %w{host.domain.com Other.Testing.Com}
11
13
  end
12
14
 
13
15
  before :each do
14
16
  Puppet::Util::SUIDManager.stubs(:asuser).yields
15
- file = Tempfile.new("ca_testing")
16
- @dir = file.path
17
- file.delete
17
+ dir = tmpdir("ca_testing")
18
18
 
19
- Puppet.settings[:confdir] = @dir
20
- Puppet.settings[:vardir] = @dir
19
+ Puppet.settings[:confdir] = dir
20
+ Puppet.settings[:vardir] = dir
21
21
 
22
22
  @ca = Puppet::SSLCertificates::CA.new
23
23
  end
24
24
 
25
- after :each do
26
- system("rm -rf #{@dir}")
27
- end
28
-
29
25
  describe 'when cleaning' do
30
26
  it 'should remove associated files' do
31
27
  dirs = [:csrdir, :signeddir, :publickeydir, :privatekeydir, :certdir]
@@ -4,6 +4,8 @@ require 'spec_helper'
4
4
  require 'puppet/transaction/event_manager'
5
5
 
6
6
  describe Puppet::Transaction::EventManager do
7
+ include PuppetSpec::Files
8
+
7
9
  describe "at initialization" do
8
10
  it "should require a transaction" do
9
11
  Puppet::Transaction::EventManager.new("trans").transaction.should == "trans"
@@ -23,7 +25,7 @@ describe Puppet::Transaction::EventManager do
23
25
  before do
24
26
  @manager = Puppet::Transaction::EventManager.new(@transaction)
25
27
 
26
- @resource = Puppet::Type.type(:file).new :path => "/my/file"
28
+ @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file")
27
29
 
28
30
  @graph = stub 'graph', :matching_edges => [], :resource => @resource
29
31
  @manager.stubs(:relationship_graph).returns @graph
@@ -139,7 +141,7 @@ describe Puppet::Transaction::EventManager do
139
141
  @manager = Puppet::Transaction::EventManager.new(@transaction)
140
142
  @manager.stubs(:queue_events)
141
143
 
142
- @resource = Puppet::Type.type(:file).new :path => "/my/file"
144
+ @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file")
143
145
  @event = Puppet::Transaction::Event.new(:name => :event, :resource => @resource)
144
146
  end
145
147
 
@@ -4,6 +4,8 @@ require 'spec_helper'
4
4
  require 'puppet/transaction/event'
5
5
 
6
6
  describe Puppet::Transaction::Event do
7
+ include PuppetSpec::Files
8
+
7
9
  [:previous_value, :desired_value, :property, :resource, :name, :message, :file, :line, :tags, :audited].each do |attr|
8
10
  it "should support #{attr}", :'fails_on_ruby_1.9.2' => true do
9
11
  event = Puppet::Transaction::Event.new
@@ -113,7 +115,7 @@ describe Puppet::Transaction::Event do
113
115
 
114
116
  describe "When converting to YAML" do
115
117
  it "should include only documented attributes" do
116
- resource = Puppet::Type.type(:file).new(:title => "/tmp/foo")
118
+ resource = Puppet::Type.type(:file).new(:title => make_absolute("/tmp/foo"))
117
119
  event = Puppet::Transaction::Event.new(:source_description => "/my/param", :resource => resource,
118
120
  :file => "/foo.rb", :line => 27, :tags => %w{one two},
119
121
  :desired_value => 7, :historical_value => 'Brazil',
@@ -103,10 +103,6 @@ describe Puppet::Transaction::Report do
103
103
  report.expects(:host).returns "me"
104
104
  report.name.should == "me"
105
105
  end
106
-
107
- after do
108
- Puppet::Util::Cacher.expire
109
- end
110
106
  end
111
107
 
112
108
  describe "when computing exit status" do
@@ -154,7 +150,7 @@ describe Puppet::Transaction::Report do
154
150
 
155
151
  def add_statuses(count, type = :file)
156
152
  count.times do |i|
157
- status = Puppet::Resource::Status.new(Puppet::Type.type(type).new(:title => "/my/path#{i}"))
153
+ status = Puppet::Resource::Status.new(Puppet::Type.type(type).new(:title => make_absolute("/my/path#{i}")))
158
154
  yield status if block_given?
159
155
  @report.add_resource_status status
160
156
  end
@@ -208,7 +204,7 @@ describe Puppet::Transaction::Report do
208
204
  end
209
205
 
210
206
  describe "for times" do
211
- it "should provide the total amount of time for each resource type" do
207
+ it "should provide the total amount of time for each resource type", :fails_on_windows => true do
212
208
  add_statuses(3, :file) do |status|
213
209
  status.evaluation_time = 1
214
210
  end
@@ -7,10 +7,14 @@ describe Puppet::Transaction::ResourceHarness do
7
7
  include PuppetSpec::Files
8
8
 
9
9
  before do
10
+ @mode_750 = Puppet.features.microsoft_windows? ? '644' : '750'
11
+ @mode_755 = Puppet.features.microsoft_windows? ? '644' : '755'
12
+ path = make_absolute("/my/file")
13
+
10
14
  @transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new)
11
- @resource = Puppet::Type.type(:file).new :path => "/my/file"
15
+ @resource = Puppet::Type.type(:file).new :path => path
12
16
  @harness = Puppet::Transaction::ResourceHarness.new(@transaction)
13
- @current_state = Puppet::Resource.new(:file, "/my/file")
17
+ @current_state = Puppet::Resource.new(:file, path)
14
18
  @resource.stubs(:retrieve).returns @current_state
15
19
  @status = Puppet::Resource::Status.new(@resource)
16
20
  Puppet::Resource::Status.stubs(:new).returns @status
@@ -148,8 +152,8 @@ describe Puppet::Transaction::ResourceHarness do
148
152
 
149
153
  describe "when applying changes" do
150
154
  [false, true].each do |noop_mode|; describe (noop_mode ? "in noop mode" : "in normal mode") do
151
- [nil, '750'].each do |machine_state|; describe (machine_state ? "with a file initially present" : "with no file initially present") do
152
- [nil, '750', '755'].each do |yaml_mode|
155
+ [nil, @mode_750].each do |machine_state|; describe (machine_state ? "with a file initially present" : "with no file initially present") do
156
+ [nil, @mode_750, @mode_755].each do |yaml_mode|
153
157
  [nil, :file, :absent].each do |yaml_ensure|; describe "with mode=#{yaml_mode.inspect} and ensure=#{yaml_ensure.inspect} stored in state.yml" do
154
158
  [false, true].each do |auditing_ensure|
155
159
  [false, true].each do |auditing_mode|
@@ -157,7 +161,7 @@ describe Puppet::Transaction::ResourceHarness do
157
161
  auditing.push(:mode) if auditing_mode
158
162
  auditing.push(:ensure) if auditing_ensure
159
163
  [nil, :file, :absent].each do |ensure_property| # what we set "ensure" to in the manifest
160
- [nil, '750', '755'].each do |mode_property| # what we set "mode" to in the manifest
164
+ [nil, @mode_750, @mode_755].each do |mode_property| # what we set "mode" to in the manifest
161
165
  manifest_settings = {}
162
166
  manifest_settings[:audit] = auditing if !auditing.empty?
163
167
  manifest_settings[:ensure] = ensure_property if ensure_property
@@ -11,8 +11,10 @@ def without_warnings
11
11
  end
12
12
 
13
13
  describe Puppet::Transaction do
14
+ include PuppetSpec::Files
15
+
14
16
  before do
15
- @basepath = Puppet.features.posix? ? "/what/ever" : "C:/tmp"
17
+ @basepath = make_absolute("/what/ever")
16
18
  @transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new)
17
19
  end
18
20
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env rspec
2
2
  require 'spec_helper'
3
3
 
4
- describe Puppet::Type.type(:cron) do
4
+ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows? do
5
5
  before do
6
6
  @class = Puppet::Type.type(:cron)
7
7
 
@@ -2,9 +2,9 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Puppet::Type.type(:exec) do
5
+ include PuppetSpec::Files
6
+
5
7
  def exec_tester(command, exitstatus = 0, rest = {})
6
- @user_name = 'some_user_name'
7
- @group_name = 'some_group_name'
8
8
  Puppet.features.stubs(:root?).returns(true)
9
9
 
10
10
  output = rest.delete(:output) || ''
@@ -13,8 +13,6 @@ describe Puppet::Type.type(:exec) do
13
13
  args = {
14
14
  :name => command,
15
15
  :path => @example_path,
16
- :user => @user_name,
17
- :group => @group_name,
18
16
  :logoutput => false,
19
17
  :loglevel => :err,
20
18
  :returns => 0
@@ -24,24 +22,30 @@ describe Puppet::Type.type(:exec) do
24
22
 
25
23
  status = stub "process", :exitstatus => exitstatus
26
24
  Puppet::Util::SUIDManager.expects(:run_and_capture).times(tries).
27
- with([command], @user_name, @group_name).returns([output, status])
25
+ with(command, nil, nil).returns([output, status])
28
26
 
29
27
  return exec
30
28
  end
31
29
 
32
30
  before do
33
- @command = Puppet.features.posix? ? '/bin/true whatever' : '"C:/Program Files/something.exe" whatever'
31
+ @command = make_absolute('/bin/true whatever')
32
+ @executable = make_absolute('/bin/true')
33
+ @bogus_cmd = make_absolute('/bogus/cmd')
34
34
  end
35
35
 
36
36
  describe "when not stubbing the provider" do
37
37
  before do
38
- @executable = Puppet.features.posix? ? '/bin/true' : 'C:/Program Files/something.exe'
39
- File.stubs(:exists?).returns false
40
- File.stubs(:exists?).with(@executable).returns true
41
- File.stubs(:exists?).with('/bin/false').returns true
42
- @example_path = Puppet.features.posix? ? %w{/usr/bin /bin} : [ "C:/Program Files/something/bin", "C:/Ruby/bin" ]
43
- File.stubs(:exists?).with(File.join(@example_path[0],"true")).returns true
44
- File.stubs(:exists?).with(File.join(@example_path[0],"false")).returns true
38
+ path = tmpdir('path')
39
+ true_cmd = File.join(path, 'true')
40
+ false_cmd = File.join(path, 'false')
41
+
42
+ FileUtils.touch(true_cmd)
43
+ FileUtils.touch(false_cmd)
44
+
45
+ File.chmod(0755, true_cmd)
46
+ File.chmod(0755, false_cmd)
47
+
48
+ @example_path = [path]
45
49
  end
46
50
 
47
51
  it "should return :executed_command as its event" do
@@ -140,10 +144,11 @@ describe Puppet::Type.type(:exec) do
140
144
  end
141
145
 
142
146
  it "should be able to autorequire files mentioned in the command" do
147
+ foo = make_absolute('/bin/foo')
143
148
  catalog = Puppet::Resource::Catalog.new
144
- tmp = Puppet::Type.type(:file).new(:name => "/bin/foo")
149
+ tmp = Puppet::Type.type(:file).new(:name => foo)
145
150
  catalog.add_resource tmp
146
- execer = Puppet::Type.type(:exec).new(:name => "/bin/foo")
151
+ execer = Puppet::Type.type(:exec).new(:name => foo)
147
152
  catalog.add_resource execer
148
153
 
149
154
  catalog.relationship_graph.dependencies(execer).should == [tmp]
@@ -151,21 +156,37 @@ describe Puppet::Type.type(:exec) do
151
156
 
152
157
  describe "when handling the path parameter" do
153
158
  expect = %w{one two three four}
154
- { "an array" => expect,
155
- "a colon separated list" => "one:two:three:four",
156
- "a semi-colon separated list" => "one;two;three;four",
157
- "both array and colon lists" => ["one", "two:three", "four"],
158
- "both array and semi-colon lists" => ["one", "two;three", "four"],
159
- "colon and semi-colon lists" => ["one:two", "three;four"]
159
+ { "an array" => expect,
160
+ "a path-separator delimited list" => expect.join(File::PATH_SEPARATOR),
161
+ "both array and path-separator delimited lists" => ["one", "two#{File::PATH_SEPARATOR}three", "four"],
160
162
  }.each do |test, input|
161
163
  it "should accept #{test}" do
162
164
  type = Puppet::Type.type(:exec).new(:name => @command, :path => input)
163
165
  type[:path].should == expect
164
166
  end
165
167
  end
168
+
169
+ describe "on platforms where path separator is not :" do
170
+ before :each do
171
+ @old_verbosity = $VERBOSE
172
+ $VERBOSE = nil
173
+ @old_separator = File::PATH_SEPARATOR
174
+ File::PATH_SEPARATOR = 'q'
175
+ end
176
+
177
+ after :each do
178
+ File::PATH_SEPARATOR = @old_separator
179
+ $VERBOSE = @old_verbosity
180
+ end
181
+
182
+ it "should use the path separator of the current platform" do
183
+ type = Puppet::Type.type(:exec).new(:name => @command, :path => "fooqbarqbaz")
184
+ type[:path].should == %w[foo bar baz]
185
+ end
186
+ end
166
187
  end
167
188
 
168
- describe "when setting user" do
189
+ describe "when setting user", :fails_on_windows => true do
169
190
  it "should fail if we are not root" do
170
191
  Puppet.features.stubs(:root?).returns(false)
171
192
  expect { Puppet::Type.type(:exec).new(:name => @command, :user => 'input') }.
@@ -184,7 +205,7 @@ describe Puppet::Type.type(:exec) do
184
205
  describe "when setting group" do
185
206
  shared_examples_for "exec[:group]" do
186
207
  ['one', 2, 'wheel', 4294967295, 4294967296].each do |value|
187
- it "should accept '#{value}' without error or judgement" do
208
+ it "should accept '#{value}' without error or judgement", :fails_on_windows => true do
188
209
  type = Puppet::Type.type(:exec).new(:name => @command, :group => value)
189
210
  type[:group].should == value
190
211
  end
@@ -205,7 +226,8 @@ describe Puppet::Type.type(:exec) do
205
226
  describe "when setting cwd" do
206
227
  it_should_behave_like "all path parameters", :cwd, :array => false do
207
228
  def instance(path)
208
- Puppet::Type.type(:exec).new(:name => '/bin/true', :cwd => path)
229
+ # Specify shell provider so we don't have to care about command validation
230
+ Puppet::Type.type(:exec).new(:name => @executable, :cwd => path, :provider => :shell)
209
231
  end
210
232
  end
211
233
  end
@@ -221,7 +243,7 @@ describe Puppet::Type.type(:exec) do
221
243
  if @param == :name then
222
244
  instance = Puppet::Type.type(:exec).new()
223
245
  else
224
- instance = Puppet::Type.type(:exec).new(:name => "/bin/true")
246
+ instance = Puppet::Type.type(:exec).new(:name => @executable)
225
247
  end
226
248
  if valid then
227
249
  instance.provider.expects(:validatecmd).returns(true)
@@ -246,7 +268,7 @@ describe Puppet::Type.type(:exec) do
246
268
  shared_examples_for "all exec command parameters that take arrays" do |param|
247
269
  describe "when given an array of inputs" do
248
270
  before :each do
249
- @test = Puppet::Type.type(:exec).new(:name => "/bin/true")
271
+ @test = Puppet::Type.type(:exec).new(:name => @executable)
250
272
  end
251
273
 
252
274
  it "should accept the array when all commands return valid" do
@@ -281,7 +303,7 @@ describe Puppet::Type.type(:exec) do
281
303
 
282
304
  describe "for simple parameters" do
283
305
  before :each do
284
- @exec = Puppet::Type.type(:exec).new(:name => '/bin/true')
306
+ @exec = Puppet::Type.type(:exec).new(:name => @executable)
285
307
  end
286
308
 
287
309
  describe "when setting environment" do
@@ -330,21 +352,30 @@ describe Puppet::Type.type(:exec) do
330
352
  end
331
353
  end
332
354
 
333
- it "should fail if timeout is exceeded" do
334
- File.stubs(:exists?).with('/bin/sleep').returns(true)
335
- File.stubs(:exists?).with('sleep').returns(false)
355
+ it "should fail if timeout is exceeded", :fails_on_windows => true do
356
+ Puppet::Util.stubs(:execute).with do |cmd,args|
357
+ sleep 1
358
+ true
359
+ end
360
+ FileTest.stubs(:file?).returns(false)
361
+ FileTest.stubs(:file?).with('/bin/sleep').returns(true)
362
+ FileTest.stubs(:executable?).returns(false)
363
+ FileTest.stubs(:executable?).with('/bin/sleep').returns(true)
336
364
  sleep_exec = Puppet::Type.type(:exec).new(:name => 'sleep 1', :path => ['/bin'], :timeout => '0.2')
365
+
337
366
  lambda { sleep_exec.refresh }.should raise_error Puppet::Error, "Command exceeded timeout"
338
367
  end
339
368
 
340
369
  it "should convert timeout to a float" do
341
- resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "12"
370
+ command = make_absolute('/bin/false')
371
+ resource = Puppet::Type.type(:exec).new :command => command, :timeout => "12"
342
372
  resource[:timeout].should be_a(Float)
343
373
  resource[:timeout].should == 12.0
344
374
  end
345
375
 
346
376
  it "should munge negative timeouts to 0.0" do
347
- resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "-12.0"
377
+ command = make_absolute('/bin/false')
378
+ resource = Puppet::Type.type(:exec).new :command => command, :timeout => "-12.0"
348
379
  resource.parameter(:timeout).value.should be_a(Float)
349
380
  resource.parameter(:timeout).value.should == 0.0
350
381
  end
@@ -442,7 +473,8 @@ describe Puppet::Type.type(:exec) do
442
473
  describe "when setting creates" do
443
474
  it_should_behave_like "all path parameters", :creates, :array => true do
444
475
  def instance(path)
445
- Puppet::Type.type(:exec).new(:name => '/bin/true', :creates => path)
476
+ # Specify shell provider so we don't have to care about command validation
477
+ Puppet::Type.type(:exec).new(:name => @executable, :creates => path, :provider => :shell)
446
478
  end
447
479
  end
448
480
  end
@@ -460,7 +492,7 @@ describe Puppet::Type.type(:exec) do
460
492
 
461
493
  describe "#check" do
462
494
  before :each do
463
- @test = Puppet::Type.type(:exec).new(:name => "/bin/true")
495
+ @test = Puppet::Type.type(:exec).new(:name => @executable)
464
496
  end
465
497
 
466
498
  describe ":refreshonly" do
@@ -473,10 +505,10 @@ describe Puppet::Type.type(:exec) do
473
505
  end
474
506
 
475
507
  describe ":creates" do
476
- before :all do
477
- @exist = "/"
478
- @unexist = "/this/path/should/never/exist"
479
- while FileTest.exist?(@unexist) do @unexist += "/foo" end
508
+ before :each do
509
+ @exist = tmpfile('exist')
510
+ FileUtils.touch(@exist)
511
+ @unexist = tmpfile('unexist')
480
512
  end
481
513
 
482
514
  context "with a single item" do
@@ -525,8 +557,8 @@ describe Puppet::Type.type(:exec) do
525
557
  }.each do |param, sense|
526
558
  describe ":#{param}" do
527
559
  before :each do
528
- @pass = "/magic/pass"
529
- @fail = "/magic/fail"
560
+ @pass = make_absolute("/magic/pass")
561
+ @fail = make_absolute("/magic/fail")
530
562
 
531
563
  @pass_status = stub('status', :exitstatus => sense[:pass] ? 0 : 1)
532
564
  @fail_status = stub('status', :exitstatus => sense[:fail] ? 0 : 1)
@@ -584,9 +616,9 @@ describe Puppet::Type.type(:exec) do
584
616
  end
585
617
  end
586
618
 
587
- describe "#retrieve" do
619
+ describe "#retrieve", :fails_on_windows => true do
588
620
  before :each do
589
- @exec_resource = Puppet::Type.type(:exec).new(:name => "/bogus/cmd")
621
+ @exec_resource = Puppet::Type.type(:exec).new(:name => @bogus_cmd)
590
622
  end
591
623
 
592
624
  it "should return :notrun when check_all_attributes returns true" do
@@ -608,7 +640,7 @@ describe Puppet::Type.type(:exec) do
608
640
 
609
641
  describe "#output" do
610
642
  before :each do
611
- @exec_resource = Puppet::Type.type(:exec).new(:name => "/bogus/cmd")
643
+ @exec_resource = Puppet::Type.type(:exec).new(:name => @bogus_cmd)
612
644
  end
613
645
 
614
646
  it "should return the provider's run output" do
@@ -625,14 +657,15 @@ describe Puppet::Type.type(:exec) do
625
657
 
626
658
  describe "#refresh" do
627
659
  before :each do
628
- @exec_resource = Puppet::Type.type(:exec).new(:name => "/bogus/cmd")
660
+ @exec_resource = Puppet::Type.type(:exec).new(:name => @bogus_cmd)
629
661
  end
630
662
 
631
663
  it "should call provider run with the refresh parameter if it is set" do
664
+ myother_bogus_cmd = make_absolute('/myother/bogus/cmd')
632
665
  provider = stub 'provider'
633
666
  @exec_resource.stubs(:provider).returns(provider)
634
- @exec_resource.stubs(:[]).with(:refresh).returns('/myother/bogus/cmd')
635
- provider.expects(:run).with('/myother/bogus/cmd')
667
+ @exec_resource.stubs(:[]).with(:refresh).returns(myother_bogus_cmd)
668
+ provider.expects(:run).with(myother_bogus_cmd)
636
669
 
637
670
  @exec_resource.refresh
638
671
  end
@@ -641,7 +674,7 @@ describe Puppet::Type.type(:exec) do
641
674
  provider = stub 'provider'
642
675
  status = stubs "process_status"
643
676
  status.stubs(:exitstatus).returns("0")
644
- provider.expects(:run).with('/bogus/cmd').returns(["silly output", status])
677
+ provider.expects(:run).with(@bogus_cmd).returns(["silly output", status])
645
678
  @exec_resource.stubs(:provider).returns(provider)
646
679
 
647
680
  @exec_resource.refresh
@@ -4,7 +4,8 @@ require 'spec_helper'
4
4
  checksum = Puppet::Type.type(:file).attrclass(:checksum)
5
5
  describe checksum do
6
6
  before do
7
- @resource = Puppet::Type.type(:file).new :path => "/foo/bar"
7
+ @path = Puppet.features.microsoft_windows? ? "c:/foo/bar" : "/foo/bar"
8
+ @resource = Puppet::Type.type(:file).new :path => @path
8
9
  @checksum = @resource.parameter(:checksum)
9
10
  end
10
11
 
@@ -35,25 +36,25 @@ describe checksum do
35
36
 
36
37
  it "should use its current value when asked to sum a file's content" do
37
38
  @checksum.value = :md5lite
38
- @checksum.expects(:md5lite_file).with("/foo/bar").returns "yay"
39
- @checksum.sum_file("/foo/bar")
39
+ @checksum.expects(:md5lite_file).with(@path).returns "yay"
40
+ @checksum.sum_file(@path)
40
41
  end
41
42
 
42
43
  it "should use :md5 to sum a file when no value is set" do
43
- @checksum.expects(:md5_file).with("/foo/bar").returns "yay"
44
- @checksum.sum_file("/foo/bar")
44
+ @checksum.expects(:md5_file).with(@path).returns "yay"
45
+ @checksum.sum_file(@path)
45
46
  end
46
47
 
47
48
  it "should convert all sums to strings when summing files" do
48
49
  @checksum.value = :mtime
49
- @checksum.expects(:mtime_file).with("/foo/bar").returns Time.now
50
- lambda { @checksum.sum_file("/foo/bar") }.should_not raise_error
50
+ @checksum.expects(:mtime_file).with(@path).returns Time.now
51
+ lambda { @checksum.sum_file(@path) }.should_not raise_error
51
52
  end
52
53
 
53
54
  it "should return the summed contents of a file with a checksum label" do
54
55
  @resource[:checksum] = :md5
55
56
  @checksum.expects(:md5_file).returns "mysum"
56
- @checksum.sum_file("/foo/bar").should == "{md5}mysum"
57
+ @checksum.sum_file(@path).should == "{md5}mysum"
57
58
  end
58
59
 
59
60
  it "should return the summed contents of a stream with a checksum label" do