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
@@ -1,18 +1,28 @@
1
1
  #!/usr/bin/env rspec
2
2
  require 'spec_helper'
3
3
 
4
- describe "Package Provider", :'fails_on_ruby_1.9.2' => true do
4
+ describe "Package provider", :'fails_on_ruby_1.9.2' => true do
5
+ include PuppetSpec::Files
6
+
5
7
  Puppet::Type.type(:package).providers.each do |name|
6
8
  provider = Puppet::Type.type(:package).provider(name)
7
9
 
8
10
  describe name, :if => provider.suitable? do
9
11
  it "should fail when asked to install an invalid package" do
10
12
  pending("This test hangs forever with recent versions of RubyGems") if provider.name == :gem
11
- pkg = Puppet::Type.newpackage :name => "nosuch#{provider.name}", :provider => provider.name
13
+
14
+ options = {:name => "nosuch#{provider.name}", :provider => provider.name}
15
+ # The MSI provider requires that source be specified as it is
16
+ # what actually determines if the package exists.
17
+ if provider.name == :msi
18
+ options[:source] = tmpfile("msi_package")
19
+ end
20
+
21
+ pkg = Puppet::Type.newpackage(options)
12
22
  lambda { pkg.provider.install }.should raise_error
13
23
  end
14
24
 
15
- it "should be able to get a list of existing packages" do
25
+ it "should be able to get a list of existing packages", :fails_on_windows => true do
16
26
  provider.instances.each do |package|
17
27
  package.should be_instance_of(provider)
18
28
  package.properties[:provider].should == provider.name
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
  require 'puppet/file_bucket/dipper'
5
5
 
6
- describe "ssh_authorized_key provider (integration)" do
6
+ describe "ssh_authorized_key provider (integration)", :unless => Puppet.features.microsoft_windows? do
7
7
  include PuppetSpec::Files
8
8
 
9
9
  before :each do
@@ -151,10 +151,10 @@ describe "ssh_authorized_key provider (integration)" do
151
151
  end
152
152
 
153
153
  it "should modify options if options are out of sync" do
154
- @example[:options]=[ 'from="correct.domain.com"', 'no-port-forwarding', 'no-pty' ]
155
- create_fake_key(:root, @sample_lines + [ "from=\"incorrect.domain.com\",no-port-forwarding,no-pty ssh-rsa #{@sample_rsa_keys[0]} root@hostname"])
154
+ @example[:options]=[ 'from="*.domain1,host1.domain2"', 'no-port-forwarding', 'no-pty' ]
155
+ create_fake_key(:root, @sample_lines + [ "from=\"*.false,*.false2\",no-port-forwarding,no-pty ssh-rsa #{@sample_rsa_keys[0]} root@hostname"])
156
156
  run_in_catalog(@example)
157
- check_fake_key(:root, @sample_lines + [ "from=\"correct.domain.com\",no-port-forwarding,no-pty ssh-rsa #{@sample_rsa_keys[0]} root@hostname"] )
157
+ check_fake_key(:root, @sample_lines + [ "from=\"*.domain1,host1.domain2\",no-port-forwarding,no-pty ssh-rsa #{@sample_rsa_keys[0]} root@hostname"] )
158
158
  end
159
159
 
160
160
  end
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-10-12.
4
- # Copyright (c) 2007. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/reports'
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2007-4-8.
4
- # Copyright (c) 2008. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  describe Puppet::Resource::Catalog do
@@ -13,7 +9,6 @@ describe Puppet::Resource::Catalog do
13
9
  end
14
10
 
15
11
  describe "when using the indirector" do
16
- after { Puppet::Util::Cacher.expire }
17
12
  before do
18
13
  # This is so the tests work w/out networking.
19
14
  Facter.stubs(:to_hash).returns({"hostname" => "foo.domain.com"})
@@ -1,22 +1,17 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2008-4-17.
4
- # Copyright (c) 2008. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/ssl/certificate_authority'
9
- require 'tempfile'
10
5
 
11
- describe Puppet::SSL::CertificateAuthority do
6
+ describe Puppet::SSL::CertificateAuthority, :unless => Puppet.features.microsoft_windows? do
7
+ include PuppetSpec::Files
8
+
12
9
  before do
13
10
  # Get a safe temporary file
14
- file = Tempfile.new("ca_integration_testing")
15
- @dir = file.path
16
- file.delete
11
+ dir = tmpdir("ca_integration_testing")
17
12
 
18
- Puppet.settings[:confdir] = @dir
19
- Puppet.settings[:vardir] = @dir
13
+ Puppet.settings[:confdir] = dir
14
+ Puppet.settings[:vardir] = dir
20
15
  Puppet.settings[:group] = Process.gid
21
16
 
22
17
  Puppet::SSL::Host.ca_location = :local
@@ -26,11 +21,8 @@ describe Puppet::SSL::CertificateAuthority do
26
21
  after {
27
22
  Puppet::SSL::Host.ca_location = :none
28
23
 
29
- system("rm -rf #{@dir}")
30
24
  Puppet.settings.clear
31
25
 
32
- Puppet::Util::Cacher.expire
33
-
34
26
  Puppet::SSL::CertificateAuthority.instance_variable_set("@instance", nil)
35
27
  }
36
28
 
@@ -1,26 +1,20 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2008-4-17.
4
- # Copyright (c) 2008. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/ssl/certificate_request'
9
- require 'tempfile'
10
5
 
11
- describe Puppet::SSL::CertificateRequest do
6
+ # REMIND: Fails on windows because there is no user provider yet
7
+ describe Puppet::SSL::CertificateRequest, :fails_on_windows => true do
8
+ include PuppetSpec::Files
9
+
12
10
  before do
13
11
  # Get a safe temporary file
14
- file = Tempfile.new("csr_integration_testing")
15
- @dir = file.path
16
- file.delete
17
-
18
- Dir.mkdir(@dir)
12
+ dir = tmpdir("csr_integration_testing")
19
13
 
20
14
  Puppet.settings.clear
21
15
 
22
- Puppet.settings[:confdir] = @dir
23
- Puppet.settings[:vardir] = @dir
16
+ Puppet.settings[:confdir] = dir
17
+ Puppet.settings[:vardir] = dir
24
18
  Puppet.settings[:group] = Process.gid
25
19
 
26
20
  Puppet::SSL::Host.ca_location = :none
@@ -28,14 +22,13 @@ describe Puppet::SSL::CertificateRequest do
28
22
  @csr = Puppet::SSL::CertificateRequest.new("luke.madstop.com")
29
23
 
30
24
  @key = OpenSSL::PKey::RSA.new(512)
25
+
26
+ # This is necessary so the terminus instances don't lie around.
27
+ Puppet::SSL::CertificateRequest.indirection.termini.clear
31
28
  end
32
29
 
33
30
  after do
34
- system("rm -rf #{@dir}")
35
31
  Puppet.settings.clear
36
-
37
- # This is necessary so the terminus instances don't lie around.
38
- Puppet::Util::Cacher.expire
39
32
  end
40
33
 
41
34
  it "should be able to generate CSRs" do
@@ -1,22 +1,18 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2008-5-5.
4
- # Copyright (c) 2008. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/ssl/certificate_revocation_list'
9
- require 'tempfile'
10
5
 
11
- describe Puppet::SSL::CertificateRevocationList do
6
+ # REMIND: Fails on windows because there is no user provider yet
7
+ describe Puppet::SSL::CertificateRevocationList, :fails_on_windows => true do
8
+ include PuppetSpec::Files
9
+
12
10
  before do
13
11
  # Get a safe temporary file
14
- file = Tempfile.new("ca_integration_testing")
15
- @dir = file.path
16
- file.delete
12
+ dir = tmpdir("ca_integration_testing")
17
13
 
18
- Puppet.settings[:confdir] = @dir
19
- Puppet.settings[:vardir] = @dir
14
+ Puppet.settings[:confdir] = dir
15
+ Puppet.settings[:vardir] = dir
20
16
  Puppet.settings[:group] = Process.gid
21
17
 
22
18
  Puppet::SSL::Host.ca_location = :local
@@ -25,11 +21,10 @@ describe Puppet::SSL::CertificateRevocationList do
25
21
  after {
26
22
  Puppet::SSL::Host.ca_location = :none
27
23
 
28
- system("rm -rf #{@dir}")
29
24
  Puppet.settings.clear
30
25
 
31
26
  # This is necessary so the terminus instances don't lie around.
32
- Puppet::Util::Cacher.expire
27
+ Puppet::SSL::Host.indirection.termini.clear
33
28
  }
34
29
 
35
30
  it "should be able to read in written out CRLs with no revoked certificates" do
@@ -1,22 +1,18 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2008-4-17.
4
- # Copyright (c) 2008. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  require 'puppet/ssl/host'
9
- require 'tempfile'
10
5
 
11
- describe Puppet::SSL::Host do
6
+ # REMIND: Fails on windows because there is no user provider yet
7
+ describe Puppet::SSL::Host, :fails_on_windows => true do
8
+ include PuppetSpec::Files
9
+
12
10
  before do
13
11
  # Get a safe temporary file
14
- file = Tempfile.new("host_integration_testing")
15
- @dir = file.path
16
- file.delete
12
+ dir = tmpdir("host_integration_testing")
17
13
 
18
- Puppet.settings[:confdir] = @dir
19
- Puppet.settings[:vardir] = @dir
14
+ Puppet.settings[:confdir] = dir
15
+ Puppet.settings[:vardir] = dir
20
16
  Puppet.settings[:group] = Process.gid
21
17
 
22
18
  Puppet::SSL::Host.ca_location = :local
@@ -28,9 +24,7 @@ describe Puppet::SSL::Host do
28
24
  after {
29
25
  Puppet::SSL::Host.ca_location = :none
30
26
 
31
- system("rm -rf #{@dir}")
32
27
  Puppet.settings.clear
33
- Puppet::Util::Cacher.expire
34
28
  }
35
29
 
36
30
  it "should be considered a CA host if its name is equal to 'ca'" do
@@ -81,7 +75,7 @@ describe Puppet::SSL::Host do
81
75
  end
82
76
  end
83
77
 
84
- it "should pass the verification of its own SSL store" do
78
+ it "should pass the verification of its own SSL store", :unless => Puppet.features.microsoft_windows? do
85
79
  @host.generate
86
80
  @ca = Puppet::SSL::CertificateAuthority.new
87
81
  @ca.sign(@host.name)
@@ -1,14 +1,9 @@
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::Transaction::Report do
9
5
  describe "when using the indirector" do
10
6
  after do
11
- Puppet::Util::Cacher.expire
12
7
  Puppet.settings.stubs(:use)
13
8
  end
14
9
 
@@ -1,9 +1,7 @@
1
1
  #!/usr/bin/env rspec
2
2
  require 'spec_helper'
3
3
 
4
- require 'puppet_spec/files'
5
4
  require 'puppet/transaction'
6
- require 'puppet_spec/files'
7
5
 
8
6
  describe Puppet::Transaction do
9
7
  include PuppetSpec::Files
@@ -20,10 +18,10 @@ describe Puppet::Transaction do
20
18
 
21
19
  it "should not apply generated resources if the parent resource fails" do
22
20
  catalog = Puppet::Resource::Catalog.new
23
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
21
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
24
22
  catalog.add_resource resource
25
23
 
26
- child_resource = Puppet::Type.type(:file).new :path => "/foo/bar/baz", :backup => false
24
+ child_resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar/baz"), :backup => false
27
25
 
28
26
  resource.expects(:eval_generate).returns([child_resource])
29
27
 
@@ -39,7 +37,7 @@ describe Puppet::Transaction do
39
37
 
40
38
  it "should not apply virtual resources" do
41
39
  catalog = Puppet::Resource::Catalog.new
42
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
40
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
43
41
  resource.virtual = true
44
42
  catalog.add_resource resource
45
43
 
@@ -63,7 +61,7 @@ describe Puppet::Transaction do
63
61
 
64
62
  it "should not apply virtual exported resources" do
65
63
  catalog = Puppet::Resource::Catalog.new
66
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
64
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
67
65
  resource.exported = true
68
66
  resource.virtual = true
69
67
  catalog.add_resource resource
@@ -91,7 +89,7 @@ describe Puppet::Transaction do
91
89
 
92
90
  it "should not apply host resources on device" do
93
91
  catalog = Puppet::Resource::Catalog.new
94
- resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
92
+ resource = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar"), :backup => false
95
93
  catalog.add_resource resource
96
94
 
97
95
  transaction = Puppet::Transaction.new(catalog)
@@ -133,7 +131,7 @@ describe Puppet::Transaction do
133
131
 
134
132
  # Verify that one component requiring another causes the contained
135
133
  # resources in the requiring component to get refreshed.
136
- it "should propagate events from a contained resource through its container to its dependent container's contained resources" do
134
+ it "should propagate events from a contained resource through its container to its dependent container's contained resources", :fails_on_windows => true do
137
135
  transaction = nil
138
136
  file = Puppet::Type.type(:file).new :path => tmpfile("event_propagation"), :ensure => :present
139
137
  execfile = File.join(tmpdir("exec_event"), "exectestingness2")
@@ -157,7 +155,7 @@ describe Puppet::Transaction do
157
155
  end
158
156
 
159
157
  # Make sure that multiple subscriptions get triggered.
160
- it "should propagate events to all dependent resources" do
158
+ it "should propagate events to all dependent resources", :fails_on_windows => true do
161
159
  path = tmpfile("path")
162
160
  file1 = tmpfile("file1")
163
161
  file2 = tmpfile("file2")
@@ -187,7 +185,7 @@ describe Puppet::Transaction do
187
185
  FileTest.should be_exist(file2)
188
186
  end
189
187
 
190
- it "should not let one failed refresh result in other refreshes failing" do
188
+ it "should not let one failed refresh result in other refreshes failing", :fails_on_windows => true do
191
189
  path = tmpfile("path")
192
190
  newfile = tmpfile("file")
193
191
  file = Puppet::Type.type(:file).new(
@@ -220,7 +218,7 @@ describe Puppet::Transaction do
220
218
  FileTest.should be_exists(newfile)
221
219
  end
222
220
 
223
- it "should still trigger skipped resources", :'fails_on_ruby_1.9.2' => true do
221
+ it "should still trigger skipped resources", :'fails_on_ruby_1.9.2' => true, :fails_on_windows => true do
224
222
  catalog = mk_catalog
225
223
  catalog.add_resource(*Puppet::Type.type(:schedule).mkdefaultschedules)
226
224
 
@@ -272,7 +270,7 @@ describe Puppet::Transaction do
272
270
  FileTest.should be_exists(fname)
273
271
  end
274
272
 
275
- it "should not attempt to evaluate resources with failed dependencies" do
273
+ it "should not attempt to evaluate resources with failed dependencies", :fails_on_windows => true do
276
274
 
277
275
  exec = Puppet::Type.type(:exec).new(
278
276
  :command => "/bin/mkdir /this/path/cannot/possibly/exist",
@@ -300,7 +298,7 @@ describe Puppet::Transaction do
300
298
  FileTest.should_not be_exists(file2[:path])
301
299
  end
302
300
 
303
- it "should not trigger subscribing resources on failure" do
301
+ it "should not trigger subscribing resources on failure", :fails_on_windows => true do
304
302
  file1 = tmpfile("file1")
305
303
  file2 = tmpfile("file2")
306
304
 
@@ -12,7 +12,7 @@ describe Puppet::Type.type(:file) do
12
12
  end
13
13
 
14
14
  it "should not attempt to manage files that do not exist if no means of creating the file is specified" do
15
- file = Puppet::Type.type(:file).new :path => "/my/file", :mode => "755"
15
+ file = Puppet::Type.type(:file).new :path => make_absolute("/my/file"), :mode => "755"
16
16
  catalog = Puppet::Resource::Catalog.new
17
17
  catalog.add_resource file
18
18
 
@@ -23,7 +23,7 @@ describe Puppet::Type.type(:file) do
23
23
  end
24
24
 
25
25
  describe "when writing files" do
26
- it "should backup files to a filebucket when one is configured" do
26
+ it "should backup files to a filebucket when one is configured", :fails_on_windows => true do
27
27
  bucket = Puppet::Type.type(:filebucket).new :path => tmpfile("filebucket"), :name => "mybucket"
28
28
  file = Puppet::Type.type(:file).new :path => tmpfile("bucket_backs"), :backup => "mybucket", :content => "foo"
29
29
  catalog = Puppet::Resource::Catalog.new
@@ -73,7 +73,7 @@ describe Puppet::Type.type(:file) do
73
73
  File.read(file[:path]).should == "bar\n"
74
74
  end
75
75
 
76
- it "should not backup symlinks" do
76
+ it "should not backup symlinks", :unless => Puppet.features.microsoft_windows? do
77
77
  link = tmpfile("link")
78
78
  dest1 = tmpfile("dest1")
79
79
  dest2 = tmpfile("dest2")
@@ -110,7 +110,7 @@ describe Puppet::Type.type(:file) do
110
110
  File.read(File.join(backup, "foo")).should == "yay"
111
111
  end
112
112
 
113
- it "should backup directories to filebuckets by backing up each file separately" do
113
+ it "should backup directories to filebuckets by backing up each file separately", :fails_on_windows => true do
114
114
  bucket = Puppet::Type.type(:filebucket).new :path => tmpfile("filebucket"), :name => "mybucket"
115
115
  file = Puppet::Type.type(:file).new :path => tmpfile("bucket_backs"), :backup => "mybucket", :content => "foo", :force => true
116
116
  catalog = Puppet::Resource::Catalog.new
@@ -172,7 +172,7 @@ describe Puppet::Type.type(:file) do
172
172
  end
173
173
  end
174
174
 
175
- it "should be able to recurse over a nonexistent file" do
175
+ it "should be able to recurse over a nonexistent file", :fails_on_windows => true do
176
176
  @path = tmpfile("file_integration_tests")
177
177
 
178
178
  @file = Puppet::Type::File.new(
@@ -214,7 +214,7 @@ describe Puppet::Type.type(:file) do
214
214
  end
215
215
  end
216
216
 
217
- it "should be able to recursively make links to other files" do
217
+ it "should be able to recursively make links to other files", :unless => Puppet.features.microsoft_windows? do
218
218
  source = tmpfile("file_link_integration_source")
219
219
 
220
220
  build_path(source)
@@ -241,7 +241,7 @@ describe Puppet::Type.type(:file) do
241
241
  end
242
242
  end
243
243
 
244
- it "should be able to recursively copy files" do
244
+ it "should be able to recursively copy files", :fails_on_windows => true do
245
245
  source = tmpfile("file_source_integration_source")
246
246
 
247
247
  build_path(source)
@@ -292,24 +292,25 @@ describe Puppet::Type.type(:file) do
292
292
  it "should recursively manage files even if there is an explicit file whose name is a prefix of the managed file" do
293
293
  dir = tmpfile("recursion_vs_explicit_2")
294
294
 
295
- managed = File.join(dir, "file")
296
- generated = File.join(dir, "file_with_a_name_starting_with_the_word_file")
295
+ managed = File.join(dir, "file")
296
+ generated = File.join(dir, "file_with_a_name_starting_with_the_word_file")
297
+ managed_mode = Puppet.features.microsoft_windows? ? 0444 : 0700
297
298
 
298
299
  FileUtils.mkdir_p(dir)
299
300
  File.open(managed, "w") { |f| f.puts "" }
300
301
  File.open(generated, "w") { |f| f.puts "" }
301
302
 
302
303
  @catalog = Puppet::Resource::Catalog.new
303
- @catalog.add_resource Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => "755")
304
+ @catalog.add_resource Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => managed_mode)
304
305
  @catalog.add_resource Puppet::Type::File.new(:name => managed, :recurse => true, :backup => false, :mode => "644")
305
306
 
306
307
  @catalog.apply
307
308
 
308
- (File.stat(generated).mode & 007777).should == 0755
309
+ (File.stat(generated).mode & 007777).should == managed_mode
309
310
  end
310
311
  end
311
312
 
312
- describe "when generating resources" do
313
+ describe "when generating resources", :fails_on_windows => true do
313
314
  before do
314
315
  @source = tmpfile("generating_in_catalog_source")
315
316
 
@@ -381,8 +382,9 @@ describe Puppet::Type.type(:file) do
381
382
 
382
383
  catalog.apply
383
384
 
385
+ expected_mode = Puppet.features.microsoft_windows? ? 0644 : 0755
384
386
  File.read(dest).should == "foo"
385
- (File.stat(dest).mode & 007777).should == 0755
387
+ (File.stat(dest).mode & 007777).should == expected_mode
386
388
  end
387
389
 
388
390
  it "should be able to copy individual files even if recurse has been specified" do
@@ -442,7 +444,7 @@ describe Puppet::Type.type(:file) do
442
444
 
443
445
 
444
446
  file = Puppet::Type.type(:file).new(
445
- :name => dest,
447
+ :name => make_absolute(dest),
446
448
  :ensure => :absent,
447
449
  :source => source,
448
450
  :backup => false
@@ -470,7 +472,6 @@ describe Puppet::Type.type(:file) do
470
472
  # this file should get removed
471
473
  File.open(@purgee, "w") { |f| f.puts "footest" }
472
474
 
473
-
474
475
  @lfobj = Puppet::Type.newfile(
475
476
  :title => "localfile",
476
477
  :path => @localfile,
@@ -479,7 +480,6 @@ describe Puppet::Type.type(:file) do
479
480
  :backup => false
480
481
  )
481
482
 
482
-
483
483
  @destobj = Puppet::Type.newfile(
484
484
  :title => "destdir",
485
485
  :path => @destdir,
@@ -12,7 +12,7 @@ describe Puppet::Type.type(:tidy) do
12
12
  end
13
13
 
14
14
  # Testing #355.
15
- it "should be able to remove dead links" do
15
+ it "should be able to remove dead links", :unless => Puppet.features.microsoft_windows? do
16
16
  dir = tmpfile("tidy_link_testing")
17
17
  link = File.join(dir, "link")
18
18
  target = tmpfile("no_such_file_tidy_link_testing")
@@ -18,12 +18,12 @@ describe Puppet::Util::Settings do
18
18
  File.should be_directory(settings[:maindir])
19
19
  end
20
20
 
21
- it "should make its directories with the corret modes" do
21
+ it "should make its directories with the correct modes" do
22
22
  settings = Puppet::Util::Settings.new
23
23
  settings.setdefaults :main, minimal_default_settings.update( :maindir => {:default => tmpfile("main"), :desc => "a", :mode => 0750} )
24
24
 
25
25
  settings.use(:main)
26
26
 
27
- (File.stat(settings[:maindir]).mode & 007777).should == 0750
27
+ (File.stat(settings[:maindir]).mode & 007777).should == (Puppet.features.microsoft_windows? ? 0755 : 0750)
28
28
  end
29
29
  end
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Util do
6
+ describe "#execute" do
7
+ it "should properly allow stdout and stderr to share a file" do
8
+ command = "ruby -e '(1..10).each {|i| (i%2==0) ? $stdout.puts(i) : $stderr.puts(i)}'"
9
+
10
+ Puppet::Util.execute(command, :combine => true).split.should =~ [*'1'..'10']
11
+ end
12
+ end
13
+ end
@@ -1,21 +1,19 @@
1
1
  require 'fileutils'
2
2
  require 'tempfile'
3
+ require 'pathname'
3
4
 
4
5
  # A support module for testing files.
5
6
  module PuppetSpec::Files
6
7
  # This code exists only to support tests that run as root, pretty much.
7
8
  # Once they have finally been eliminated this can all go... --daniel 2011-04-08
8
- if Puppet.features.posix? then
9
- def self.in_tmp(path)
10
- path =~ /^\/tmp/ or path =~ /^\/var\/folders/
11
- end
12
- elsif Puppet.features.microsoft_windows?
13
- def self.in_tmp(path)
14
- tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp"))
15
- path =~ /^#{tempdir}/
9
+ def self.in_tmp(path)
10
+ tempdir = Dir.tmpdir
11
+
12
+ Pathname.new(path).ascend do |dir|
13
+ return true if File.identical?(tempdir, dir)
16
14
  end
17
- else
18
- fail "Help! Can't find in_tmp for this platform"
15
+
16
+ false
19
17
  end
20
18
 
21
19
  def self.cleanup
@@ -31,6 +29,16 @@ module PuppetSpec::Files
31
29
  end
32
30
  end
33
31
 
32
+ def make_absolute(path)
33
+ return path unless Puppet.features.microsoft_windows?
34
+ # REMIND UNC
35
+ return path if path =~ /^[A-Za-z]:/
36
+
37
+ pwd = Dir.getwd
38
+ return "#{pwd[0,2]}#{path}" if pwd =~ /^[A-Za-z]:/
39
+ return "C:#{path}"
40
+ end
41
+
34
42
  def tmpfile(name)
35
43
  # Generate a temporary file, just for the name...
36
44
  source = Tempfile.new(name)
@@ -1,13 +1,9 @@
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
  shared_examples_for "Puppet::Indirector::FileServerTerminus" do
7
3
  # This only works if the shared behaviour is included before
8
4
  # the 'before' block in the including context.
9
5
  before do
10
- Puppet::Util::Cacher.expire
6
+ Puppet::FileServing::Configuration.instance_variable_set(:@configuration, nil)
11
7
  FileTest.stubs(:exists?).returns true
12
8
  FileTest.stubs(:exists?).with(Puppet[:fileserverconfig]).returns(true)
13
9
 
@@ -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
  shared_examples_for "Puppet::FileServing::Files" do
7
3
  it "should use the rest terminus when the 'puppet' URI scheme is used and a host name is present" do
8
4
  uri = "puppet://myhost/fakemod/my/file"
@@ -1,7 +1,3 @@
1
- #
2
- # Created by Luke Kanies on 2008-4-8.
3
- # Copyright (c) 2008. All rights reserved.
4
-
5
1
  shared_examples_for "A Memory Terminus" do
6
2
  it "should find no instances by default" do
7
3
  @searcher.find(@request).should be_nil