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
@@ -0,0 +1,170 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Puppet::Provider::Package::Msi' do
4
+ include PuppetSpec::Files
5
+
6
+ before :each do
7
+ Puppet::Type.type(:package).stubs(:defaultprovider).returns(Puppet::Type.type(:package).provider(:msi))
8
+ Puppet[:vardir] = tmpdir('msi')
9
+ @state_dir = File.join(Puppet[:vardir], 'db', 'package', 'msi')
10
+ end
11
+
12
+ describe 'when installing' do
13
+ it 'should create a state file' do
14
+ resource = Puppet::Type.type(:package).new(
15
+ :name => 'mysql-5.1.58-winx64',
16
+ :source => 'E:\mysql-5.1.58-winx64.msi'
17
+ )
18
+ resource.provider.stubs(:execute)
19
+ resource.provider.install
20
+
21
+ File.should be_exists File.join(@state_dir, 'mysql-5.1.58-winx64.yml')
22
+ end
23
+
24
+ it 'should use the install_options as parameter/value pairs' do
25
+ resource = Puppet::Type.type(:package).new(
26
+ :name => 'mysql-5.1.58-winx64',
27
+ :source => 'E:\mysql-5.1.58-winx64.msi',
28
+ :install_options => { 'INSTALLDIR' => 'C:\mysql-here' }
29
+ )
30
+
31
+ resource.provider.expects(:execute).with('msiexec.exe /qn /norestart /i E:\mysql-5.1.58-winx64.msi INSTALLDIR=C:\mysql-here')
32
+ resource.provider.install
33
+ end
34
+
35
+ it 'should only quote the value when an install_options value has a space in it' do
36
+ resource = Puppet::Type.type(:package).new(
37
+ :name => 'mysql-5.1.58-winx64',
38
+ :source => 'E:\mysql-5.1.58-winx64.msi',
39
+ :install_options => { 'INSTALLDIR' => 'C:\mysql here' }
40
+ )
41
+
42
+ resource.provider.expects(:execute).with('msiexec.exe /qn /norestart /i E:\mysql-5.1.58-winx64.msi INSTALLDIR="C:\mysql here"')
43
+ resource.provider.install
44
+ end
45
+
46
+ it 'should escape embedded quotes in install_options values with spaces' do
47
+ resource = Puppet::Type.type(:package).new(
48
+ :name => 'mysql-5.1.58-winx64',
49
+ :source => 'E:\mysql-5.1.58-winx64.msi',
50
+ :install_options => { 'INSTALLDIR' => 'C:\mysql "here"' }
51
+ )
52
+
53
+ resource.provider.expects(:execute).with('msiexec.exe /qn /norestart /i E:\mysql-5.1.58-winx64.msi INSTALLDIR="C:\mysql \"here\""')
54
+ resource.provider.install
55
+ end
56
+
57
+ it 'should not create a state file, if the installation fails' do
58
+ resource = Puppet::Type.type(:package).new(
59
+ :name => 'mysql-5.1.58-winx64',
60
+ :source => 'E:\mysql-5.1.58-winx64.msi'
61
+ )
62
+ resource.provider.stubs(:execute).raises(Puppet::ExecutionFailure.new("Execution of 'msiexec.exe' returned 128: Blargle"))
63
+ expect { resource.provider.install }.to raise_error(Puppet::ExecutionFailure, /msiexec\.exe/)
64
+
65
+ File.should_not be_exists File.join(@state_dir, 'mysql-5.1.58-winx64.yml')
66
+ end
67
+
68
+ it 'should fail if the source parameter is not set' do
69
+ expect do
70
+ resource = Puppet::Type.type(:package).new(
71
+ :name => 'mysql-5.1.58-winx64'
72
+ )
73
+ end.to raise_error(Puppet::Error, /The source parameter is required when using the MSI provider/)
74
+ end
75
+
76
+ it 'should fail if the source parameter is empty' do
77
+ expect do
78
+ resource = Puppet::Type.type(:package).new(
79
+ :name => 'mysql-5.1.58-winx64',
80
+ :source => ''
81
+ )
82
+ end.to raise_error(Puppet::Error, /The source parameter cannot be empty when using the MSI provider/)
83
+ end
84
+ end
85
+
86
+ describe 'when uninstalling' do
87
+ before :each do
88
+ FileUtils.mkdir_p(@state_dir)
89
+ File.open(File.join(@state_dir, 'mysql-5.1.58-winx64.yml'), 'w') {|f| f.puts 'Hello'}
90
+ end
91
+
92
+ it 'should remove the state file' do
93
+ resource = Puppet::Type.type(:package).new(
94
+ :name => 'mysql-5.1.58-winx64',
95
+ :source => 'E:\mysql-5.1.58-winx64.msi'
96
+ )
97
+ resource.provider.stubs(:msiexec)
98
+ resource.provider.uninstall
99
+
100
+ File.should_not be_exists File.join(Puppet[:vardir], 'db', 'package', 'msi', 'mysql-5.1.58-winx64.yml')
101
+ end
102
+
103
+ it 'should leave the state file if uninstalling fails' do
104
+ resource = Puppet::Type.type(:package).new(
105
+ :name => 'mysql-5.1.58-winx64',
106
+ :source => 'E:\mysql-5.1.58-winx64.msi'
107
+ )
108
+ resource.provider.stubs(:msiexec).raises(Puppet::ExecutionFailure.new("Execution of 'msiexec.exe' returned 128: Blargle"))
109
+ expect { resource.provider.uninstall }.to raise_error(Puppet::ExecutionFailure, /msiexec\.exe/)
110
+
111
+ File.should be_exists File.join(@state_dir, 'mysql-5.1.58-winx64.yml')
112
+ end
113
+
114
+ it 'should fail if the source parameter is not set' do
115
+ expect do
116
+ resource = Puppet::Type.type(:package).new(
117
+ :name => 'mysql-5.1.58-winx64'
118
+ )
119
+ end.to raise_error(Puppet::Error, /The source parameter is required when using the MSI provider/)
120
+ end
121
+
122
+ it 'should fail if the source parameter is empty' do
123
+ expect do
124
+ resource = Puppet::Type.type(:package).new(
125
+ :name => 'mysql-5.1.58-winx64',
126
+ :source => ''
127
+ )
128
+ end.to raise_error(Puppet::Error, /The source parameter cannot be empty when using the MSI provider/)
129
+ end
130
+ end
131
+
132
+ describe 'when enumerating instances' do
133
+ it 'should consider the base of the state file name to be the name of the package' do
134
+ FileUtils.mkdir_p(@state_dir)
135
+ package_names = ['GoogleChromeStandaloneEnterprise', 'mysql-5.1.58-winx64', 'postgresql-8.3']
136
+
137
+ package_names.each do |state_file|
138
+ File.open(File.join(@state_dir, "#{state_file}.yml"), 'w') {|f| f.puts 'Hello'}
139
+ end
140
+
141
+ installed_package_names = Puppet::Type.type(:package).provider(:msi).instances.collect {|p| p.name}
142
+
143
+ installed_package_names.should =~ package_names
144
+ end
145
+ end
146
+
147
+ it 'should consider the package installed if the state file is present' do
148
+ FileUtils.mkdir_p(@state_dir)
149
+ File.open(File.join(@state_dir, 'mysql-5.1.58-winx64.yml'), 'w') {|f| f.puts 'Hello'}
150
+
151
+ resource = Puppet::Type.type(:package).new(
152
+ :name => 'mysql-5.1.58-winx64',
153
+ :source => 'E:\mysql-5.1.58-winx64.msi'
154
+ )
155
+
156
+ resource.provider.query.should == {
157
+ :name => 'mysql-5.1.58-winx64',
158
+ :ensure => :installed
159
+ }
160
+ end
161
+
162
+ it 'should consider the package absent if the state file is missing' do
163
+ resource = Puppet::Type.type(:package).new(
164
+ :name => 'mysql-5.1.58-winx64',
165
+ :source => 'E:\mysql-5.1.58-winx64.msi'
166
+ )
167
+
168
+ resource.provider.query.should be_nil
169
+ end
170
+ end
@@ -9,6 +9,8 @@ provider_class = Puppet::Type.type(:service).provider(:redhat)
9
9
  describe provider_class do
10
10
 
11
11
  before :each do
12
+ Puppet.features.stubs(:posix?).returns(true)
13
+ Puppet.features.stubs(:microsoft_windows?).returns(false)
12
14
  @class = Puppet::Type.type(:service).provider(:redhat)
13
15
  @resource = stub 'resource'
14
16
  @resource.stubs(:[]).returns(nil)
@@ -11,6 +11,8 @@ provider_class = Puppet::Type.type(:service).provider(:smf)
11
11
  describe provider_class do
12
12
 
13
13
  before(:each) do
14
+ Puppet.features.stubs(:posix?).returns(true)
15
+ Puppet.features.stubs(:microsoft_windows?).returns(false)
14
16
  # Create a mock resource
15
17
  @resource = Puppet::Type.type(:service).new(
16
18
  :name => "/system/myservice", :ensure => :running, :enable => :true)
@@ -111,6 +113,7 @@ describe provider_class do
111
113
  it "should import the manifest if service is missing" do
112
114
  @provider.expects(:svccfg).with(:import, "/tmp/myservice.xml")
113
115
  @provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, "/system/myservice"], true)
116
+ @provider.expects(:svcs).with('-H', '-o', 'state,nstate', "/system/myservice").returns("online\t-")
114
117
  @provider.start
115
118
  end
116
119
 
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rspec
2
+ #
3
+ # Unit testing for the RedHat service Provider
4
+ #
5
+ require 'spec_helper'
6
+
7
+ provider_class = Puppet::Type.type(:service).provider(:systemd)
8
+
9
+ describe provider_class do
10
+ before :each do
11
+ @class = Puppet::Type.type(:service).provider(:redhat)
12
+ @resource = stub 'resource'
13
+ @resource.stubs(:[]).returns(nil)
14
+ @resource.stubs(:[]).with(:name).returns "myservice.service"
15
+ @provider = provider_class.new
16
+ @resource.stubs(:provider).returns @provider
17
+ @provider.resource = @resource
18
+ end
19
+
20
+ [:enabled?, :enable, :disable, :start, :stop, :status, :restart].each do |method|
21
+ it "should have a #{method} method" do
22
+ @provider.should respond_to(method)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env rspec
2
+ #
3
+ # Unit testing for the Windows service Provider
4
+ #
5
+
6
+ require 'spec_helper'
7
+
8
+ require 'win32/service' if Puppet.features.microsoft_windows?
9
+
10
+ describe Puppet::Type.type(:service).provider(:windows), :if => Puppet.features.microsoft_windows? do
11
+
12
+ before :each do
13
+ @resource = Puppet::Type.type(:service).new(:name => 'snmptrap', :provider => :windows)
14
+
15
+ @config = Struct::ServiceConfigInfo.new
16
+
17
+ @status = Struct::ServiceStatus.new
18
+
19
+ Win32::Service.stubs(:config_info).with(@resource[:name]).returns(@config)
20
+ Win32::Service.stubs(:status).with(@resource[:name]).returns(@status)
21
+ end
22
+
23
+ describe ".instances" do
24
+ it "should enumerate all services" do
25
+ list_of_services = ['snmptrap', 'svchost', 'sshd'].map { |s| stub('service', :service_name => s) }
26
+ Win32::Service.expects(:services).returns(list_of_services)
27
+
28
+ described_class.instances.map(&:name).should =~ ['snmptrap', 'svchost', 'sshd']
29
+ end
30
+ end
31
+
32
+ describe "#start" do
33
+ it "should call out to the Win32::Service API to start the service" do
34
+ @config.start_type = Win32::Service.get_start_type(Win32::Service::SERVICE_AUTO_START)
35
+
36
+ Win32::Service.expects(:start).with( @resource[:name] )
37
+
38
+ @resource.provider.start
39
+ end
40
+
41
+ it "should handle when Win32::Service.start raises a Win32::Service::Error" do
42
+ @config.start_type = Win32::Service.get_start_type(Win32::Service::SERVICE_AUTO_START)
43
+
44
+ Win32::Service.expects(:start).with( @resource[:name] ).raises(
45
+ Win32::Service::Error.new("The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.")
46
+ )
47
+
48
+ expect { @resource.provider.start }.to raise_error(
49
+ Puppet::Error,
50
+ /Cannot start .*, error was: The service cannot be started, either/
51
+ )
52
+ end
53
+
54
+ describe "when the service is disabled" do
55
+ before :each do
56
+ @config.start_type = Win32::Service.get_start_type(Win32::Service::SERVICE_DISABLED)
57
+ Win32::Service.stubs(:start).with(@resource[:name])
58
+ end
59
+
60
+ it "should refuse to start if not managing enable" do
61
+ expect { @resource.provider.start }.to raise_error(Puppet::Error, /Will not start disabled service/)
62
+ end
63
+
64
+ it "should enable if managing enable and enable is true" do
65
+ @resource[:enable] = :true
66
+
67
+ Win32::Service.expects(:configure).with('service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_AUTO_START).returns(Win32::Service)
68
+
69
+ @resource.provider.start
70
+ end
71
+
72
+ it "should manual start if managing enable and enable is false" do
73
+ @resource[:enable] = :false
74
+
75
+ Win32::Service.expects(:configure).with('service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_DEMAND_START).returns(Win32::Service)
76
+
77
+ @resource.provider.start
78
+ end
79
+ end
80
+ end
81
+
82
+ describe "#stop" do
83
+ it "should call out to the Win32::Service API to stop the service" do
84
+ Win32::Service.expects(:stop).with( @resource[:name] )
85
+ @resource.provider.stop
86
+ end
87
+
88
+ it "should handle when Win32::Service.stop raises a Win32::Service::Error" do
89
+ Win32::Service.expects(:stop).with( @resource[:name] ).raises(
90
+ Win32::Service::Error.new("should not try to stop an already stopped service.")
91
+ )
92
+
93
+ expect { @resource.provider.stop }.to raise_error(
94
+ Puppet::Error,
95
+ /Cannot stop .*, error was: should not try to stop an already stopped service/
96
+ )
97
+ end
98
+ end
99
+
100
+ describe "#status" do
101
+ ['stopped', 'paused', 'stop pending', 'pause pending'].each do |state|
102
+ it "should report a #{state} service as stopped" do
103
+ @status.current_state = state
104
+
105
+ @resource.provider.status.should == :stopped
106
+ end
107
+ end
108
+
109
+ ["running", "continue pending", "start pending" ].each do |state|
110
+ it "should report a #{state} service as running" do
111
+ @status.current_state = state
112
+
113
+ @resource.provider.status.should == :running
114
+ end
115
+ end
116
+ end
117
+
118
+ describe "#enabled?" do
119
+ it "should report a service with a startup type of manual as manual" do
120
+ @config.start_type = Win32::Service.get_start_type(Win32::Service::SERVICE_DEMAND_START)
121
+
122
+ @resource.provider.enabled?.should == :manual
123
+ end
124
+
125
+ it "should report a service with a startup type of disabled as false" do
126
+ @config.start_type = Win32::Service.get_start_type(Win32::Service::SERVICE_DISABLED)
127
+
128
+ @resource.provider.enabled?.should == :false
129
+ end
130
+
131
+ # We need to guard this section explicitly since rspec will always
132
+ # construct all examples, even if it isn't going to run them.
133
+ if Puppet.features.microsoft_windows?
134
+ [Win32::Service::SERVICE_AUTO_START, Win32::Service::SERVICE_BOOT_START, Win32::Service::SERVICE_SYSTEM_START].each do |start_type_const|
135
+ start_type = Win32::Service.get_start_type(start_type_const)
136
+ it "should report a service with a startup type of '#{start_type}' as true" do
137
+ @config.start_type = start_type
138
+
139
+ @resource.provider.enabled?.should == :true
140
+ end
141
+ end
142
+ end
143
+ end
144
+
145
+ describe "#enable" do
146
+ it "should set service start type to Service_Auto_Start when enabled" do
147
+ Win32::Service.expects(:configure).with('service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_AUTO_START).returns(Win32::Service)
148
+ @resource.provider.enable
149
+ end
150
+ end
151
+
152
+ describe "#disable" do
153
+ it "should set service start type to Service_Disabled when disabled" do
154
+ Win32::Service.expects(:configure).with('service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_DISABLED).returns(Win32::Service)
155
+ @resource.provider.disable
156
+ end
157
+ end
158
+
159
+ describe "#manual_start" do
160
+ it "should set service start type to Service_Demand_Start (manual) when manual" do
161
+ Win32::Service.expects(:configure).with('service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_DEMAND_START).returns(Win32::Service)
162
+ @resource.provider.manual_start
163
+ end
164
+ end
165
+
166
+ end
@@ -5,7 +5,7 @@ require 'puppet_spec/files'
5
5
 
6
6
  provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed)
7
7
 
8
- describe provider_class do
8
+ describe provider_class, :unless => Puppet.features.microsoft_windows? do
9
9
  include PuppetSpec::Files
10
10
 
11
11
  before :each do
@@ -77,7 +77,7 @@ describe provider_class do
77
77
  end
78
78
  end
79
79
 
80
- describe provider_class do
80
+ describe provider_class, :unless => Puppet.features.microsoft_windows? do
81
81
  before :each do
82
82
  @resource = Puppet::Type.type(:ssh_authorized_key).new(:name => "foo", :user => "random_bob")
83
83
 
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env rspec
2
- #
3
- # Created by Luke Kanies on 2008-3-10.
4
- # Copyright (c) 2006. All rights reserved.
5
-
6
2
  require 'spec_helper'
7
3
 
8
4
  provider_class = Puppet::Type.type(:user).provider(:ldap)
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  provider_class = Puppet::Type.type(:user).provider(:user_role_add)
5
5
 
6
- describe provider_class do
6
+ describe provider_class, :fails_on_windows => true do
7
7
  before do
8
8
  @resource = stub("resource", :name => "myuser", :managehome? => nil)
9
9
  @resource.stubs(:should).returns "fakeval"
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  provider_class = Puppet::Type.type(:user).provider(:useradd)
5
5
 
6
- describe provider_class do
6
+ describe provider_class, :fails_on_windows => true do
7
7
  before do
8
8
  @resource = stub("resource", :name => "myuser", :managehome? => nil)
9
9
  @resource.stubs(:should).returns "fakeval"
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:user).provider(:windows_adsi) do
6
+ let(:resource) do
7
+ Puppet::Type.type(:user).new(
8
+ :title => 'testuser',
9
+ :comment => 'Test J. User',
10
+ :provider => :windows_adsi
11
+ )
12
+ end
13
+
14
+ let(:provider) { resource.provider }
15
+
16
+ let(:connection) { stub 'connection' }
17
+
18
+ before :each do
19
+ Puppet::Util::ADSI.stubs(:computer_name).returns('testcomputername')
20
+ Puppet::Util::ADSI.stubs(:connect).returns connection
21
+ end
22
+
23
+ describe ".instances" do
24
+ it "should enumerate all users" do
25
+ names = ['user1', 'user2', 'user3']
26
+ stub_users = names.map{|n| stub(:name => n)}
27
+
28
+ connection.stubs(:execquery).with("select * from win32_useraccount").returns(stub_users)
29
+
30
+ described_class.instances.map(&:name).should =~ names
31
+ end
32
+ end
33
+
34
+ it "should provide access to a Puppet::Util::ADSI::User object" do
35
+ provider.user.should be_a(Puppet::Util::ADSI::User)
36
+ end
37
+
38
+ describe "when managing groups" do
39
+ it 'should return the list of groups as a comma-separated list' do
40
+ provider.user.stubs(:groups).returns ['group1', 'group2', 'group3']
41
+
42
+ provider.groups.should == 'group1,group2,group3'
43
+ end
44
+
45
+ it "should return absent if there are no groups" do
46
+ provider.user.stubs(:groups).returns []
47
+
48
+ provider.groups.should == ''
49
+ end
50
+
51
+ it 'should be able to add a user to a set of groups' do
52
+ resource[:membership] = :minimum
53
+ provider.user.expects(:set_groups).with('group1,group2', true)
54
+
55
+ provider.groups = 'group1,group2'
56
+
57
+ resource[:membership] = :inclusive
58
+ provider.user.expects(:set_groups).with('group1,group2', false)
59
+
60
+ provider.groups = 'group1,group2'
61
+ end
62
+ end
63
+
64
+ describe "when creating a user" do
65
+ it "should create the user on the system and set its other properties" do
66
+ resource[:groups] = ['group1', 'group2']
67
+ resource[:membership] = :inclusive
68
+ resource[:comment] = 'a test user'
69
+ resource[:home] = 'C:\Users\testuser'
70
+
71
+ user = stub 'user'
72
+ Puppet::Util::ADSI::User.expects(:create).with('testuser').returns user
73
+
74
+ user.stubs(:groups).returns(['group2', 'group3'])
75
+
76
+ user.expects(:set_groups).with('group1,group2', false)
77
+ user.expects(:[]=).with('Description', 'a test user')
78
+ user.expects(:[]=).with('HomeDirectory', 'C:\Users\testuser')
79
+
80
+ provider.create
81
+ end
82
+ end
83
+
84
+ it 'should be able to test whether a user exists' do
85
+ Puppet::Util::ADSI.stubs(:connect).returns stub('connection')
86
+ provider.should be_exists
87
+
88
+ Puppet::Util::ADSI.stubs(:connect).returns nil
89
+ provider.should_not be_exists
90
+ end
91
+
92
+ it 'should be able to delete a user' do
93
+ connection.expects(:Delete).with('user', 'testuser')
94
+
95
+ provider.delete
96
+ end
97
+
98
+ it "should commit the user when flushed" do
99
+ provider.user.expects(:commit)
100
+
101
+ provider.flush
102
+ end
103
+
104
+ [:uid, :gid, :shell].each do |prop|
105
+ it "should warn when trying to manage the #{prop} property" do
106
+ provider.expects(:warning).with { |msg| msg =~ /No support for managing property #{prop}/ }
107
+ provider.send("#{prop}=", 'foo')
108
+ end
109
+ end
110
+ end
@@ -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/relationship'
8
4
 
@@ -2,28 +2,47 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Puppet::Resource::Catalog, "when compiling" do
5
+ include PuppetSpec::Files
5
6
 
6
7
  before do
7
- @basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath"
8
+ @basepath = make_absolute("/somepath")
8
9
  # stub this to not try to create state.yaml
9
10
  Puppet::Util::Storage.stubs(:store)
10
11
  end
11
12
 
12
- it "should be an Expirer" do
13
- Puppet::Resource::Catalog.ancestors.should be_include(Puppet::Util::Cacher::Expirer)
14
- end
13
+ it "should write its resources' types, namevars" do
14
+ catalog = Puppet::Resource::Catalog.new("host")
15
15
 
16
- it "should always be expired if it's not applying" do
17
- @catalog = Puppet::Resource::Catalog.new("host")
18
- @catalog.expects(:applying?).returns false
19
- @catalog.should be_dependent_data_expired(Time.now)
16
+ resourcefile = tmpfile('resourcefile')
17
+ Puppet[:resourcefile] = resourcefile
18
+
19
+ res = Puppet::Type.type('file').new(:title => '/tmp/sam')
20
+ res.file = 'site.pp'
21
+ res.line = 21
22
+
23
+ res2 = Puppet::Type.type('exec').new(:title => 'bob', :command => '/bin/rm -rf /')
24
+ res2.file = '/modules/bob/manifests/bob.pp'
25
+ res2.line = 42
26
+
27
+ comp_res = Puppet::Type.type('component').new(:title => 'Class[Main]')
28
+
29
+ catalog.add_resource(res, res2, comp_res)
30
+ catalog.write_resource_file
31
+ File.open(resourcefile).readlines.map(&:chomp).should =~ [
32
+ "file[/tmp/sam]",
33
+ "exec[/bin/rm -rf /]"
34
+ ]
20
35
  end
21
36
 
22
- it "should not be expired if it's applying and the timestamp is late enough" do
23
- @catalog = Puppet::Resource::Catalog.new("host")
24
- @catalog.expire
25
- @catalog.expects(:applying?).returns true
26
- @catalog.should_not be_dependent_data_expired(Time.now)
37
+ it "should log an error if unable to write to the resource file" do
38
+ catalog = Puppet::Resource::Catalog.new("host")
39
+ Puppet[:resourcefile] = '/not/writable/file'
40
+
41
+ catalog.add_resource(Puppet::Type.type('file').new(:title => '/tmp/foo'))
42
+ catalog.write_resource_file
43
+ @logs.size.should == 1
44
+ @logs.first.message.should =~ /Could not create resource file/
45
+ @logs.first.level.should == :err
27
46
  end
28
47
 
29
48
  it "should be able to write its list of classes to the class file" do
@@ -508,7 +527,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
508
527
  @catalog.resource(:file, @basepath+"/something").should equal(resource)
509
528
  end
510
529
 
511
- it "should not create aliases for non-isomorphic resources whose names do not match their titles" do
530
+ it "should not create aliases for non-isomorphic resources whose names do not match their titles", :fails_on_windows => true do
512
531
  resource = Puppet::Type.type(:exec).new(:title => "testing", :command => "echo", :path => %w{/bin /usr/bin /usr/local/bin})
513
532
 
514
533
  @catalog.add_resource(resource)
@@ -614,11 +633,12 @@ describe Puppet::Resource::Catalog, "when compiling" do
614
633
  end
615
634
 
616
635
  it "should conflict when its uniqueness key matches another resource's title" do
617
- @resource = Puppet::Type.type(:file).new(:title => "/tmp/foo")
618
- @other = Puppet::Type.type(:file).new(:title => "another file", :path => "/tmp/foo")
636
+ path = make_absolute("/tmp/foo")
637
+ @resource = Puppet::Type.type(:file).new(:title => path)
638
+ @other = Puppet::Type.type(:file).new(:title => "another file", :path => path)
619
639
 
620
640
  @catalog.add_resource(@resource)
621
- expect { @catalog.add_resource(@other) }.to raise_error(ArgumentError, /Cannot alias File\[another file\] to \["\/tmp\/foo"\].*resource \["File", "\/tmp\/foo"\] already defined/)
641
+ expect { @catalog.add_resource(@other) }.to raise_error(ArgumentError, /Cannot alias File\[another file\] to \["#{Regexp.escape(path)}"\].*resource \["File", "#{Regexp.escape(path)}"\] already defined/)
622
642
  end
623
643
 
624
644
  it "should conflict when its uniqueness key matches the uniqueness key derived from another resource's title" do
@@ -690,11 +710,6 @@ describe Puppet::Resource::Catalog, "when compiling" do
690
710
  @catalog.apply(:ignoreschedules => true)
691
711
  end
692
712
 
693
- it "should expire cached data in the resources both before and after the transaction" do
694
- @catalog.expects(:expire).times(2)
695
- @catalog.apply
696
- end
697
-
698
713
  describe "host catalogs" do
699
714
 
700
715
  # super() doesn't work in the setup method for some reason
@@ -855,8 +870,6 @@ describe Puppet::Resource::Catalog, "when compiling" do
855
870
  @real_indirection = Puppet::Resource::Catalog.indirection
856
871
 
857
872
  @indirection = stub 'indirection', :name => :catalog
858
-
859
- Puppet::Util::Cacher.expire
860
873
  end
861
874
 
862
875
  it "should use the value of the 'catalog_terminus' setting to determine its terminus class" do
@@ -875,7 +888,6 @@ describe Puppet::Resource::Catalog, "when compiling" do
875
888
  end
876
889
 
877
890
  after do
878
- Puppet::Util::Cacher.expire
879
891
  @real_indirection.reset_terminus_class
880
892
  end
881
893
  end