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
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/make -f
2
+
3
+ LIBDIR=$(shell /usr/bin/ruby18 -rrbconfig -e 'puts Config::CONFIG["rubylibdir"]')
4
+ DESTDIR=$(CURDIR)/pkg/ips/proto
5
+
6
+ binary-install/puppet::
7
+ /usr/bin/ruby18 install.rb --destdir=$(DESTDIR) --bindir=/usr/bin --sbindir=/usr/sbin --sitelibdir=$(LIBDIR) --mandir=/usr/share/man
8
+ mkdir -p $(DESTDIR)/var/{lib,log}/puppet/
9
+ mkdir -p $(DESTDIR)/var/svc/manifest/network/puppet/
10
+ mkdir -p $(DESTDIR)/lib/svc/method/
11
+ mkdir -p $(DESTDIR)/etc/puppet/
12
+ svccfg validate ext/ips/puppetagent.xml
13
+ svccfg validate ext/ips/puppetmaster.xml
14
+ cp ext/ips/puppetagent.xml $(DESTDIR)/var/svc/manifest/network/puppet/
15
+ cp ext/ips/puppetmaster.xml $(DESTDIR)/var/svc/manifest/network/puppet/
16
+ cp ext/ips/puppet-agent $(DESTDIR)/lib/svc/method/
17
+ cp ext/ips/puppet-master $(DESTDIR)/lib/svc/method/
18
+ cp ext/ips/puppet.conf $(DESTDIR)/etc/puppet/puppet.conf
19
+ chmod 700 $(DESTDIR)/lib/svc/method/puppet-{agent,master}
@@ -0,0 +1,34 @@
1
+ <transform file dir link hardlink path=usr/share/man/.+(/.+)? -> default facet.doc.man true>
2
+ <transform file path=usr/share/man/.+(/.+)? -> add restart_fmri svc:/application/man-index:default>
3
+
4
+ # drop opt and user
5
+ <transform dir path=(lib|etc|usr|var)$->drop>
6
+ <transform dir path=usr/(share|ruby)$->drop>
7
+ <transform dir path=usr/share/man$->drop>
8
+ <transform dir path=usr/ruby/1.8$->drop>
9
+ <transform dir path=usr/ruby/1.8/lib$->drop>
10
+ <transform dir path=usr/ruby/1.8/ruby$->drop>
11
+ <transform dir path=usr/ruby/1.8/ruby/1.8$->drop>
12
+ <transform dir path=(var|lib)/svc$->drop>
13
+ <transform dir path=lib/svc/method$->drop>
14
+ <transform dir path=var/svc/manifest$->drop>
15
+ <transform dir path=var/svc/manifest/network$->drop>
16
+
17
+ # drop var/lib var/log
18
+ <transform dir path=var/(lib|log)$->drop>
19
+
20
+ # saner dependencies
21
+ <transform depend -> edit fmri "@[^ \t\n\r\f\v]*" "">
22
+
23
+ # make sure /var/log/puppet and /var/lib/puppet are owned by puppet
24
+ <transform dir path=var/(log|lib)/puppet$ -> edit group bin puppet>
25
+ <transform dir path=var/(log|lib)/puppet$ -> edit owner root puppet>
26
+
27
+ <transform file path=var/svc/manifest/.*\.xml -> add restart_fmri svc:/system/manifest-import:default>
28
+
29
+ # we depend on facter
30
+ <transform pkg -> emit depend type=require fmri=application/facter@1.6.12>
31
+
32
+ # preserve the old conf file on upgrade.
33
+ <transform file path=etc/puppet/(puppet|auth).conf -> add overlay true>
34
+ <transform file path=etc/puppet/(puppet|auth).conf -> add preserve renamenew>
File without changes
@@ -60,7 +60,7 @@ function install_docs() {
60
60
  echo "Installing docs to ${pkgroot}"
61
61
  docdir="${pkgroot}/usr/share/doc/puppet"
62
62
  mkdir -p "${docdir}"
63
- for docfile in CHANGELOG CHANGELOG.old COPYING LICENSE README README.queueing README.rst; do
63
+ for docfile in COPYING LICENSE README README.queueing README.rst; do
64
64
  install -m 0644 "${puppet_root}/${docfile}" "${docdir}"
65
65
  done
66
66
  chown -R root:wheel "${docdir}"
@@ -0,0 +1,33 @@
1
+ directories:
2
+ lib:
3
+ path: 'usr/lib/ruby/site_ruby/1.8'
4
+ owner: 'root'
5
+ group: 'wheel'
6
+ perms: '0644'
7
+ bin:
8
+ path: 'usr/bin'
9
+ owner: 'root'
10
+ group: 'wheel'
11
+ perms: '0755'
12
+ 'man/man8':
13
+ path: 'usr/share/man/man8'
14
+ owner: 'root'
15
+ group: 'wheel'
16
+ perms: '0755'
17
+ files:
18
+ 'conf/auth.conf':
19
+ path: 'private/etc/puppet'
20
+ owner: 'root'
21
+ group: 'wheel'
22
+ perms: '0644'
23
+ 'man/man5/puppet.conf.5':
24
+ path: 'usr/share/man/man5'
25
+ owner: 'root'
26
+ group: 'wheel'
27
+ perms: '0644'
28
+ '[A-Z]*':
29
+ path: 'usr/share/doc/puppet'
30
+ owner: 'root'
31
+ group: 'wheel'
32
+ perms: '0644'
33
+
@@ -0,0 +1,37 @@
1
+ #!/bin/bash
2
+ #
3
+ # Make sure that old puppet cruft is removed
4
+ # This also allows us to downgrade puppet as
5
+ # it's more likely that installing old versions
6
+ # over new will cause issues.
7
+ #
8
+ # ${3} is the destination volume so that this works correctly
9
+ # when being installed to volumes other than the current OS.
10
+
11
+ <% begin %>
12
+ <% require 'rubygems' %>
13
+ <% rescue LoadError %>
14
+ <% end %>
15
+ <% require 'rake' %>
16
+
17
+ <% Dir.chdir("lib") %>
18
+ <% FileList["**/*"].select {|i| File.file?(i)}.each do |file| %>
19
+ /bin/rm -Rf "${3}<%= @apple_libdir %>/<%=file%>"
20
+ <% end %>
21
+
22
+ <% Dir.chdir("../bin") %>
23
+ <% FileList["**/*"].select {|i| File.file?(i)}.each do |file| %>
24
+ /bin/rm -Rf "${3}<%= @apple_bindir %>/<%=file%>"
25
+ <% end %>
26
+ <% Dir.chdir("..") %>
27
+
28
+ # remove old doc files
29
+ /bin/rm -Rf "${3}<%= @apple_docdir %>/<%= @package_name %>"
30
+
31
+ # These files used to live in the sbindir but were
32
+ # removed in Pupppet >= 3.0. Remove them
33
+ /bin/rm -Rf "${3}<%= @apple_sbindir %>/puppetca"
34
+ /bin/rm -Rf "${3}<%= @apple_sbindir %>/puppetd"
35
+ /bin/rm -Rf "${3}<%= @apple_sbindir %>/puppetmasterd"
36
+ /bin/rm -Rf "${3}<%= @apple_sbindir %>/puppetqd"
37
+ /bin/rm -Rf "${3}<%= @apple_sbindir %>/puppetrun"
@@ -0,0 +1,117 @@
1
+ ## Create self signed certificate
2
+
3
+ - Generate the key pair
4
+
5
+ | keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
6
+
7
+
8
+ - Extract Certificate
9
+
10
+ | keytool -export -rfc -keystore keystore.jks -storepass password -alias selfsigned -file mycert.pem
11
+
12
+ - Extract Cert Key to PEM format
13
+
14
+ | keytool -importkeystore -srcstoretype JKS -srckeystore keystore.jks -deststoretype PKCS12 -destkeystore mykey.der
15
+ | openssl pkcs12 -in mykey.der -nodes -out mykey.pem
16
+
17
+ ## For installation.
18
+
19
+ - Check the publishers
20
+
21
+ | pkg publisher
22
+ solaris origin online http://pkg.oracle.com/solaris/release/
23
+
24
+ - Add puppetlabs.com as a publisher
25
+
26
+ | pkg set-publisher -p http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net puppetlabs.com
27
+
28
+ - Check that we have it correct
29
+
30
+ | pkg publisher
31
+ solaris origin online http://pkg.oracle.com/solaris/release/
32
+ puppetlabs.com origin online http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
33
+
34
+ - Verify that puppetlabs.com was set correctly,
35
+
36
+ | pkg publisher puppetlabs.com
37
+ Publisher: puppetlabs.com
38
+ Alias:
39
+ Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
40
+ SSL Key: None
41
+ SSL Cert: None
42
+ Client UUID: 37084c4a-fdc6-11e1-832b-8800273bd610
43
+ Catalog Updated: September 13, 2012 08:31:25 PM
44
+ Enabled: Yes
45
+ Signature Policy: verify
46
+
47
+ - Try installing puppet
48
+
49
+ | pkg install puppet
50
+ Creating Plan |
51
+ pkg install: Chain was rooted in an untrusted self-signed certificate.
52
+ The package involved is:pkg://puppetlabs.com/system/management/puppet@3.0.0,5.11-6.192:20120913T212942Z
53
+
54
+ - We have two choices here, first, to ignore the signature policy for both publisher and image
55
+
56
+ | pkg set-publisher --set-property=signature-policy=ignore puppetlabs.com
57
+ | pkg publisher puppetlabs.com
58
+ Publisher: puppetlabs.com
59
+ Alias:
60
+ Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
61
+ SSL Key: None
62
+ SSL Cert: None
63
+ Client UUID: 140bb5c8-fe62-11e1-af70-8800273bd610
64
+ Catalog Updated: September 14, 2012 05:11:45 PM
65
+ Enabled: Yes
66
+ Signature Policy: ignore
67
+ | pkg set-property signature-policy ignore
68
+ | pkg install puppet
69
+
70
+ - Or trust the self signed certificate from puppetlabs.com (this certificate needs to be published in our web site)
71
+
72
+ | pkg set-publisher --approve-ca-cert /root/mycert.pem puppetlabs.com
73
+
74
+ - Verify that approve cert went well.
75
+
76
+ | pkg publisher puppetlabs.com
77
+
78
+ Publisher: puppetlabs.com
79
+ Alias:
80
+ Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
81
+ SSL Key: None
82
+ SSL Cert: None
83
+ Client UUID: 37084c4a-fdc6-11e1-832b-8800273bd610
84
+ Catalog Updated: September 13, 2012 08:31:25 PM
85
+ Approved CAs: 791b5791a81e9c2eb3fb9f84f4f86f8ea6fcd672
86
+ Enabled: Yes
87
+ Signature Policy: verify
88
+
89
+ | pkg install puppet
90
+
91
+ - Checking about information on the package (See the human readable version string)
92
+
93
+ | pkg info -r puppet
94
+ Name: system/management/puppet
95
+ Summary: Puppet, an automated configuration management tool
96
+ Description: Puppet, an automated configuration management tool
97
+ Category: System/Administration and Configuration
98
+ State: Not installed
99
+ Publisher: puppetlabs.com
100
+ Version: 3.0.0 (3.0.0-rc6)
101
+ Build Release: 5.11
102
+ Branch: 6.170
103
+ Packaging Date: September 14, 2012 06:11:05 PM
104
+ Size: 2.43 MB
105
+ FMRI: pkg://puppetlabs.com/system/management/puppet@3.0.0,5.11-6.170:20120914T181105Z
106
+
107
+ - Check license
108
+
109
+ | pkg info -r --license puppet
110
+ Puppet - Automating Configuration Management.
111
+
112
+ Copyright (C) 2005-2012 Puppet Labs Inc
113
+
114
+
115
+ - Reference
116
+
117
+ http://docs.oracle.com/cd/E19963-01/html/820-6572/managepkgs.html
@@ -0,0 +1,89 @@
1
+ Packaging
2
+
3
+ This is a repository for packaging artifacts for Puppet Labs software.
4
+ The goal is to abstract and automate packaging processes beyond individual
5
+ software projects to a level where this repo can be cloned inside any
6
+ project and used to build Debian and Redhat packages.
7
+
8
+ It expects the following directory structure in the project
9
+ * ext/{debian,redhat,osx}
10
+
11
+ each of which contains templated erb files using the instance variables
12
+ specified in the setupvars task. These include a debian changelog, a
13
+ redhat spec file, and an osx preflight and plist.
14
+
15
+ The top level Rakefile in the project should have the following added:
16
+ ```ruby
17
+ Dir['ext/packaging/tasks/**/*'].sort.each { |t| load t }
18
+ begin
19
+ @build_defaults ||= YAML.load_file('ext/build_defaults.yaml')
20
+ @packaging_url = @build_defaults['packaging_url']
21
+ @packaging_repo = @build_defaults['packaging_repo']
22
+ rescue
23
+ STDERR.puts "Unable to read the packaging repo from ext/build_defaults.yaml"
24
+ end
25
+
26
+
27
+ namespace :package do
28
+ desc "Bootstrap packaging automation, e.g. clone into packaging repo"
29
+ task :bootstrap do
30
+ cd 'ext' do
31
+ %x{git clone #{@packaging_url}}
32
+ end
33
+ end
34
+
35
+ desc "Remove all cloned packaging automation"
36
+ task :implode do
37
+ rm_rf "ext/#{@packaging_repo}"
38
+ end
39
+ end
40
+ ```
41
+
42
+ Also in ext should be two files, build_defaults.yaml and project_data.yaml.
43
+
44
+ This is the sample build_defaults.yaml file from Hiera:
45
+ ```yaml
46
+ ---
47
+ packaging_url: 'git@github.com:puppetlabs/packaging --branch=master'
48
+ packaging_repo: 'packaging'
49
+ default_cow: 'base-squeeze-i386.cow'
50
+ cows: 'base-lucid-amd64.cow base-lucid-i386.cow base-natty-amd64.cow base-natty-i386.cow base-oneiric-amd64.cow base-oneiric-i386.cow base-precise-amd64.cow base-precise-i386.cow base-sid-amd64.cow base-sid-i386.cow base-squeeze-amd64.cow base-squeeze-i386.cow base-testing-amd64.cow base-testing-i386.cow base-wheezy-i386.cow'
51
+ pbuild_conf: '/etc/pbuilderrc'
52
+ packager: 'puppetlabs'
53
+ gpg_name: 'info@puppetlabs.com'
54
+ gpg_key: '4BD6EC30'
55
+ sign_tar: FALSE
56
+ # a space separated list of mock configs
57
+ final_mocks: 'pl-5-i386 pl-5-x86_64 pl-6-i386 pl-6-x86_64 fedora-15-i386 fedora-15-x86_64 fedora-16-i386 fedora-16-x86_64 fedora-17-i386 fedora-17-x86_64'
58
+ rc_mocks: 'pl-5-i386-dev pl-5-x86_64-dev pl-6-i386-dev pl-6-x86_64-dev fedora-15-i386-dev fedora-15-x86_64-dev fedora-16-i386-dev fedora-16-x86_64-dev fedora-17-i386-dev fedora-17-x86_64-dev'
59
+ yum_host: 'burji.puppetlabs.com'
60
+ yum_repo_path: '~/repo/'
61
+ apt_host: 'burji.puppetlabs.com'
62
+ apt_repo_url: 'http://apt.puppetlabs.com'
63
+ apt_repo_path: '/opt/repository/incoming'
64
+ # Whether to present the gem and apple tasks
65
+ build_gem: TRUE
66
+ build_dmg: TRUE
67
+ ```
68
+ This is the sample project_data.yaml file:
69
+ ```yaml
70
+ ---
71
+ project: 'hiera'
72
+ author: 'Puppet Labs'
73
+ email: 'info@puppetlabs.com'
74
+ homepage: 'https://github.com/puppetlabs/hiera'
75
+ summary: 'Light weight hierarchical data store'
76
+ description: 'A pluggable data store for hierarcical data'
77
+ version_file: '/lib/hiera.rb'
78
+ # files and gem_files are space separated lists
79
+ files: '[A-Z]* ext lib bin spec acceptance_tests'
80
+ gem_files: '{bin,lib}/**/* CHANGELOG COPYING README.md LICENSE'
81
+ gem_require_path: 'lib'
82
+ gem_test_files: 'spec/**/*'
83
+ gem_executables: 'hiera'
84
+ gem_default_executables: 'hiera'
85
+ # To add gem dependencies, indent.
86
+ # This is an example only, hiera doesn't really depend on hiera-puppet
87
+ gem_dependencies:
88
+ hiera-puppet: '1.0.0rc'
89
+ ```
@@ -0,0 +1,236 @@
1
+ # Utility methods used by the various rake tasks
2
+
3
+ def check_tool(tool)
4
+ %x{which #{tool}}
5
+ unless $?.success?
6
+ STDERR.puts "#{tool} tool not found...exiting"
7
+ exit 1
8
+ end
9
+ end
10
+
11
+ def find_tool(tool)
12
+ location = %x{which #{tool}}.chomp
13
+ location if $?.success?
14
+ end
15
+
16
+ def check_file(file)
17
+ unless File.exist?(file)
18
+ STDERR.puts "#{file} file not found...exiting"
19
+ exit 2
20
+ end
21
+ end
22
+
23
+ def check_var(varname,var=nil)
24
+ if var.nil?
25
+ STDERR.puts "Requires #{varname} be set...exiting"
26
+ exit 3
27
+ end
28
+ end
29
+
30
+ def check_host(host)
31
+ unless host == %x{hostname}.chomp!
32
+ STDERR.puts "Requires host to be #{host}...exiting"
33
+ exit 5
34
+ end
35
+ end
36
+
37
+ def erb(erbfile, outfile)
38
+ template = File.read(erbfile)
39
+ message = ERB.new(template, nil, "-")
40
+ output = message.result(binding)
41
+ File.open(outfile, 'w') { |f| f.write output }
42
+ puts "Generated: #{outfile}"
43
+ end
44
+
45
+ def cp_pr(src, dest, options={})
46
+ mandatory = {:preserve => true}
47
+ cp_r(src, dest, options.merge(mandatory))
48
+ end
49
+
50
+ def cp_p(src, dest, options={})
51
+ mandatory = {:preserve => true}
52
+ cp(src, dest, options.merge(mandatory))
53
+ end
54
+
55
+ def mv_f(src, dest, options={})
56
+ force = {:force => true}
57
+ mv(src, dest, options.merge(mandatory))
58
+ end
59
+
60
+ def git_co(dist)
61
+ %x{git reset --hard ; git checkout #{dist}}
62
+ unless $?.success?
63
+ STDERR.puts 'Could not checkout #{dist} git branch to build package from...exiting'
64
+ exit 1
65
+ end
66
+ end
67
+
68
+ def get_temp
69
+ temp = `mktemp -d -t tmpXXXXXX`.strip
70
+ end
71
+
72
+ def remote_ssh_cmd target, command
73
+ check_tool('ssh')
74
+ puts "Executing '#{command}' on #{target}"
75
+ %x{ssh #{target} '#{command}'}
76
+ end
77
+
78
+ def rsync_to *args
79
+ check_tool('rsync')
80
+ flags = "-Havxl -O --no-perms --no-owner --no-group"
81
+ source = args[0]
82
+ target = args[1]
83
+ dest = args[2]
84
+ puts "rsyncing #{source} to #{target}"
85
+ %x{rsync #{flags} #{source} #{ENV['USER']}@#{target}:#{dest}}
86
+ end
87
+
88
+ def scp_file_from(host,path,file)
89
+ %x{scp #{ENV['USER']}@#{host}:#{path}/#{file} #{@tempdir}/#{file}}
90
+ end
91
+
92
+ def scp_file_to(host,path,file)
93
+ %x{scp #{@tempdir}/#{file} #{ENV['USER']}@#{host}:#{path}}
94
+ end
95
+
96
+ def timestamp
97
+ Time.now.strftime("%Y-%m-%d %H:%M:%S")
98
+ end
99
+
100
+ def get_dash_version
101
+ if File.exists?('.git')
102
+ %x{git describe}.chomp.split('-')[0..1].join('-').gsub('v','')
103
+ else
104
+ get_pwd_version
105
+ end
106
+ end
107
+
108
+ def get_ips_version
109
+ if File.exists?('.git')
110
+ desc = %x{git describe}.chomp.split(/[.-]/)
111
+ commits = %x{git log --oneline --no-merges | wc -l}.chomp.strip
112
+ osrelease = %x{uname -r}.chomp
113
+ "%s.%s.%s,#{osrelease}-%s" % [ desc[0],desc[1], desc[2], commits]
114
+ else
115
+ get_pwd_version
116
+ end
117
+ end
118
+
119
+ def get_dot_version
120
+ if File.exists?('.git')
121
+ %x{git describe}.chomp.gsub('-', '.').split('.')[0..3].join('.').gsub('v', '')
122
+ else
123
+ get_pwd_version
124
+ end
125
+ end
126
+
127
+ def get_pwd_version
128
+ %x{pwd}.strip.split('.')[-1]
129
+ end
130
+
131
+ def get_debversion
132
+ (@version.include?("rc") ? @version.sub(/rc[0-9]+/, '0.1\0') : "#{@version.gsub('-','.')}-1") + "#{@packager}#{get_debrelease}"
133
+ end
134
+
135
+ def get_origversion
136
+ @debversion.split('-')[0]
137
+ end
138
+
139
+ def get_rpmversion
140
+ @version.match(/^([0-9.]+)/)[1]
141
+ end
142
+
143
+ def get_version_file_version
144
+ # Match version files containing 'VERSION = "x.x.x"' and just x.x.x
145
+ contents = IO.read(@version_file)
146
+ if version_string = contents.match(/VERSION =.*/)
147
+ version_string.to_s.split()[-1]
148
+ else
149
+ contents
150
+ end
151
+ end
152
+
153
+ def get_debrelease
154
+ ENV['RELEASE'] || '1'
155
+ end
156
+
157
+ def get_rpmrelease
158
+ ENV['RELEASE'] ||
159
+ if @version.include?("rc")
160
+ "0.1" + @version.gsub('-', '_').match(/rc[0-9]+.*/)[0]
161
+ else
162
+ "1"
163
+ end
164
+ end
165
+
166
+ def restart_keychain
167
+ kill_keychain
168
+ start_keychain
169
+ end
170
+
171
+ def kill_keychain
172
+ %x{keychain -k mine}
173
+ end
174
+
175
+ def start_keychain
176
+ keychain = %x{/usr/bin/keychain -q --agents gpg --eval #{@gpg_key}}.chomp
177
+ new_env = keychain.match(/(GPG_AGENT_INFO)=([^;]*)/)
178
+ ENV[new_env[1]] = new_env[2]
179
+ end
180
+
181
+ def gpg_sign_file(file)
182
+ gpg ||= find_tool('gpg')
183
+
184
+ if gpg
185
+ sh "#{gpg} --armor --detach-sign -u #{@gpg_key} #{file}"
186
+ else
187
+ STDERR.puts "No gpg available. Cannot sign tarball. Exiting..."
188
+ exit 1
189
+ end
190
+ end
191
+
192
+ def mkdir_pr *args
193
+ args.each do |arg|
194
+ mkdir_p arg
195
+ end
196
+ end
197
+
198
+ def set_cow_envs(cow)
199
+ elements = cow.split('-')
200
+ if elements.size != 3
201
+ STDERR.puts "Expecting a cow name split on hyphens, e.g. 'base-squeeze-i386'"
202
+ exit 1
203
+ else
204
+ dist = elements[1]
205
+ arch = elements[2]
206
+ if dist.nil? or arch.nil?
207
+ STDERR.puts "Couldn't get the arg and dist from cow name. Expecting something like 'base-dist-arch'"
208
+ exit 1
209
+ end
210
+ arch = arch.split('.')[0] if arch.include?('.')
211
+ end
212
+
213
+ ENV['DIST'] = dist
214
+ ENV['ARCH'] = arch
215
+ end
216
+
217
+ def ln(target, name)
218
+ %x{ln -f #{target} #{name}}
219
+ end
220
+
221
+ def git_commit_file(file)
222
+ %x{which git &> /dev/null}
223
+ if $?.success? and File.exist?('.git')
224
+ %x{git commit #{file} -m "Commit changes to #{file}" &> /dev/null}
225
+ end
226
+ end
227
+
228
+ def ship_gem(file)
229
+ %x{gem push #{file}}
230
+ end
231
+
232
+ def x(v)
233
+ puts %[#{v}]
234
+ print %x[#{v}]
235
+ end
236
+