puppet 3.0.0.rc5 → 3.0.0.rc7

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 (398) hide show
  1. data/LICENSE +1 -1
  2. data/README_DEVELOPER.md +209 -1
  3. data/README_HIERA.md +148 -0
  4. data/Rakefile +25 -27
  5. data/bin/extlookup2hiera +56 -0
  6. data/conf/auth.conf +34 -34
  7. data/examples/hiera/README.md +91 -0
  8. data/examples/hiera/etc/hiera.yaml +15 -0
  9. data/examples/hiera/etc/hieradb/common.yaml +3 -0
  10. data/examples/hiera/etc/hieradb/dc1.yaml +6 -0
  11. data/examples/hiera/etc/hieradb/development.yaml +2 -0
  12. data/examples/hiera/etc/puppet.conf +3 -0
  13. data/examples/hiera/modules/data/manifests/common.pp +3 -0
  14. data/examples/hiera/modules/ntp/manifests/config.pp +5 -0
  15. data/examples/hiera/modules/ntp/manifests/data.pp +3 -0
  16. data/examples/hiera/modules/ntp/templates/ntp.conf.erb +3 -0
  17. data/examples/hiera/modules/users/manifests/common.pp +3 -0
  18. data/examples/hiera/modules/users/manifests/dc1.pp +3 -0
  19. data/examples/hiera/modules/users/manifests/development.pp +3 -0
  20. data/examples/hiera/site.pp +3 -0
  21. data/ext/build_defaults.yaml +23 -0
  22. data/ext/debian/README.Debian +8 -0
  23. data/ext/debian/README.source +2 -0
  24. data/ext/debian/TODO.Debian +1 -0
  25. data/ext/debian/changelog.erb +1104 -0
  26. data/ext/debian/compat +1 -0
  27. data/ext/debian/control +143 -0
  28. data/ext/debian/copyright +361 -0
  29. data/ext/debian/docs +1 -0
  30. data/ext/debian/fileserver.conf +17 -0
  31. data/ext/debian/puppet-common.dirs +8 -0
  32. data/ext/debian/puppet-common.install +4 -0
  33. data/ext/debian/puppet-common.lintian-overrides +5 -0
  34. data/ext/debian/puppet-common.manpages +2 -0
  35. data/ext/debian/puppet-common.postinst +35 -0
  36. data/ext/debian/puppet-common.postrm +32 -0
  37. data/ext/debian/puppet-el.dirs +1 -0
  38. data/ext/debian/puppet-el.emacsen-install +25 -0
  39. data/ext/debian/puppet-el.emacsen-remove +11 -0
  40. data/ext/debian/puppet-el.emacsen-startup +9 -0
  41. data/ext/debian/puppet-el.install +1 -0
  42. data/ext/debian/puppet-testsuite.install +2 -0
  43. data/ext/debian/puppet-testsuite.lintian-overrides +4 -0
  44. data/ext/debian/puppet.conf +14 -0
  45. data/ext/debian/puppet.default +7 -0
  46. data/ext/debian/puppet.init +118 -0
  47. data/ext/debian/puppet.lintian-overrides +3 -0
  48. data/ext/debian/puppet.logrotate +11 -0
  49. data/ext/debian/puppet.manpages +32 -0
  50. data/ext/debian/puppet.postinst +20 -0
  51. data/ext/debian/puppet.postrm +20 -0
  52. data/ext/debian/puppet.preinst +20 -0
  53. data/ext/debian/puppetmaster-common.install +2 -0
  54. data/ext/debian/puppetmaster-common.manpages +2 -0
  55. data/ext/debian/puppetmaster-common.puppetqd.default +27 -0
  56. data/ext/debian/puppetmaster-common.puppetqd.init +84 -0
  57. data/ext/debian/puppetmaster-passenger.dirs +4 -0
  58. data/ext/debian/puppetmaster-passenger.postinst +66 -0
  59. data/ext/debian/puppetmaster-passenger.postrm +33 -0
  60. data/ext/debian/puppetmaster.README.debian +16 -0
  61. data/ext/debian/puppetmaster.default +38 -0
  62. data/ext/debian/puppetmaster.init +158 -0
  63. data/ext/debian/puppetmaster.lintian-overrides +3 -0
  64. data/ext/debian/puppetmaster.postinst +20 -0
  65. data/ext/debian/puppetmaster.postrm +5 -0
  66. data/ext/debian/puppetmaster.preinst +22 -0
  67. data/ext/debian/rules +128 -0
  68. data/ext/debian/source/format +1 -0
  69. data/ext/debian/source/options +1 -0
  70. data/ext/debian/vim-puppet.README.Debian +13 -0
  71. data/ext/debian/vim-puppet.dirs +3 -0
  72. data/ext/debian/vim-puppet.yaml +5 -0
  73. data/ext/debian/watch +2 -0
  74. data/ext/emacs/puppet-mode.el +1 -0
  75. data/ext/envpuppet +4 -0
  76. data/ext/envpuppet.bat +3 -2
  77. data/{conf → ext}/freebsd/puppetd +0 -0
  78. data/{conf → ext}/freebsd/puppetmasterd +0 -0
  79. data/{conf → ext}/gentoo/conf.d/puppet +0 -0
  80. data/{conf → ext}/gentoo/conf.d/puppetmaster +0 -0
  81. data/{conf → ext}/gentoo/init.d/puppet +0 -0
  82. data/{conf → ext}/gentoo/init.d/puppetmaster +0 -0
  83. data/{conf → ext}/gentoo/puppet/fileserver.conf +0 -0
  84. data/{conf → ext}/gentoo/puppet/puppet.conf +0 -0
  85. data/ext/ips/puppet-agent +49 -0
  86. data/ext/ips/puppet-master +44 -0
  87. data/ext/ips/puppet.conf +29 -0
  88. data/ext/ips/puppet.p5m.erb +12 -0
  89. data/ext/ips/puppetagent.xml +46 -0
  90. data/ext/ips/puppetmaster.xml +42 -0
  91. data/ext/ips/rules +19 -0
  92. data/ext/ips/transforms +34 -0
  93. data/{conf → ext}/osx/PackageInfo.plist +0 -0
  94. data/{conf → ext}/osx/createpackage.sh +1 -1
  95. data/ext/osx/file_mapping.yaml +33 -0
  96. data/ext/osx/preflight.erb +37 -0
  97. data/{tasks/rake/templates → ext/osx}/prototype.plist.erb +0 -0
  98. data/ext/packaging/README-Solaris.md +117 -0
  99. data/ext/packaging/README.md +89 -0
  100. data/ext/packaging/tasks/00_utils.rb +236 -0
  101. data/ext/packaging/tasks/10_setupvars.rake +62 -0
  102. data/ext/packaging/tasks/apple.rake +201 -0
  103. data/ext/packaging/tasks/clean.rake +5 -0
  104. data/ext/packaging/tasks/deb.rake +105 -0
  105. data/ext/packaging/tasks/gem.rake +52 -0
  106. data/ext/packaging/tasks/ips.rake +78 -0
  107. data/ext/packaging/tasks/mock.rake +88 -0
  108. data/ext/packaging/tasks/release.rake +20 -0
  109. data/ext/packaging/tasks/rpm.rake +39 -0
  110. data/ext/packaging/tasks/ship.rake +34 -0
  111. data/ext/packaging/tasks/sign.rake +76 -0
  112. data/ext/packaging/tasks/tar.rake +20 -0
  113. data/ext/project_data.yaml +25 -0
  114. data/ext/rack/files/apache2.conf +2 -1
  115. data/{conf → ext}/redhat/client.init +0 -0
  116. data/{conf → ext}/redhat/client.sysconfig +0 -0
  117. data/{conf → ext}/redhat/fileserver.conf +0 -0
  118. data/{conf → ext}/redhat/logrotate +0 -0
  119. data/{conf → ext}/redhat/puppet.conf +0 -0
  120. data/{conf/redhat/puppet.spec → ext/redhat/puppet.spec.erb} +140 -33
  121. data/{conf → ext}/redhat/queue.init +0 -0
  122. data/{conf → ext}/redhat/rundir-perms.patch +0 -0
  123. data/{conf → ext}/redhat/server.init +0 -0
  124. data/{conf → ext}/redhat/server.sysconfig +0 -0
  125. data/{conf → ext}/solaris/pkginfo +0 -0
  126. data/{conf → ext}/solaris/smf/puppetd.xml +0 -0
  127. data/{conf → ext}/solaris/smf/puppetmasterd.xml +0 -0
  128. data/{conf → ext}/solaris/smf/svc-puppetd +0 -0
  129. data/{conf → ext}/solaris/smf/svc-puppetmasterd +0 -0
  130. data/{conf → ext}/suse/client.init +0 -0
  131. data/{conf → ext}/suse/fileserver.conf +0 -0
  132. data/{conf → ext}/suse/logrotate +0 -0
  133. data/{conf → ext}/suse/puppet.conf +0 -0
  134. data/{conf → ext}/suse/puppet.spec +1 -1
  135. data/{conf → ext}/suse/server.init +0 -0
  136. data/ext/systemd/puppetagent.service +13 -0
  137. data/ext/systemd/puppetmaster.service +13 -0
  138. data/{conf → ext}/windows/eventlog/Rakefile +0 -0
  139. data/{conf → ext}/windows/eventlog/puppetres.dll +0 -0
  140. data/{conf → ext}/windows/eventlog/puppetres.mc +0 -0
  141. data/ext/windows/service/daemon.bat +6 -0
  142. data/ext/windows/service/daemon.rb +90 -0
  143. data/install.rb +22 -32
  144. data/lib/hiera/backend/puppet_backend.rb +102 -0
  145. data/lib/hiera/scope.rb +42 -0
  146. data/lib/hiera_puppet.rb +89 -0
  147. data/lib/puppet.rb +1 -1
  148. data/lib/puppet/agent.rb +2 -2
  149. data/lib/puppet/agent/locker.rb +12 -9
  150. data/lib/puppet/application.rb +10 -8
  151. data/lib/puppet/application/agent.rb +12 -8
  152. data/lib/puppet/application/apply.rb +2 -2
  153. data/lib/puppet/application/cert.rb +6 -6
  154. data/lib/puppet/application/certificate.rb +1 -4
  155. data/lib/puppet/application/describe.rb +1 -1
  156. data/lib/puppet/application/device.rb +5 -2
  157. data/lib/puppet/application/doc.rb +1 -1
  158. data/lib/puppet/application/face_base.rb +3 -13
  159. data/lib/puppet/application/filebucket.rb +1 -1
  160. data/lib/puppet/application/inspect.rb +1 -1
  161. data/lib/puppet/application/kick.rb +4 -2
  162. data/lib/puppet/application/master.rb +2 -2
  163. data/lib/puppet/application/queue.rb +3 -1
  164. data/lib/puppet/application/resource.rb +1 -1
  165. data/lib/puppet/configurer.rb +11 -7
  166. data/lib/puppet/configurer/downloader.rb +1 -4
  167. data/lib/puppet/daemon.rb +4 -4
  168. data/lib/puppet/defaults.rb +64 -60
  169. data/lib/puppet/external/dot.rb +1 -1
  170. data/lib/puppet/external/pson/common.rb +15 -0
  171. data/lib/puppet/external/pson/pure.rb +0 -62
  172. data/lib/puppet/external/pson/pure/generator.rb +1 -1
  173. data/lib/puppet/external/pson/pure/parser.rb +2 -2
  174. data/lib/puppet/face/ca.rb +19 -14
  175. data/lib/puppet/face/config.rb +2 -2
  176. data/lib/puppet/face/facts.rb +1 -1
  177. data/lib/puppet/face/help/action.erb +0 -1
  178. data/lib/puppet/face/help/face.erb +0 -1
  179. data/lib/puppet/face/help/man.erb +3 -6
  180. data/lib/puppet/face/module/install.rb +1 -1
  181. data/lib/puppet/face/module/list.rb +1 -1
  182. data/lib/puppet/face/module/uninstall.rb +1 -1
  183. data/lib/puppet/face/node.rb +1 -1
  184. data/lib/puppet/face/node/clean.rb +30 -25
  185. data/lib/puppet/feature/base.rb +0 -3
  186. data/lib/puppet/feature/rails.rb +2 -1
  187. data/lib/puppet/file_serving/terminus_selector.rb +1 -1
  188. data/lib/puppet/indirector/catalog/active_record.rb +5 -0
  189. data/lib/puppet/indirector/catalog/static_compiler.rb +2 -3
  190. data/lib/puppet/indirector/certificate/disabled_ca.rb +22 -0
  191. data/lib/puppet/indirector/certificate_request/disabled_ca.rb +22 -0
  192. data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +22 -0
  193. data/lib/puppet/indirector/face.rb +3 -3
  194. data/lib/puppet/indirector/facts/active_record.rb +5 -0
  195. data/lib/puppet/indirector/facts/facter.rb +1 -4
  196. data/lib/puppet/indirector/facts/inventory_active_record.rb +6 -0
  197. data/lib/puppet/indirector/file_bucket_file/file.rb +2 -1
  198. data/lib/puppet/indirector/indirection.rb +2 -2
  199. data/lib/puppet/indirector/key/disabled_ca.rb +22 -0
  200. data/lib/puppet/indirector/node/active_record.rb +5 -0
  201. data/lib/puppet/indirector/request.rb +4 -0
  202. data/lib/puppet/indirector/resource/active_record.rb +5 -0
  203. data/lib/puppet/network/authentication.rb +30 -0
  204. data/lib/puppet/network/http.rb +0 -13
  205. data/lib/puppet/network/http/connection.rb +10 -2
  206. data/lib/puppet/network/http/handler.rb +8 -0
  207. data/lib/puppet/network/http/mongrel/rest.rb +5 -0
  208. data/lib/puppet/network/http/rack/rest.rb +7 -0
  209. data/lib/puppet/network/http/webrick.rb +3 -6
  210. data/lib/puppet/network/http/webrick/rest.rb +4 -0
  211. data/lib/puppet/network/server.rb +9 -33
  212. data/lib/puppet/node.rb +1 -1
  213. data/lib/puppet/node/facts.rb +0 -1
  214. data/lib/puppet/parser/compiler.rb +1 -1
  215. data/lib/puppet/parser/functions.rb +12 -1
  216. data/lib/puppet/parser/functions/hiera.rb +8 -0
  217. data/lib/puppet/parser/functions/hiera_array.rb +8 -0
  218. data/lib/puppet/parser/functions/hiera_hash.rb +8 -0
  219. data/lib/puppet/parser/functions/hiera_include.rb +11 -0
  220. data/lib/puppet/parser/functions/shellquote.rb +21 -29
  221. data/lib/puppet/parser/lexer.rb +2 -1
  222. data/lib/puppet/parser/scope.rb +8 -0
  223. data/lib/puppet/provider/exec/windows.rb +1 -1
  224. data/lib/puppet/provider/group/groupadd.rb +2 -3
  225. data/lib/puppet/provider/package/pkg.rb +37 -10
  226. data/lib/puppet/provider/service/daemontools.rb +1 -1
  227. data/lib/puppet/provider/service/launchd.rb +1 -1
  228. data/lib/puppet/provider/service/redhat.rb +1 -1
  229. data/lib/puppet/provider/service/runit.rb +1 -1
  230. data/lib/puppet/provider/user/useradd.rb +8 -3
  231. data/lib/puppet/provider/user/windows_adsi.rb +11 -0
  232. data/lib/puppet/provider/zfs/zfs.rb +29 -2
  233. data/lib/puppet/provider/zone/solaris.rb +144 -39
  234. data/lib/puppet/provider/zpool/zpool.rb +7 -10
  235. data/lib/puppet/settings.rb +50 -86
  236. data/lib/puppet/settings/duration_setting.rb +34 -0
  237. data/lib/puppet/settings/terminus_setting.rb +16 -0
  238. data/lib/puppet/ssl/base.rb +49 -9
  239. data/lib/puppet/ssl/certificate.rb +13 -9
  240. data/lib/puppet/ssl/certificate_authority.rb +4 -0
  241. data/lib/puppet/ssl/certificate_authority/interface.rb +10 -17
  242. data/lib/puppet/ssl/certificate_factory.rb +4 -21
  243. data/lib/puppet/ssl/certificate_request.rb +1 -10
  244. data/lib/puppet/ssl/certificate_revocation_list.rb +1 -3
  245. data/lib/puppet/ssl/digest.rb +20 -0
  246. data/lib/puppet/ssl/host.rb +31 -6
  247. data/lib/puppet/test/test_helper.rb +1 -1
  248. data/lib/puppet/transaction/report.rb +2 -1
  249. data/lib/puppet/type.rb +1 -1
  250. data/lib/puppet/type/augeas.rb +1 -1
  251. data/lib/puppet/type/cron.rb +1 -1
  252. data/lib/puppet/type/exec.rb +7 -8
  253. data/lib/puppet/type/file.rb +1 -1
  254. data/lib/puppet/type/file/content.rb +2 -2
  255. data/lib/puppet/type/file/ensure.rb +1 -1
  256. data/lib/puppet/type/file/mode.rb +1 -1
  257. data/lib/puppet/type/file/selcontext.rb +6 -2
  258. data/lib/puppet/type/file/source.rb +1 -1
  259. data/lib/puppet/type/schedule.rb +1 -1
  260. data/lib/puppet/type/scheduled_task.rb +1 -1
  261. data/lib/puppet/type/tidy.rb +1 -1
  262. data/lib/puppet/type/zone.rb +126 -253
  263. data/lib/puppet/util.rb +10 -23
  264. data/lib/puppet/util/adsi.rb +22 -14
  265. data/lib/puppet/util/log/destinations.rb +7 -0
  266. data/lib/puppet/util/log/rate_limited_logger.rb +40 -0
  267. data/lib/puppet/util/metric.rb +2 -2
  268. data/lib/puppet/util/monkey_patches.rb +8 -0
  269. data/lib/puppet/util/platform.rb +7 -0
  270. data/lib/puppet/util/selinux.rb +31 -36
  271. data/lib/puppet/util/windows/error.rb +1 -1
  272. data/lib/puppet/util/windows/process.rb +3 -3
  273. data/lib/puppet/util/windows/security.rb +7 -7
  274. data/lib/puppet/util/windows/user.rb +65 -2
  275. data/lib/puppet/util/zaml.rb +90 -46
  276. data/lib/puppet/version.rb +1 -1
  277. data/spec/fixtures/hiera.yaml +9 -0
  278. data/spec/fixtures/manifests/site.pp +0 -0
  279. data/spec/integration/defaults_spec.rb +25 -11
  280. data/spec/integration/faces/ca_spec.rb +11 -16
  281. data/spec/integration/network/server/webrick_spec.rb +14 -27
  282. data/spec/integration/node_spec.rb +4 -1
  283. data/spec/integration/parser/functions/require_spec.rb +3 -3
  284. data/spec/integration/parser/undef_param_spec.rb +88 -0
  285. data/spec/integration/provider/mount_spec.rb +4 -1
  286. data/spec/integration/ssl/certificate_authority_spec.rb +18 -0
  287. data/spec/lib/puppet_spec/files.rb +3 -3
  288. data/spec/lib/puppet_spec/settings.rb +0 -1
  289. data/spec/shared_contexts/platform.rb +8 -0
  290. data/spec/spec_helper.rb +6 -0
  291. data/spec/unit/agent/locker_spec.rb +8 -2
  292. data/spec/unit/application/agent_spec.rb +29 -7
  293. data/spec/unit/application/apply_spec.rb +1 -1
  294. data/spec/unit/application/device_spec.rb +18 -1
  295. data/spec/unit/application/face_base_spec.rb +16 -2
  296. data/spec/unit/application/kick_spec.rb +8 -0
  297. data/spec/unit/application/queue_spec.rb +5 -0
  298. data/spec/unit/application_spec.rb +13 -23
  299. data/spec/unit/configurer/downloader_spec.rb +2 -11
  300. data/spec/unit/configurer_spec.rb +6 -0
  301. data/spec/unit/face/node_spec.rb +1 -1
  302. data/spec/unit/hiera/backend/puppet_backend_spec.rb +140 -0
  303. data/spec/unit/hiera/scope_spec.rb +62 -0
  304. data/spec/unit/hiera_puppet_spec.rb +111 -0
  305. data/spec/unit/indirector/catalog/active_record_spec.rb +4 -0
  306. data/spec/unit/indirector/catalog/static_compiler_spec.rb +194 -0
  307. data/spec/unit/indirector/certificate/disabled_ca_spec.rb +33 -0
  308. data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +33 -0
  309. data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +33 -0
  310. data/spec/unit/indirector/facts/active_record_spec.rb +37 -26
  311. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +5 -0
  312. data/spec/unit/indirector/hiera_spec.rb +2 -1
  313. data/spec/unit/indirector/key/disabled_ca_spec.rb +33 -0
  314. data/spec/unit/indirector/node/active_record_spec.rb +7 -0
  315. data/spec/unit/indirector/request_spec.rb +22 -0
  316. data/spec/unit/indirector/resource/active_record_spec.rb +5 -0
  317. data/spec/unit/module_tool/application_spec.rb +1 -1
  318. data/spec/unit/network/authentication_spec.rb +86 -0
  319. data/spec/unit/network/http/connection_spec.rb +21 -0
  320. data/spec/unit/network/http/handler_spec.rb +12 -0
  321. data/spec/unit/network/http/rack/rest_spec.rb +7 -0
  322. data/spec/unit/network/http/webrick_spec.rb +11 -26
  323. data/spec/unit/network/server_spec.rb +79 -192
  324. data/spec/unit/node/facts_spec.rb +2 -2
  325. data/spec/unit/parser/ast/vardef_spec.rb +4 -4
  326. data/spec/unit/parser/files_spec.rb +3 -0
  327. data/spec/unit/parser/functions/defined_spec.rb +5 -5
  328. data/spec/unit/parser/functions/fqdn_rand_spec.rb +1 -1
  329. data/spec/unit/parser/functions/hiera_array_spec.rb +23 -0
  330. data/spec/unit/parser/functions/hiera_hash_spec.rb +19 -0
  331. data/spec/unit/parser/functions/hiera_include_spec.rb +19 -0
  332. data/spec/unit/parser/functions/hiera_spec.rb +21 -0
  333. data/spec/unit/parser/functions/include_spec.rb +3 -3
  334. data/spec/unit/parser/functions/realize_spec.rb +3 -3
  335. data/spec/unit/parser/functions/require_spec.rb +5 -5
  336. data/spec/unit/parser/functions/shellquote_spec.rb +0 -4
  337. data/spec/unit/parser/functions_spec.rb +6 -10
  338. data/spec/unit/parser/lexer_spec.rb +13 -0
  339. data/spec/unit/parser/scope_spec.rb +16 -1
  340. data/spec/unit/provider/exec/posix_spec.rb +7 -6
  341. data/spec/unit/provider/group/groupadd_spec.rb +36 -30
  342. data/spec/unit/provider/package/pkg_spec.rb +16 -2
  343. data/spec/unit/provider/service/redhat_spec.rb +2 -2
  344. data/spec/unit/provider/sshkey/parsed_spec.rb +4 -0
  345. data/spec/unit/provider/user/user_role_add_spec.rb +125 -126
  346. data/spec/unit/provider/user/useradd_spec.rb +147 -118
  347. data/spec/unit/provider/user/windows_adsi_spec.rb +22 -0
  348. data/spec/unit/provider/zone/solaris_spec.rb +126 -7
  349. data/spec/unit/provider/zpool/zpool_spec.rb +4 -3
  350. data/spec/unit/puppet_spec.rb +7 -0
  351. data/spec/unit/settings/duration_setting_spec.rb +45 -0
  352. data/spec/unit/settings/terminus_setting_spec.rb +28 -0
  353. data/spec/unit/settings_spec.rb +21 -23
  354. data/spec/unit/ssl/base_spec.rb +68 -19
  355. data/spec/unit/ssl/certificate_authority/interface_spec.rb +19 -30
  356. data/spec/unit/ssl/certificate_authority_spec.rb +3 -2
  357. data/spec/unit/ssl/certificate_factory_spec.rb +15 -6
  358. data/spec/unit/ssl/certificate_request_spec.rb +80 -113
  359. data/spec/unit/ssl/certificate_revocation_list_spec.rb +1 -1
  360. data/spec/unit/ssl/certificate_spec.rb +26 -2
  361. data/spec/unit/ssl/digest_spec.rb +35 -0
  362. data/spec/unit/ssl/host_spec.rb +73 -27
  363. data/spec/unit/ssl/key_spec.rb +0 -4
  364. data/spec/unit/type/exec_spec.rb +1 -1
  365. data/spec/unit/type/file_spec.rb +2 -1
  366. data/spec/unit/type/scheduled_task_spec.rb +2 -2
  367. data/spec/unit/type/zone_spec.rb +52 -10
  368. data/spec/unit/util/adsi_spec.rb +19 -0
  369. data/spec/unit/util/checksums_spec.rb +2 -3
  370. data/spec/unit/util/execution_spec.rb +1 -1
  371. data/spec/unit/util/log/destinations_spec.rb +1 -0
  372. data/spec/unit/util/log/rate_limited_logger_spec.rb +51 -0
  373. data/spec/unit/util/logging_spec.rb +6 -6
  374. data/spec/unit/util/selinux_spec.rb +24 -32
  375. data/spec/unit/util/zaml_spec.rb +94 -6
  376. data/spec/unit/util_spec.rb +17 -0
  377. data/spec/watchr.rb +2 -6
  378. data/tasks/{rake/manpages.rake → manpages.rake} +0 -0
  379. data/tasks/{rake/parser.rake → parser.rake} +0 -0
  380. metadata +1003 -119
  381. data/CHANGELOG +0 -9233
  382. data/conf/osx/preflight +0 -24
  383. data/lib/puppet/network/http/mongrel.rb +0 -35
  384. data/lib/puppet/util/config_timeout.rb +0 -24
  385. data/spec/unit/network/http/mongrel/rest_spec.rb +0 -257
  386. data/spec/unit/network/http/mongrel_spec.rb +0 -91
  387. data/spec/unit/network/http_spec.rb +0 -31
  388. data/spec/unit/util/config_timeout_spec.rb +0 -57
  389. data/tasks/rake/apple.rake +0 -176
  390. data/tasks/rake/changelog.rake +0 -15
  391. data/tasks/rake/ci.rake +0 -22
  392. data/tasks/rake/dailybuild.rake +0 -9
  393. data/tasks/rake/gem.rake +0 -63
  394. data/tasks/rake/git_workflow.rake +0 -134
  395. data/tasks/rake/metrics.rake +0 -14
  396. data/tasks/rake/sign.rake +0 -14
  397. data/tasks/rake/testbranch.rake +0 -16
  398. data/tasks/rake/yard.rake +0 -11
@@ -56,10 +56,11 @@ describe Puppet::Type.type(:package).provider(:pkg) do
56
56
  {
57
57
  'spkg 0.0.7 i--' => {:name => 'spkg', :ensure => '0.0.7', :status => 'installed', :provider => :pkg},
58
58
  'spkg (me) 0.0.7 i--' => {:name => 'spkg', :ensure => '0.0.7', :status => 'installed', :provider => :pkg, :publisher => 'me'},
59
+ 'spkg (me) 0.0.7 if-' => {:name => 'spkg', :ensure => 'held', :status => 'installed', :provider => :pkg, :publisher => 'me'},
59
60
  'spkg 0.0.7 installed -----' => {:name => 'spkg', :ensure => '0.0.7', :status => 'installed', :provider => :pkg},
60
- 'spkg (me) 0.0.7 installed' => {:name => 'spkg', :ensure => '0.0.7', :status => 'installed', :provider => :pkg, :publisher => 'me'},
61
+ 'spkg (me) 0.0.7 installed -----' => {:name => 'spkg', :ensure => '0.0.7', :status => 'installed', :provider => :pkg, :publisher => 'me'},
61
62
  }.each do |k, v|
62
- it "should correctly parse" do
63
+ it "[#{k}] should correctly parse" do
63
64
  described_class.parse_line(k).should == v
64
65
  end
65
66
  end
@@ -172,6 +173,7 @@ describe Puppet::Type.type(:package).provider(:pkg) do
172
173
  context ":install" do
173
174
  it "should accept all licenses" do
174
175
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '--accept', 'dummy'], {:failonfail => false, :combine => true}).returns ''
176
+ Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}).returns ''
175
177
  $CHILD_STATUS.stubs(:exitstatus).returns 0
176
178
  provider.install
177
179
  end
@@ -180,12 +182,14 @@ describe Puppet::Type.type(:package).provider(:pkg) do
180
182
  # Should install also check if the version installed is the same version we are asked to install? or should we rely on puppet for that?
181
183
  resource[:ensure] = '0.0.7'
182
184
  $CHILD_STATUS.stubs(:exitstatus).returns 0
185
+ Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
183
186
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-H', 'dummy'], {:failonfail => false, :combine => true}).returns 'dummy 0.0.6 installed -----'
184
187
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '--accept', 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
185
188
  provider.install
186
189
  end
187
190
  it "should install specific version(2)" do
188
191
  resource[:ensure] = '0.0.8'
192
+ Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
189
193
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-H', 'dummy'], {:failonfail => false, :combine => true}).returns 'dummy 0.0.7 installed -----'
190
194
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '--accept', 'dummy@0.0.8'], {:failonfail => false, :combine => true}).returns ''
191
195
  $CHILD_STATUS.stubs(:exitstatus).returns 0
@@ -196,12 +200,22 @@ describe Puppet::Type.type(:package).provider(:pkg) do
196
200
  provider.expects(:query).with().returns({:ensure => '0.0.8'})
197
201
  provider.expects(:uninstall).with()
198
202
  $CHILD_STATUS.stubs(:exitstatus).returns 0
203
+ Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
199
204
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '--accept', 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
200
205
  provider.install
201
206
  end
202
207
  it "should install any if version is not specified" do
203
208
  resource[:ensure] = :present
204
209
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '--accept', 'dummy'], {:failonfail => false, :combine => true}).returns ''
210
+ Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
211
+ $CHILD_STATUS.stubs(:exitstatus).returns 0
212
+ provider.install
213
+ end
214
+ it "should install if no version was previously installed, and a specific version was requested" do
215
+ resource[:ensure] = '0.0.7'
216
+ provider.expects(:query).with().returns({:ensure => :absent})
217
+ Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
218
+ Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '--accept', 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
205
219
  $CHILD_STATUS.stubs(:exitstatus).returns 0
206
220
  provider.install
207
221
  end
@@ -54,8 +54,8 @@ describe provider_class, :as_platform => :posix do
54
54
  end
55
55
  end
56
56
 
57
- it "(#15797) should use 'reset' instead of 'on' when calling enable" do
58
- provider_class.expects(:chkconfig).with(@resource[:name], :reset)
57
+ it "(#15797) should use 'on' when calling enable" do
58
+ provider_class.expects(:chkconfig).with(@resource[:name], :on)
59
59
  @provider.enable
60
60
  end
61
61
 
@@ -8,6 +8,10 @@ describe "sshkey parsed provider" do
8
8
  let :provider do type.provider(:parsed) end
9
9
  subject { provider }
10
10
 
11
+ after :each do
12
+ subject.clear
13
+ end
14
+
11
15
  def key
12
16
  'AAAAB3NzaC1yc2EAAAABIwAAAQEAzwHhxXvIrtfIwrudFqc8yQcIfMudrgpnuh1F3AV6d2BrLgu/yQE7W5UyJMUjfj427sQudRwKW45O0Jsnr33F4mUw+GIMlAAmp9g24/OcrTiB8ZUKIjoPy/cO4coxGi8/NECtRzpD/ZUPFh6OEpyOwJPMb7/EC2Az6Otw4StHdXUYw22zHazBcPFnv6zCgPx1hA7QlQDWTu4YcL0WmTYQCtMUb3FUqrcFtzGDD0ytosgwSd+JyN5vj5UwIABjnNOHPZ62EY1OFixnfqX/+dUwrFSs5tPgBF/KkC6R7tmbUfnBON6RrGEmu+ajOTOLy23qUZB4CQ53V7nyAWhzqSK+hw=='
13
17
  end
@@ -2,257 +2,256 @@ require 'spec_helper'
2
2
  require 'puppet_spec/files'
3
3
  require 'tempfile'
4
4
 
5
- provider_class = Puppet::Type.type(:user).provider(:user_role_add)
6
-
7
- describe provider_class, :unless => Puppet.features.microsoft_windows? do
5
+ describe Puppet::Type.type(:user).provider(:user_role_add), :unless => Puppet.features.microsoft_windows? do
8
6
  include PuppetSpec::Files
7
+ let(:resource) { Puppet::Type.type(:user).new(:name => 'myuser', :managehome => false, :allowdupe => false) }
8
+ let(:provider) { described_class.new(resource) }
9
9
 
10
10
  before do
11
- @resource = stub("resource", :name => "myuser", :managehome? => nil)
12
-
13
- @resource.stubs(:should).returns "fakeval"
14
- @resource.stubs(:should).with(:keys).returns Hash.new
15
- @resource.stubs(:[]).returns "fakeval"
16
-
17
- @resource.stubs(:allowdupe?).returns false
18
- @provider = provider_class.new(@resource)
11
+ resource.stubs(:should).returns "fakeval"
12
+ resource.stubs(:should).with(:keys).returns Hash.new
13
+ resource.stubs(:[]).returns "fakeval"
19
14
  end
20
15
 
21
- describe "when calling command" do
16
+
17
+ describe "#command" do
22
18
  before do
23
19
  klass = stub("provider")
24
20
  klass.stubs(:command).with(:foo).returns("userfoo")
25
21
  klass.stubs(:command).with(:role_foo).returns("rolefoo")
26
- @provider.stubs(:class).returns(klass)
22
+ provider.stubs(:class).returns(klass)
27
23
  end
28
24
 
29
25
  it "should use the command if not a role and ensure!=role" do
30
- @provider.stubs(:is_role?).returns(false)
31
- @provider.stubs(:exists?).returns(false)
32
- @resource.stubs(:[]).with(:ensure).returns(:present)
33
- @provider.command(:foo).should == "userfoo"
26
+ provider.stubs(:is_role?).returns(false)
27
+ provider.stubs(:exists?).returns(false)
28
+ resource.stubs(:[]).with(:ensure).returns(:present)
29
+ provider.class.stubs(:foo)
30
+ provider.command(:foo).should == "userfoo"
34
31
  end
35
32
 
36
33
  it "should use the role command when a role" do
37
- @provider.stubs(:is_role?).returns(true)
38
- @provider.command(:foo).should == "rolefoo"
34
+ provider.stubs(:is_role?).returns(true)
35
+ provider.command(:foo).should == "rolefoo"
39
36
  end
40
37
 
41
38
  it "should use the role command when !exists and ensure=role" do
42
- @provider.stubs(:is_role?).returns(false)
43
- @provider.stubs(:exists?).returns(false)
44
- @resource.stubs(:[]).with(:ensure).returns(:role)
45
- @provider.command(:foo).should == "rolefoo"
39
+ provider.stubs(:is_role?).returns(false)
40
+ provider.stubs(:exists?).returns(false)
41
+ resource.stubs(:[]).with(:ensure).returns(:role)
42
+ provider.command(:foo).should == "rolefoo"
46
43
  end
47
44
  end
48
45
 
49
- describe "when calling transition" do
46
+ describe "#transition" do
50
47
  it "should return the type set to whatever is passed in" do
51
- @provider.expects(:command).with(:modify).returns("foomod")
52
- @provider.transition("bar").include?("type=bar")
48
+ provider.expects(:command).with(:modify).returns("foomod")
49
+ provider.transition("bar").include?("type=bar")
53
50
  end
54
51
  end
55
52
 
56
- describe "when calling create" do
53
+ describe "#create" do
57
54
  before do
58
- @provider.stubs(:password=)
55
+ provider.stubs(:password=)
59
56
  end
60
57
 
61
58
  it "should use the add command when the user is not a role" do
62
- @provider.stubs(:is_role?).returns(false)
63
- @provider.expects(:addcmd).returns("useradd")
64
- @provider.expects(:run).at_least_once
65
- @provider.create
59
+ provider.stubs(:is_role?).returns(false)
60
+ provider.expects(:addcmd).returns("useradd")
61
+ provider.expects(:run).at_least_once
62
+ provider.create
66
63
  end
67
64
 
68
65
  it "should use transition(normal) when the user is a role" do
69
- @provider.stubs(:is_role?).returns(true)
70
- @provider.expects(:transition).with("normal")
71
- @provider.expects(:run)
72
- @provider.create
66
+ provider.stubs(:is_role?).returns(true)
67
+ provider.expects(:transition).with("normal")
68
+ provider.expects(:run)
69
+ provider.create
73
70
  end
74
71
 
75
72
  it "should set password age rules" do
76
- @resource = Puppet::Type.type(:user).new :name => "myuser", :password_min_age => 5, :password_max_age => 10, :provider => :user_role_add
77
- @provider = provider_class.new(@resource)
78
- @provider.stubs(:user_attributes)
79
- @provider.stubs(:execute)
80
- @provider.expects(:execute).with { |cmd, *args| args == ["-n", 5, "-x", 10, "myuser"] }
81
- @provider.create
73
+ resource = Puppet::Type.type(:user).new :name => "myuser", :password_min_age => 5, :password_max_age => 10, :provider => :user_role_add
74
+ provider = described_class.new(resource)
75
+ provider.stubs(:user_attributes)
76
+ provider.stubs(:execute)
77
+ provider.expects(:execute).with { |cmd, *args| args == ["-n", 5, "-x", 10, "myuser"] }
78
+ provider.create
82
79
  end
83
80
  end
84
81
 
85
- describe "when calling destroy" do
82
+ describe "#destroy" do
86
83
  it "should use the delete command if the user exists and is not a role" do
87
- @provider.stubs(:exists?).returns(true)
88
- @provider.stubs(:is_role?).returns(false)
89
- @provider.expects(:deletecmd)
90
- @provider.expects(:run)
91
- @provider.destroy
84
+ provider.stubs(:exists?).returns(true)
85
+ provider.stubs(:is_role?).returns(false)
86
+ provider.expects(:deletecmd)
87
+ provider.expects(:run)
88
+ provider.destroy
92
89
  end
93
90
 
94
91
  it "should use the delete command if the user is a role" do
95
- @provider.stubs(:exists?).returns(true)
96
- @provider.stubs(:is_role?).returns(true)
97
- @provider.expects(:deletecmd)
98
- @provider.expects(:run)
99
- @provider.destroy
92
+ provider.stubs(:exists?).returns(true)
93
+ provider.stubs(:is_role?).returns(true)
94
+ provider.expects(:deletecmd)
95
+ provider.expects(:run)
96
+ provider.destroy
100
97
  end
101
98
  end
102
99
 
103
- describe "when calling create_role" do
100
+ describe "#create_role" do
104
101
  it "should use the transition(role) if the user exists" do
105
- @provider.stubs(:exists?).returns(true)
106
- @provider.stubs(:is_role?).returns(false)
107
- @provider.expects(:transition).with("role")
108
- @provider.expects(:run)
109
- @provider.create_role
102
+ provider.stubs(:exists?).returns(true)
103
+ provider.stubs(:is_role?).returns(false)
104
+ provider.expects(:transition).with("role")
105
+ provider.expects(:run)
106
+ provider.create_role
110
107
  end
111
108
 
112
109
  it "should use the add command when role doesn't exists" do
113
- @provider.stubs(:exists?).returns(false)
114
- @provider.expects(:addcmd)
115
- @provider.expects(:run)
116
- @provider.create_role
110
+ provider.stubs(:exists?).returns(false)
111
+ provider.expects(:addcmd)
112
+ provider.expects(:run)
113
+ provider.create_role
117
114
  end
118
115
  end
119
116
 
120
- describe "when allow duplicate is enabled" do
117
+ describe "with :allow_duplicates" do
121
118
  before do
122
- @resource.expects(:allowdupe?).returns true
123
- @resource.stubs(:system?)
124
- @provider.stubs(:is_role?).returns(false)
125
- @provider.stubs(:execute)
126
- @provider.expects(:execute).with { |args| args.include?("-o") }
119
+ resource.expects(:allowdupe?).returns true
120
+ provider.stubs(:is_role?).returns(false)
121
+ provider.stubs(:execute)
122
+ resource.stubs(:system?).returns false
123
+ provider.expects(:execute).with { |args| args.include?("-o") }
127
124
  end
128
125
 
129
126
  it "should add -o when the user is being created" do
130
- @provider.stubs(:password=)
131
- @provider.create
127
+ provider.stubs(:password=)
128
+ provider.create
132
129
  end
133
130
 
134
131
  it "should add -o when the uid is being modified" do
135
- @provider.uid = 150
132
+ provider.uid = 150
136
133
  end
137
134
  end
138
135
 
139
136
  [:roles, :auths, :profiles].each do |val|
140
- describe "when getting #{val}" do
141
- it "should get the user_attributes" do
142
- @provider.expects(:user_attributes)
143
- @provider.send(val)
144
- end
145
-
146
- it "should get the #{val} attribute" do
147
- attributes = mock("attributes")
148
- attributes.expects(:[]).with(val)
149
- @provider.stubs(:user_attributes).returns(attributes)
150
- @provider.send(val)
137
+ context "#send" do
138
+ describe "when getting #{val}" do
139
+ it "should get the user_attributes" do
140
+ provider.expects(:user_attributes)
141
+ provider.send(val)
142
+ end
143
+
144
+ it "should get the #{val} attribute" do
145
+ attributes = mock("attributes")
146
+ attributes.expects(:[]).with(val)
147
+ provider.stubs(:user_attributes).returns(attributes)
148
+ provider.send(val)
149
+ end
151
150
  end
152
151
  end
153
152
  end
154
153
 
155
- describe "when getting the keys" do
154
+ describe "#keys" do
156
155
  it "should get the user_attributes" do
157
- @provider.expects(:user_attributes)
158
- @provider.keys
156
+ provider.expects(:user_attributes)
157
+ provider.keys
159
158
  end
160
159
 
161
160
  it "should call removed_managed_attributes" do
162
- @provider.stubs(:user_attributes).returns({ :type => "normal", :foo => "something" })
163
- @provider.expects(:remove_managed_attributes)
164
- @provider.keys
161
+ provider.stubs(:user_attributes).returns({ :type => "normal", :foo => "something" })
162
+ provider.expects(:remove_managed_attributes)
163
+ provider.keys
165
164
  end
166
165
 
167
166
  it "should removed managed attribute (type, auths, roles, etc)" do
168
- @provider.stubs(:user_attributes).returns({ :type => "normal", :foo => "something" })
169
- @provider.keys.should == { :foo => "something" }
167
+ provider.stubs(:user_attributes).returns({ :type => "normal", :foo => "something" })
168
+ provider.keys.should == { :foo => "something" }
170
169
  end
171
170
  end
172
171
 
173
- describe "when adding properties" do
172
+ describe "#add_properties" do
174
173
  it "should call build_keys_cmd" do
175
- @resource.stubs(:should).returns ""
176
- @resource.expects(:should).with(:keys).returns({ :foo => "bar" })
177
- @provider.expects(:build_keys_cmd).returns([])
178
- @provider.add_properties
174
+ resource.stubs(:should).returns ""
175
+ resource.expects(:should).with(:keys).returns({ :foo => "bar" })
176
+ provider.expects(:build_keys_cmd).returns([])
177
+ provider.add_properties
179
178
  end
180
179
 
181
180
  it "should add the elements of the keys hash to an array" do
182
- @resource.stubs(:should).returns ""
183
- @resource.expects(:should).with(:keys).returns({ :foo => "bar"})
184
- @provider.add_properties.must == ["-K", "foo=bar"]
181
+ resource.stubs(:should).returns ""
182
+ resource.expects(:should).with(:keys).returns({ :foo => "bar"})
183
+ provider.add_properties.must == ["-K", "foo=bar"]
185
184
  end
186
185
  end
187
186
 
188
- describe "when calling build_keys_cmd" do
187
+ describe "#build_keys_cmd" do
189
188
  it "should build cmd array with keypairs seperated by -K ending with user" do
190
- @provider.build_keys_cmd({"foo" => "bar", "baz" => "boo"}).should.eql? ["-K", "foo=bar", "-K", "baz=boo"]
189
+ provider.build_keys_cmd({"foo" => "bar", "baz" => "boo"}).should.eql? ["-K", "foo=bar", "-K", "baz=boo"]
191
190
  end
192
191
  end
193
192
 
194
- describe "when setting the keys" do
193
+ describe "#keys=" do
195
194
  before do
196
- @provider.stubs(:is_role?).returns(false)
195
+ provider.stubs(:is_role?).returns(false)
197
196
  end
198
197
 
199
198
  it "should run a command" do
200
- @provider.expects(:run)
201
- @provider.keys=({})
199
+ provider.expects(:run)
200
+ provider.keys=({})
202
201
  end
203
202
 
204
203
  it "should build the command" do
205
- @resource.stubs(:[]).with(:name).returns("someuser")
206
- @provider.stubs(:command).returns("usermod")
207
- @provider.expects(:build_keys_cmd).returns(["-K", "foo=bar"])
208
- @provider.expects(:run).with(["usermod", "-K", "foo=bar", "someuser"], "modify attribute key pairs")
209
- @provider.keys=({})
204
+ resource.stubs(:[]).with(:name).returns("someuser")
205
+ provider.stubs(:command).returns("usermod")
206
+ provider.expects(:build_keys_cmd).returns(["-K", "foo=bar"])
207
+ provider.expects(:run).with(["usermod", "-K", "foo=bar", "someuser"], "modify attribute key pairs")
208
+ provider.keys=({})
210
209
  end
211
210
  end
212
211
 
213
- describe "when getting the hashed password" do
212
+ describe "#password" do
214
213
  before do
215
214
  @array = mock "array"
216
215
  end
217
216
 
218
217
  it "should readlines of /etc/shadow" do
219
218
  File.expects(:readlines).with("/etc/shadow").returns([])
220
- @provider.password
219
+ provider.password
221
220
  end
222
221
 
223
222
  it "should reject anything that doesn't start with alpha numerics" do
224
223
  @array.expects(:reject).returns([])
225
224
  File.stubs(:readlines).with("/etc/shadow").returns(@array)
226
- @provider.password
225
+ provider.password
227
226
  end
228
227
 
229
228
  it "should collect splitting on ':'" do
230
229
  @array.stubs(:reject).returns(@array)
231
230
  @array.expects(:collect).returns([])
232
231
  File.stubs(:readlines).with("/etc/shadow").returns(@array)
233
- @provider.password
232
+ provider.password
234
233
  end
235
234
 
236
235
  it "should find the matching user" do
237
- @resource.stubs(:[]).with(:name).returns("username")
236
+ resource.stubs(:[]).with(:name).returns("username")
238
237
  @array.stubs(:reject).returns(@array)
239
238
  @array.stubs(:collect).returns([["username", "hashedpassword"], ["someoneelse", "theirpassword"]])
240
239
  File.stubs(:readlines).with("/etc/shadow").returns(@array)
241
- @provider.password.must == "hashedpassword"
240
+ provider.password.must == "hashedpassword"
242
241
  end
243
242
 
244
243
  it "should get the right password" do
245
- @resource.stubs(:[]).with(:name).returns("username")
244
+ resource.stubs(:[]).with(:name).returns("username")
246
245
  File.stubs(:readlines).with("/etc/shadow").returns(["#comment", " nonsense", " ", "username:hashedpassword:stuff:foo:bar:::", "other:pword:yay:::"])
247
- @provider.password.must == "hashedpassword"
246
+ provider.password.must == "hashedpassword"
248
247
  end
249
248
  end
250
249
 
251
- describe "when setting the password" do
250
+ describe "#password=" do
252
251
  let(:path) { tmpfile('etc-shadow') }
253
252
 
254
253
  before :each do
255
- @provider.stubs(:target_file_path).returns(path)
254
+ provider.stubs(:target_file_path).returns(path)
256
255
  end
257
256
 
258
257
  def write_fixture(content)
@@ -263,7 +262,7 @@ describe provider_class, :unless => Puppet.features.microsoft_windows? do
263
262
  write_fixture <<FIXTURE
264
263
  fakeval:seriously:15315:0:99999:7:::
265
264
  FIXTURE
266
- @provider.password = "totally"
265
+ provider.password = "totally"
267
266
  File.read(path).should =~ /^fakeval:totally:/
268
267
  end
269
268
 
@@ -274,7 +273,7 @@ fakeval:seriously:15315:0:99999:7:::
274
273
  fakevalish:seriously:15315:0:99999:7:::
275
274
  after:seriously:15315:0:99999:7:::
276
275
  FIXTURE
277
- @provider.password = "totally"
276
+ provider.password = "totally"
278
277
  File.read(path).should == <<EOT
279
278
  before:seriously:15315:0:99999:7:::
280
279
  fakeval:totally:15315:0:99999:7:::
@@ -292,7 +291,7 @@ after:seriously:15315:0:99999:7:::
292
291
  FIXTURE
293
292
 
294
293
  write_fixture fixture
295
- @provider.password = "totally"
294
+ provider.password = "totally"
296
295
  File.read(path).should == fixture
297
296
  end
298
297
  end
@@ -300,19 +299,19 @@ FIXTURE
300
299
  describe "#shadow_entry" do
301
300
  it "should return the line for the right user" do
302
301
  File.stubs(:readlines).returns(["someuser:!:10:5:20:7:1::\n", "fakeval:*:20:10:30:7:2::\n", "testuser:*:30:15:40:7:3::\n"])
303
- @provider.shadow_entry.should == ["fakeval", "*", "20", "10", "30", "7", "2"]
302
+ provider.shadow_entry.should == ["fakeval", "*", "20", "10", "30", "7", "2"]
304
303
  end
305
304
  end
306
305
 
307
306
  describe "#password_max_age" do
308
307
  it "should return a maximum age number" do
309
308
  File.stubs(:readlines).returns(["fakeval:NP:12345:0:50::::\n"])
310
- @provider.password_max_age.should == "50"
309
+ provider.password_max_age.should == "50"
311
310
  end
312
311
 
313
312
  it "should return -1 for no maximum" do
314
313
  File.stubs(:readlines).returns(["fakeval:NP:12345::::::\n"])
315
- @provider.password_max_age.should == -1
314
+ provider.password_max_age.should == -1
316
315
  end
317
316
  end
318
317
  end