Permalink
Browse files

merging jedi4ever veewee/master

  • Loading branch information...
2 parents 61945d4 + 546abda commit 88d83ed386b49dc9b3597c1e23714a20c8815494 @hh committed Oct 29, 2012
Showing with 4,288 additions and 2,542 deletions.
  1. +2 −3 .rvmrc
  2. +6 −0 Gemfile
  3. +22 −180 README.md
  4. +70 −11 Rakefile
  5. +6 −1 bin/veewee
  6. +2 −1 doc/README-changes.txt
  7. +1 −1 doc/TODO
  8. +8 −1 doc/definition.md
  9. +9 −1 doc/kvm.md
  10. +7 −1 doc/requirements.md
  11. +7 −7 doc/vagrant.md
  12. +3 −5 lib/fission.rb
  13. +0 −76 lib/fission/cli.rb
  14. +0 −15 lib/fission/command.rb
  15. +0 −68 lib/fission/command/clone.rb
  16. +0 −71 lib/fission/command/delete.rb
  17. +0 −52 lib/fission/command/snapshot_create.rb
  18. +0 −45 lib/fission/command/snapshot_list.rb
  19. +0 −54 lib/fission/command/snapshot_revert.rb
  20. +0 −69 lib/fission/command/start.rb
  21. +0 −31 lib/fission/command/status.rb
  22. +0 −49 lib/fission/command/stop.rb
  23. +0 −67 lib/fission/command/suspend.rb
  24. +52 −5 lib/fission/config.rb
  25. +0 −5 lib/fission/core_ext/class.rb
  26. +0 −7 lib/fission/core_ext/file.rb
  27. +0 −112 lib/fission/core_ext/object.rb
  28. +0 −9 lib/fission/error.rb
  29. +0 −17 lib/fission/fusion.rb
  30. +0 −74 lib/fission/leasesfile.rb
  31. +0 −39 lib/fission/metadata.rb
  32. +0 −16 lib/fission/response.rb
  33. +0 −22 lib/fission/ui.rb
  34. +0 −3 lib/fission/version.rb
  35. +0 −361 lib/fission/vm.rb
  36. +76 −0 lib/python/parallels_send_string.py
  37. +1 −1 lib/veewee/cli.rb
  38. +2 −2 lib/veewee/command.rb
  39. +1 −1 lib/veewee/command/base.rb
  40. +2 −1 lib/veewee/command/{vmfusion.rb → fusion.rb}
  41. +2 −1 lib/veewee/command/group_base.rb
  42. +3 −1 lib/veewee/command/kvm.rb
  43. +1 −0 lib/veewee/command/parallels.rb
  44. +4 −0 lib/veewee/command/vagrant/basebox.rb
  45. +4 −1 lib/veewee/command/vagrant/build.rb
  46. +1 −1 lib/veewee/command/vagrant/define.rb
  47. +1 −1 lib/veewee/command/vagrant/destroy.rb
  48. +11 −1 lib/veewee/command/vagrant/export.rb
  49. +1 −1 lib/veewee/command/vagrant/halt.rb
  50. +2 −2 lib/veewee/command/vagrant/list.rb
  51. +2 −2 lib/veewee/command/vagrant/ostypes.rb
  52. +45 −0 lib/veewee/command/vagrant/screenshot.rb
  53. +2 −3 lib/veewee/command/vagrant/ssh.rb
  54. +3 −3 lib/veewee/command/vagrant/templates.rb
  55. +2 −2 lib/veewee/command/vagrant/undefine.rb
  56. +1 −1 lib/veewee/command/vagrant/up.rb
  57. +46 −0 lib/veewee/command/vagrant/validate.rb
  58. +18 −4 lib/veewee/command/{virtualbox.rb → vbox.rb}
  59. +2 −2 lib/veewee/config.rb
  60. +4 −4 lib/veewee/config/definition.rb
  61. +36 −2 lib/veewee/config/ostypes.yml
  62. +15 −3 lib/veewee/definition.rb
  63. +29 −10 lib/veewee/definitions.rb
  64. +11 −1 lib/veewee/environment.rb
  65. +9 −0 lib/veewee/provider/core/box.rb
  66. +63 −21 lib/veewee/provider/core/box/build.rb
  67. +6 −3 lib/veewee/provider/core/box/exec.rb
  68. +3 −3 lib/veewee/provider/core/box/floppy.rb
  69. +3 −3 lib/veewee/provider/core/box/scp.rb
  70. +1 −1 lib/veewee/provider/core/box/ssh.rb
  71. +64 −0 lib/veewee/provider/core/box/validate_tags.rb
  72. +3 −3 lib/veewee/provider/core/box/vnc.rb
  73. +45 −38 lib/veewee/provider/core/helper/iso.rb
  74. +32 −49 lib/veewee/provider/core/helper/scancode.rb
  75. +6 −6 lib/veewee/provider/core/helper/shell.rb
  76. +19 −20 lib/veewee/provider/core/helper/ssh.rb
  77. +9 −7 lib/veewee/provider/core/helper/tcp.rb
  78. +15 −10 lib/veewee/provider/core/helper/web.rb
  79. +25 −13 lib/veewee/provider/core/provider.rb
  80. +8 −8 lib/veewee/provider/core/provider/tunnel.rb
  81. +3 −2 lib/veewee/provider/kvm/box/create.rb
  82. +1 −1 lib/veewee/provider/kvm/box/destroy.rb
  83. +3 −3 lib/veewee/provider/kvm/box/helper/console_type.rb
  84. +2 −2 lib/veewee/provider/kvm/box/helper/ip.rb
  85. +2 −2 lib/veewee/provider/kvm/box/helper/status.rb
  86. +1 −33 lib/veewee/provider/kvm/box/validate_kvm.rb
  87. +1 −1 lib/veewee/provider/kvm/provider.rb
  88. +1 −1 lib/veewee/provider/parallels/box/create.rb
  89. +1 −2 lib/veewee/provider/parallels/box/destroy.rb
  90. +1 −1 lib/veewee/provider/parallels/box/helper/buildinfo.rb
  91. +59 −81 lib/veewee/provider/parallels/box/helper/console_type.rb
  92. +1 −35 lib/veewee/provider/parallels/box/validate_parallels.rb
  93. +2 −0 lib/veewee/provider/virtualbox/box.rb
  94. +1 −1 lib/veewee/provider/virtualbox/box/build.rb
  95. +16 −4 lib/veewee/provider/virtualbox/box/create.rb
  96. +11 −13 lib/veewee/provider/virtualbox/box/destroy.rb
  97. +20 −19 lib/veewee/provider/virtualbox/box/export_vagrant.rb
  98. +2 −2 lib/veewee/provider/virtualbox/box/helper/buildinfo.rb
  99. +10 −10 lib/veewee/provider/virtualbox/box/helper/console_type.rb
  100. +44 −35 lib/veewee/provider/virtualbox/box/helper/create.rb
  101. +2 −2 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
  102. +2 −3 lib/veewee/provider/virtualbox/box/helper/guest_additions.rb
  103. +17 −0 lib/veewee/provider/virtualbox/box/helper/natinterface.rb
  104. +8 −0 lib/veewee/provider/virtualbox/box/helper/version.rb
  105. +2 −2 lib/veewee/provider/virtualbox/box/poweroff.rb
  106. +24 −0 lib/veewee/provider/virtualbox/box/screenshot.rb
  107. +11 −5 lib/veewee/provider/virtualbox/box/up.rb
  108. +2 −41 lib/veewee/provider/virtualbox/box/validate_vagrant.rb
  109. +3 −11 lib/veewee/provider/vmfusion/box.rb
  110. +1 −1 lib/veewee/provider/vmfusion/box/create.rb
  111. +2 −3 lib/veewee/provider/vmfusion/box/destroy.rb
  112. +1 −1 lib/veewee/provider/vmfusion/box/export_ova.rb
  113. +22 −10 lib/veewee/provider/vmfusion/box/helper/buildinfo.rb
  114. +48 −3 lib/veewee/provider/vmfusion/box/helper/ip.rb
  115. +3 −3 lib/veewee/provider/vmfusion/box/helper/vnc.rb
  116. +9 −0 lib/veewee/provider/vmfusion/box/template.rb
  117. +1 −1 lib/veewee/provider/vmfusion/box/template.vmx.erb
  118. +1 −35 lib/veewee/provider/vmfusion/box/validate_vmfusion.rb
  119. +19 −2 lib/veewee/provider/vmfusion/provider.rb
  120. +1 −1 lib/veewee/providers.rb
  121. +2 −3 lib/veewee/templates.rb
  122. +5 −3 lib/veewee/ui.rb
  123. +1 −1 lib/veewee/version.rb
  124. +1 −1 templates/CentOS-4.8-i386/definition.rb
  125. +1 −1 templates/CentOS-5.5-i386-netboot/definition.rb
  126. +1 −1 templates/CentOS-5.5-x86_64-netboot/definition.rb
  127. +20 −8 templates/CentOS-5.6-i386-netboot/postinstall.sh
  128. +2 −2 templates/CentOS-5.7-i386-netboot/definition.rb
  129. +3 −1 templates/CentOS-5.7-i386-netboot/ks.cfg
  130. +2 −2 templates/CentOS-5.7-x86_64-netboot/definition.rb
  131. +3 −1 templates/CentOS-5.7-x86_64-netboot/ks.cfg
  132. +16 −0 templates/CentOS-5.8-i386-netboot/definition.rb
  133. +47 −0 templates/CentOS-5.8-i386-netboot/ks.cfg
  134. +53 −0 templates/CentOS-5.8-i386-netboot/postinstall.sh
  135. +16 −0 templates/CentOS-5.8-i386/definition.rb
  136. +47 −0 templates/CentOS-5.8-i386/ks.cfg
  137. +53 −0 templates/CentOS-5.8-i386/postinstall.sh
  138. +16 −0 templates/CentOS-5.8-x86_64-netboot/definition.rb
  139. +47 −0 templates/CentOS-5.8-x86_64-netboot/ks.cfg
  140. +53 −0 templates/CentOS-5.8-x86_64-netboot/postinstall.sh
  141. +16 −0 templates/CentOS-5.8-x86_64/definition.rb
  142. +47 −0 templates/CentOS-5.8-x86_64/ks.cfg
  143. +60 −0 templates/CentOS-5.8-x86_64/postinstall.sh
  144. +14 −0 templates/CentOS-6.0-i386-netboot/base.sh
  145. +3 −0 templates/CentOS-6.0-i386-netboot/chef.sh
  146. +5 −0 templates/CentOS-6.0-i386-netboot/cleanup.sh
  147. +34 −10 templates/CentOS-6.0-i386-netboot/definition.rb
  148. +19 −30 templates/CentOS-6.0-i386-netboot/ks.cfg
  149. +12 −0 templates/CentOS-6.0-i386-netboot/puppet.sh
  150. +3 −0 templates/CentOS-6.0-i386-netboot/ruby.sh
  151. +18 −0 templates/CentOS-6.0-i386-netboot/vagrant.sh
  152. +8 −0 templates/CentOS-6.0-i386-netboot/virtualbox.sh
  153. +3 −0 templates/CentOS-6.0-i386-netboot/zerodisk.sh
  154. +22 −0 templates/CentOS-6.0-i386/base.sh
  155. +3 −0 templates/CentOS-6.0-i386/chef.sh
  156. +5 −0 templates/CentOS-6.0-i386/cleanup.sh
  157. +35 −12 templates/CentOS-6.0-i386/definition.rb
  158. +12 −18 templates/CentOS-6.0-i386/ks.cfg
  159. +12 −0 templates/CentOS-6.0-i386/puppet.sh
  160. +3 −0 templates/CentOS-6.0-i386/ruby.sh
  161. +18 −0 templates/CentOS-6.0-i386/vagrant.sh
  162. +8 −0 templates/CentOS-6.0-i386/virtualbox.sh
  163. +3 −0 templates/CentOS-6.0-i386/zerodisk.sh
  164. +22 −0 templates/CentOS-6.0-x86_64-minimal/base.sh
  165. +3 −0 templates/CentOS-6.0-x86_64-minimal/chef.sh
  166. +5 −0 templates/CentOS-6.0-x86_64-minimal/cleanup.sh
  167. +33 −10 templates/CentOS-6.0-x86_64-minimal/definition.rb
  168. +11 −7 templates/CentOS-6.0-x86_64-minimal/ks.cfg
  169. +0 −58 templates/CentOS-6.0-x86_64-minimal/postinstall.sh
  170. +12 −0 templates/CentOS-6.0-x86_64-minimal/puppet.sh
  171. +3 −0 templates/CentOS-6.0-x86_64-minimal/ruby.sh
  172. +18 −0 templates/CentOS-6.0-x86_64-minimal/vagrant.sh
  173. +8 −0 templates/CentOS-6.0-x86_64-minimal/virtualbox.sh
  174. +3 −0 templates/CentOS-6.0-x86_64-minimal/zerodisk.sh
  175. +14 −0 templates/CentOS-6.0-x86_64-netboot/base.sh
  176. +3 −0 templates/CentOS-6.0-x86_64-netboot/chef.sh
  177. +5 −0 templates/CentOS-6.0-x86_64-netboot/cleanup.sh
  178. +33 −9 templates/CentOS-6.0-x86_64-netboot/definition.rb
  179. +18 −30 templates/CentOS-6.0-x86_64-netboot/ks.cfg
  180. +12 −0 templates/CentOS-6.0-x86_64-netboot/puppet.sh
  181. +3 −0 templates/CentOS-6.0-x86_64-netboot/ruby.sh
  182. +18 −0 templates/CentOS-6.0-x86_64-netboot/vagrant.sh
  183. +8 −0 templates/CentOS-6.0-x86_64-netboot/virtualbox.sh
  184. +3 −0 templates/CentOS-6.0-x86_64-netboot/zerodisk.sh
  185. +10 −0 templates/CentOS-6.0-x86_64/base.sh
  186. +1 −0 templates/CentOS-6.0-x86_64/chef.sh
  187. +1 −0 templates/CentOS-6.0-x86_64/cleanup.sh
  188. +17 −8 templates/CentOS-6.0-x86_64/definition.rb
  189. +12 −18 templates/CentOS-6.0-x86_64/ks.cfg
  190. +1 −0 templates/CentOS-6.0-x86_64/puppet.sh
  191. +2 −1 templates/CentOS-6.0-x86_64/ruby.sh
  192. +13 −4 templates/CentOS-6.0-x86_64/vagrant.sh
  193. +4 −4 templates/CentOS-6.0-x86_64/virtualbox.sh
  194. +3 −0 templates/CentOS-6.0-x86_64/zerodisk.sh
  195. +10 −1 templates/CentOS-6.1-x86_64-minimal/base.sh
  196. +1 −0 templates/CentOS-6.1-x86_64-minimal/chef.sh
  197. +1 −0 templates/CentOS-6.1-x86_64-minimal/cleanup.sh
  198. +4 −3 templates/CentOS-6.1-x86_64-minimal/definition.rb
  199. +13 −18 templates/CentOS-6.1-x86_64-minimal/ks.cfg
  200. +1 −0 templates/CentOS-6.1-x86_64-minimal/puppet.sh
  201. +2 −1 templates/CentOS-6.1-x86_64-minimal/ruby.sh
  202. +8 −5 templates/CentOS-6.1-x86_64-minimal/vagrant.sh
  203. +2 −2 templates/CentOS-6.1-x86_64-minimal/virtualbox.sh
  204. +3 −0 templates/CentOS-6.1-x86_64-minimal/zerodisk.sh
  205. +2 −1 templates/CentOS-6.1-x86_64-netboot/base.sh
  206. +1 −0 templates/CentOS-6.1-x86_64-netboot/chef.sh
  207. +1 −0 templates/CentOS-6.1-x86_64-netboot/cleanup.sh
  208. +8 −7 templates/CentOS-6.1-x86_64-netboot/definition.rb
  209. +13 −17 templates/CentOS-6.1-x86_64-netboot/ks.cfg
  210. +0 −48 templates/CentOS-6.1-x86_64-netboot/postinstall.sh
  211. +1 −0 templates/CentOS-6.1-x86_64-netboot/puppet.sh
  212. +2 −1 templates/CentOS-6.1-x86_64-netboot/ruby.sh
  213. +8 −5 templates/CentOS-6.1-x86_64-netboot/vagrant.sh
  214. +3 −3 templates/CentOS-6.1-x86_64-netboot/virtualbox.sh
  215. +3 −0 templates/CentOS-6.1-x86_64-netboot/zerodisk.sh
  216. +22 −0 templates/CentOS-6.2-i386-minimal/base.sh
  217. +3 −0 templates/CentOS-6.2-i386-minimal/chef.sh
  218. +5 −0 templates/CentOS-6.2-i386-minimal/cleanup.sh
  219. +40 −0 templates/CentOS-6.2-i386-minimal/definition.rb
  220. +42 −0 templates/CentOS-6.2-i386-minimal/ks.cfg
  221. +12 −0 templates/CentOS-6.2-i386-minimal/puppet.sh
  222. +3 −0 templates/CentOS-6.2-i386-minimal/ruby.sh
  223. +18 −0 templates/CentOS-6.2-i386-minimal/vagrant.sh
  224. +8 −0 templates/CentOS-6.2-i386-minimal/virtualbox.sh
  225. +3 −0 templates/CentOS-6.2-i386-minimal/zerodisk.sh
  226. +8 −0 templates/CentOS-6.2-x86_64-minimal/base.sh
  227. +3 −2 templates/CentOS-6.2-x86_64-minimal/definition.rb
  228. +4 −1 templates/CentOS-6.2-x86_64-minimal/ks.cfg
  229. +7 −5 templates/CentOS-6.2-x86_64-minimal/vagrant.sh
  230. +3 −0 templates/CentOS-6.2-x86_64-minimal/zerodisk.sh
  231. +2 −1 templates/CentOS-6.2-x86_64-netboot/base.sh
  232. +1 −0 templates/CentOS-6.2-x86_64-netboot/chef.sh
  233. +1 −0 templates/CentOS-6.2-x86_64-netboot/cleanup.sh
  234. +7 −6 templates/CentOS-6.2-x86_64-netboot/definition.rb
  235. +13 −17 templates/CentOS-6.2-x86_64-netboot/ks.cfg
  236. +0 −48 templates/CentOS-6.2-x86_64-netboot/postinstall.sh
  237. +1 −0 templates/CentOS-6.2-x86_64-netboot/puppet.sh
  238. +2 −1 templates/CentOS-6.2-x86_64-netboot/ruby.sh
  239. +8 −5 templates/CentOS-6.2-x86_64-netboot/vagrant.sh
  240. +3 −3 templates/CentOS-6.2-x86_64-netboot/virtualbox.sh
  241. +3 −0 templates/CentOS-6.2-x86_64-netboot/zerodisk.sh
  242. +14 −0 templates/CentOS-6.3-i386-minimal/base.sh
  243. +3 −0 templates/CentOS-6.3-i386-minimal/chef.sh
  244. +5 −0 templates/CentOS-6.3-i386-minimal/cleanup.sh
  245. +40 −0 templates/CentOS-6.3-i386-minimal/definition.rb
  246. +42 −0 templates/CentOS-6.3-i386-minimal/ks.cfg
  247. +12 −0 templates/CentOS-6.3-i386-minimal/puppet.sh
  248. +3 −0 templates/CentOS-6.3-i386-minimal/ruby.sh
  249. +18 −0 templates/CentOS-6.3-i386-minimal/vagrant.sh
  250. +8 −0 templates/CentOS-6.3-i386-minimal/virtualbox.sh
  251. +3 −0 templates/CentOS-6.3-i386-minimal/zerodisk.sh
  252. +14 −0 templates/CentOS-6.3-x86_64-minimal/base.sh
  253. +3 −0 templates/CentOS-6.3-x86_64-minimal/chef.sh
  254. +5 −0 templates/CentOS-6.3-x86_64-minimal/cleanup.sh
  255. +40 −0 templates/CentOS-6.3-x86_64-minimal/definition.rb
  256. +42 −0 templates/CentOS-6.3-x86_64-minimal/ks.cfg
  257. +12 −0 templates/CentOS-6.3-x86_64-minimal/puppet.sh
  258. +3 −0 templates/CentOS-6.3-x86_64-minimal/ruby.sh
  259. +18 −0 templates/CentOS-6.3-x86_64-minimal/vagrant.sh
  260. +8 −0 templates/CentOS-6.3-x86_64-minimal/virtualbox.sh
  261. +3 −0 templates/CentOS-6.3-x86_64-minimal/zerodisk.sh
  262. +9 −0 templates/Debian-5.0.10-amd64-netboot/base.sh
  263. +2 −0 templates/Debian-5.0.10-amd64-netboot/chef.sh
  264. +10 −0 templates/Debian-5.0.10-amd64-netboot/cleanup.sh
  265. +39 −0 templates/Debian-5.0.10-amd64-netboot/definition.rb
  266. +60 −0 templates/Debian-5.0.10-amd64-netboot/postinstall.sh
  267. +312 −0 templates/Debian-5.0.10-amd64-netboot/preseed.cfg
  268. +2 −0 templates/Debian-5.0.10-amd64-netboot/puppet.sh
  269. +11 −0 templates/Debian-5.0.10-amd64-netboot/ruby.sh
  270. +14 −0 templates/Debian-5.0.10-amd64-netboot/vagrant.sh
  271. +15 −0 templates/Debian-5.0.10-amd64-netboot/virtualbox.sh
  272. +9 −0 templates/Debian-5.0.10-i386-netboot/base.sh
  273. +2 −0 templates/Debian-5.0.10-i386-netboot/chef.sh
  274. +10 −0 templates/Debian-5.0.10-i386-netboot/cleanup.sh
  275. +39 −0 templates/Debian-5.0.10-i386-netboot/definition.rb
  276. +60 −0 templates/Debian-5.0.10-i386-netboot/postinstall.sh
  277. +312 −0 templates/Debian-5.0.10-i386-netboot/preseed.cfg
  278. +2 −0 templates/Debian-5.0.10-i386-netboot/puppet.sh
  279. +11 −0 templates/Debian-5.0.10-i386-netboot/ruby.sh
  280. +14 −0 templates/Debian-5.0.10-i386-netboot/vagrant.sh
  281. +15 −0 templates/Debian-5.0.10-i386-netboot/virtualbox.sh
  282. +2 −2 templates/Debian-5.0.8-amd64-netboot/preseed.cfg
  283. +2 −2 templates/Debian-5.0.8-i386-netboot/preseed.cfg
  284. +14 −0 templates/Debian-6.0.3-amd64-netboot/base.sh
  285. +1 −1 templates/Debian-6.0.3-amd64-netboot/definition.rb
  286. +14 −0 templates/Debian-6.0.3-i386-netboot/base.sh
  287. +1 −1 templates/Debian-6.0.3-i386-netboot/definition.rb
  288. +14 −0 templates/Debian-6.0.4-amd64-netboot/base.sh
  289. +1 −1 templates/Debian-6.0.4-amd64-netboot/definition.rb
  290. +5 −1 templates/Debian-6.0.4-amd64-netboot/vagrant.sh
  291. +14 −0 templates/Debian-6.0.4-i386-netboot/base.sh
  292. +1 −1 templates/Debian-6.0.4-i386-netboot/definition.rb
  293. +1 −1 templates/Debian-6.0.4-i386-netboot/ruby.sh
  294. +5 −1 templates/Debian-6.0.4-i386-netboot/vagrant.sh
  295. +27 −0 templates/Debian-6.0.5-amd64-netboot/base.sh
  296. +2 −0 templates/Debian-6.0.5-amd64-netboot/chef.sh
  297. +4 −0 templates/Debian-6.0.5-amd64-netboot/cleanup-virtualbox.sh
  298. +17 −0 templates/Debian-6.0.5-amd64-netboot/cleanup.sh
  299. +49 −0 templates/Debian-6.0.5-amd64-netboot/definition.rb
  300. +315 −0 templates/Debian-6.0.5-amd64-netboot/preseed.cfg
Sorry, we could not display the entire diff because too many files (490) changed.
View
5 .rvmrc
@@ -1,6 +1,5 @@
-rvm use ruby-1.9.2
-rvm gemset create veewee
-rvm gemset use veewee
+rvm use ruby-1.9.2@veewee --create
+
alias veewee="bundle exec veewee"
alias vagrant="bundle exec vagrant"
alias irb="bundle exec irb"
View
6 Gemfile
@@ -1,6 +1,12 @@
+#if RUBY_VERSION =~ /1.9/
+ #Encoding.default_external = Encoding::UTF_8
+ #Encoding.default_internal = Encoding::UTF_8
+#end
+
source "http://rubygems.org"
#gem "veewee", :path => "."
+#gem "fission", :path => '/Users/patrick/dev/fission'
group :test do
gem "rake"
View
202 README.md
@@ -1,195 +1,37 @@
-# This is a branch that allows windows VM's to be used via winrm and not relying on ssh.
+**VeeWee:** the tool to easily build vagrant base boxes or kvm,virtualbox and fusion images
--------
+Vagrant is a great tool to test new things or changes in a virtual machine(Virtualbox) using either chef or puppet.
+The first step is to download an existing 'base box'. I believe this scares a lot of people as they don't know who or how this box was build. Therefore lots of people end up first building their own base box to use with vagrant.
+Besides building Vagrant boxes, veewee can also be used for:
-- veewee vbox define windows-7-enterprise-amd64-winrm windows-7-enterprise-amd64-winrm
-- veewee vbox build windows-7-enterprise-amd64-winrm
-- veewee vbox winrm windows-7-enterprise-amd64-winrm 'hostname'
-- veewee vbox copy windows-7-enterprise-amd64-winrm sourcefile.txt destfileinVM.txt
-- veewee vbox copy windows-7-enterprise-amd64-winrm sourcefile.txt destfileinVM.txt
-- vagrant basebox export windows-7-enterprise-amd64-winrm
-- vagrant box add 'windows-7-enterprise-amd64-winrm' 'windows-7-enterprise-amd64-winrm.box'
-- vagrant init windows-7-enterprise-amd64-winrm
+- create vmware (fusion), kvm virtual machines
+- interact with with those vms (up, destroy, halt, ssh)
+- export them : OVA for fusion, IMG for KVM and ovf for virtualbox
-```
-$ veewee vbox define windows-7-enterprise-amd64-winrm windows-7-enterprise-amd64-winrm
+Before you start read through:
-The basebox 'windows-7-enterprise-amd64-winrm' has been succesfully created from the template 'windows-7-enterprise-amd64-winrm'
-You can now edit the definition files stored in definitions/windows-7-enterprise-amd64-winrm or build the box with:
-veewee vbox build 'windows-7-enterprise-amd64-winrm'
-```
+- the [requirements](https://github.com/jedi4ever/veewee/tree/master/doc/requirements.md)
+- the [installation](https://github.com/jedi4ever/veewee/tree/master/doc/installation.md) procedure
-```
-$ veewee vbox build windows-7-enterprise-amd64-winrm --force
-Downloading vbox guest additions iso v 4.1.12 - http://download.virtualbox.org/virtualbox/4.1.12/VBoxGuestAdditions_4.1.12.iso
-Checking if isofile VBoxGuestAdditions_4.1.12.iso already exists.
-Full path: /home/hh/chef/veewee/iso/VBoxGuestAdditions_4.1.12.iso
+Depending on how you want to use veewee, read through one of the following guides: (**work in progres**)
-The isofile VBoxGuestAdditions_4.1.12.iso already exists.
-Building Box windows-7-enterprise-amd64-winrm with Definition windows-7-enterprise-amd64-winrm:
-- postinstall_include : []
-- postinstall_exclude : []
-- force : true
+- [guide for vagrant](https://github.com/jedi4ever/veewee/tree/master/doc/vagrant.md)
-The isofile 7600.16385.090713-1255_x64fre_enterprise_en-us_EVAL_Eval_Enterprise-GRMCENXEVAL_EN_DVD.iso already exists.
-VBoxManage unregistervm 'windows-7-enterprise-amd64-winrm' --delete
-Deleting vm windows-7-enterprise-amd64-winrm
-Creating vm windows-7-enterprise-amd64-winrm : 512M - 1 CPU - Windows7_64
-Creating new harddrive of size 20280
-Mounting cdrom: /home/hh/chef/veewee/iso/7600.16385.090713-1255_x64fre_enterprise_en-us_EVAL_Eval_Enterprise-GRMCENXEVAL_EN_DVD.iso
-Mounting guest additions: /home/hh/chef/veewee/iso/VBoxGuestAdditions_4.1.12.iso
-Attaching disk: /home/hh/VirtualBox VMs/windows-7-enterprise-amd64-winrm/windows-7-enterprise-amd64-winrm.vdi
-Using winrm because winrm_user and winrm_password are both set
-Received port hint - 5985
-Found port 5985 available
-Received port hint - 5985
-Found port 5985 available
-Waiting 0 seconds for the machine to boot
+- [guide for Virtualbox](https://github.com/jedi4ever/veewee/tree/master/doc/vbox.md)
+- [guide for Vmware fusion](https://github.com/jedi4ever/veewee/tree/master/doc/fusion.md)
+- [guide for KVM](https://github.com/jedi4ever/veewee/tree/master/doc/kvm.md)
-Done typing.
+You can also look at the more detailed pages on each subject in the [documentation directory](https://github.com/jedi4ever/veewee/tree/master/doc)
-Skipping webserver as no kickstartfile was specified
-Received port hint - 7000
-Found port 7000 available
-Waiting for winrm login on 127.0.0.1 with user vagrant to windows on port => 5986 to work, timeout=10000 sec
-........................
-Executing winrm command: cmd.exe /C dir %TEMP%\\wget.vbs > %TEMP%\null
-File Not Found
-Creating wget.vbs
-Executing winrm command: cmd.exe /C echo "Rendering '%TEMP%\\wget.vbs' chunk 1" && >> %TEMP%\\wget.vbs (echo.url = WScript.Arguments.Named^("url"^)) && >> %TEMP%\\wget.vbs (echo.path = WScript.Arguments.Named^("path"^)) && >> %TEMP%\\wget.vbs (echo.Set objXMLHTTP = CreateObject^("MSXML2.ServerXMLHTTP"^)) && >> %TEMP%\\wget.vbs (echo.Set wshShell = CreateObject^( "WScript.Shell" ^)) && >> %TEMP%\\wget.vbs (echo.Set objUserVariables = wshShell.Environment^("USER"^)) && >> %TEMP%\\wget.vbs (echo.) && >> %TEMP%\\wget.vbs (echo.'http proxy is optional) && >> %TEMP%\\wget.vbs (echo.'attempt to read from HTTP_PROXY env var first) && >> %TEMP%\\wget.vbs (echo.On Error Resume Next) && >> %TEMP%\\wget.vbs (echo.) && >> %TEMP%\\wget.vbs (echo.If NOT ^(objUserVariables^("HTTP_PROXY"^) = ""^) Then) && >> %TEMP%\\wget.vbs (echo.objXMLHTTP.setProxy 2, objUserVariables^("HTTP_PROXY"^)) && >> %TEMP%\\wget.vbs (echo.) && >> %TEMP%\\wget.vbs (echo.'fall back to named arg) && >> %TEMP%\\wget.vbs (echo.ElseIf NOT ^(WScript.Arguments.Named^("proxy"^) = ""^) Then) && >> %TEMP%\\wget.vbs (echo.objXMLHTTP.setProxy 2, WScript.Arguments.Named^("proxy"^)) && >> %TEMP%\\wget.vbs (echo.End If) && >> %TEMP%\\wget.vbs (echo.) && >> %TEMP%\\wget.vbs (echo.On Error Goto 0) && >> %TEMP%\\wget.vbs (echo.) && >> %TEMP%\\wget.vbs (echo.objXMLHTTP.open "GET", url, false) && >> %TEMP%\\wget.vbs (echo.objXMLHTTP.send^(^)) && >> %TEMP%\\wget.vbs (echo.If objXMLHTTP.Status = 200 Then) && >> %TEMP%\\wget.vbs (echo.Set objADOStream = CreateObject^("ADODB.Stream"^)) && >> %TEMP%\\wget.vbs (echo.objADOStream.Open) && >> %TEMP%\\wget.vbs (echo.objADOStream.Type = 1) && >> %TEMP%\\wget.vbs (echo.objADOStream.Write objXMLHTTP.ResponseBody) && >> %TEMP%\\wget.vbs (echo.objADOStream.Position = 0) && >> %TEMP%\\wget.vbs (echo.Set objFSO = Createobject^("Scripting.FileSystemObject"^)) && >> %TEMP%\\wget.vbs (echo.If objFSO.Fileexists^(path^) Then objFSO.DeleteFile path) && >> %TEMP%\\wget.vbs (echo.Set objFSO = Nothing) && >> %TEMP%\\wget.vbs (echo.objADOStream.SaveToFile path) && >> %TEMP%\\wget.vbs (echo.objADOStream.Close)
-"Rendering 'C:\Users\vagrant\AppData\Local\Temp\\wget.vbs' chunk 1"
-Executing winrm command: cmd.exe /C echo "Rendering '%TEMP%\\wget.vbs' chunk 2" && >> %TEMP%\\wget.vbs (echo.Set objADOStream = Nothing) && >> %TEMP%\\wget.vbs (echo.End if) && >> %TEMP%\\wget.vbs (echo.Set objXMLHTTP = Nothing)
-"Rendering 'C:\Users\vagrant\AppData\Local\Temp\\wget.vbs' chunk 2"
-Spinning up a wait_for_http_request on http://10.0.2.2:7000//tmp/.veewee_version20121022-9183-15gv13c
-Going to try and copy /tmp/.veewee_version20121022-9183-15gv13c to ".veewee_version"
-Executing winrm command: cmd.exe /C cscript %TEMP%\wget.vbs /url:http://10.0.2.2:7000/tmp/.veewee_version20121022-9183-15gv13c /path:.veewee_version
-Serving file /tmp/.veewee_version20121022-9183-15gv13c
-Microsoft (R) Windows Script Host Version 5.8
-Copyright (C) Microsoft Corporation. All rights reserved.
+People have reported good experiences, why don't you give it a try?
-Received port hint - 7000
-Found port 7001 available
-Changing wincp port from 7000 to 7001
-Executing winrm command: cmd.exe /C dir %TEMP%\\wget.vbs > %TEMP%\null
-Spinning up a wait_for_http_request on http://10.0.2.2:7001//tmp/.vbox_version20121022-9183-1guel7e
-Going to try and copy /tmp/.vbox_version20121022-9183-1guel7e to ".vbox_version"
-Executing winrm command: cmd.exe /C cscript %TEMP%\wget.vbs /url:http://10.0.2.2:7001/tmp/.vbox_version20121022-9183-1guel7e /path:.vbox_version
-Serving file /tmp/.vbox_version20121022-9183-1guel7e
-Microsoft (R) Windows Script Host Version 5.8
-Copyright (C) Microsoft Corporation. All rights reserved.
+## If you have a setup working, share your 'definition' with me. That would be fun!
-Received port hint - 7001
-Found port 7002 available
-Changing wincp port from 7001 to 7002
-Executing winrm command: cmd.exe /C dir %TEMP%\\wget.vbs > %TEMP%\null
-Spinning up a wait_for_http_request on http://10.0.2.2:7002//home/hh/chef/veewee/definitions/windows-7-enterprise-amd64-winrm/install-chef.bat
-Going to try and copy /home/hh/chef/veewee/definitions/windows-7-enterprise-amd64-winrm/install-chef.bat to "install-chef.bat"
-Executing winrm command: cmd.exe /C cscript %TEMP%\wget.vbs /url:http://10.0.2.2:7002/home/hh/chef/veewee/definitions/windows-7-enterprise-amd64-winrm/install-chef.bat /path:install-chef.bat
-Serving file /home/hh/chef/veewee/definitions/windows-7-enterprise-amd64-winrm/install-chef.bat
-Microsoft (R) Windows Script Host Version 5.8
-Copyright (C) Microsoft Corporation. All rights reserved.
+IDEAS:
-Executing winrm command: install-chef.bat
+- Now you integrate this with your CI build to create a daily basebox
-C:\Users\vagrant>cmd /C cscript C:\Users\vagrant\AppData\Local\Temp\wget.vbs /url:http://www.opscode.com/chef/install.msi /path:C:\Users\vagrant\AppData\Local\Temp\chef-client.msi
-Microsoft (R) Windows Script Host Version 5.8
-Copyright (C) Microsoft Corporation. All rights reserved.
+[whren - 2012/04/12]
-
-C:\Users\vagrant>cmd /C msiexec /qn /i C:\Users\vagrant\AppData\Local\Temp\chef-client.msi
-The box windows-7-enterprise-amd64-winrm was build succesfully!
-You can now login to the box with:
-knife winrm -m 127.0.0.1 -P 5986 -x vagrant -P vagrant COMMAND
-```
-
-```
-$ veewee vbox winrm windows-7-enterprise-amd64-winrm hostname
-Executing winrm command: hostname
-vagrant-win7ent
-```
-
-```
-$ veewee vbox winrm windows-7-enterprise-amd64-winrm 'dir %TEMP%'
-Executing winrm command: dir %TEMP%
- Volume in drive C is Windows 7 Enterprise
- Volume Serial Number is 58F7-01E9
-
- Directory of C:\Users\vagrant\AppData\Local\Temp
-
-10/22/2012 11:26 PM <DIR> .
-10/22/2012 11:26 PM <DIR> ..
-10/22/2012 11:26 PM 63,636,395 chef-client.msi
-10/22/2012 11:25 PM 0 FXSAPIDebugLogFile.txt
-10/22/2012 11:24 PM <DIR> Low
-10/22/2012 11:25 PM 283 null
-10/22/2012 11:24 PM 49,208 vagrant.bmp
-10/22/2012 11:24 PM 1,105 wget.vbs
-10/22/2012 11:25 PM 843 wmsetup.log
-10/22/2012 11:25 PM <DIR> WPDNSE
- 6 File(s) 63,687,834 bytes
- 4 Dir(s) 1,431,273,472 bytes free
-```
-
-```
-$ veewee vbox winrm windows-7-enterprise-amd64-winrm 'dir'
-Executing winrm command: dir
- Volume in drive C is Windows 7 Enterprise
- Volume Serial Number is 58F7-01E9
-
- Directory of C:\Users\vagrant
-
-10/22/2012 11:25 PM <DIR> .
-10/22/2012 11:25 PM <DIR> ..
-10/22/2012 11:25 PM 7 .vbox_version
-10/22/2012 11:24 PM 13 .veewee_version
-10/22/2012 11:25 PM <DIR> Contacts
-10/22/2012 11:25 PM <DIR> Desktop
-10/22/2012 11:25 PM <DIR> Documents
-10/22/2012 11:25 PM <DIR> Downloads
-10/22/2012 11:25 PM <DIR> Favorites
-10/22/2012 11:25 PM 150 install-chef.bat
-10/22/2012 11:25 PM <DIR> Links
-10/22/2012 11:25 PM <DIR> Music
-10/22/2012 11:25 PM <DIR> Pictures
-10/22/2012 11:25 PM <DIR> Saved Games
-10/22/2012 11:25 PM <DIR> Searches
-10/22/2012 11:25 PM <DIR> Videos
- 3 File(s) 170 bytes
- 13 Dir(s) 1,431,273,472 bytes free
-```
-
-```
-$ vagrant basebox export windows-7-enterprise-amd64-winrm --force
-[vagrant] Vagrant requires the box to be shutdown, before it can export
-[vagrant] Sudo also needs to work for user
-[vagrant] Performing a clean shutdown now.
-[vagrant] Waiting for winrm login on 127.0.0.1 with user vagrant to windows on port => 5986 to work, timeout=10000 sec
-[vagrant] .[vagrant]
-[vagrant] Executing winrm command: shutdown /s /t 10 /c "Vagrant Shutdown" /f /d p:4:1
-[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant] .[vagrant]
-[vagrant] Machine windows-7-enterprise-amd64-winrm is powered off cleanly
-[vagrant] Excuting vagrant voodoo:
-[vagrant] vagrant package --base 'windows-7-enterprise-amd64-winrm' --output 'windows-7-enterprise-amd64-winrm.box'
-[vagrant]
-[vagrant] To import it into vagrant type:
-[vagrant] vagrant box add 'windows-7-enterprise-amd64-winrm' 'windows-7-enterprise-amd64-winrm.box'
-[vagrant]
-[vagrant] To use it:
-[vagrant] vagrant init 'windows-7-enterprise-amd64-winrm'
-[vagrant] vagrant up
-[vagrant] vagrant ssh
-```
-
-Now you could make windows-7-enterprise-amd64-winrm.box via an internal url and use in a Vagrantfile or
-
-```
-$ vagrant box add 'windows-7-enterprise-amd64-winrm' 'windows-7-enterprise-amd64-winrm.box
-[vagrant] Downloading with Vagrant::Downloaders::File...
-[vagrant] Copying box to temporary location...
-[vagrant] Extracting box...
-[vagrant] Verifying box...
-[vagrant] Cleaning up downloaded box...
-```
-
-Obviously we have a bit of work to do to get vagrant working with winrm, but at least now we can contruct windows base boxes from scratch.
+See [use of pre_postinstall_file in defition.rb](https://github.com/whren/veewee/wiki/Use-of-pre_postinstall_file-in-definition.rb)
View
81 Rakefile
@@ -25,7 +25,7 @@ Rake::TestTask.new do |t|
end
desc 'Verify ISO'
-task :iso, [:box_name] do |t,args|
+task :iso, [:template_name] do |t,args|
require 'net/http'
#if args.to_hash.size!=1
#puts "needs one arguments: rake iso [\"yourname\"]"
@@ -42,24 +42,83 @@ task :iso, [:box_name] do |t,args|
response = nil
while found==false
uri=URI.parse(url)
- Net::HTTP.start(uri.host,uri.port) {|http|
- response = http.head(uri.path)
- }
- unless response['location'].nil?
- #puts "Redirecting to "+response['location']
- url=response['location']
- else
- found=true
+ if uri.is_a?(URI::HTTP)
+ Net::HTTP.start(uri.host,uri.port) {|http|
+ response = http.head(uri.path)
+ }
+ unless response['location'].nil?
+ #puts "Redirecting to "+response['location']
+ url=response['location']
+ else
+ length=response['content-length']
+ found=true
+ end
+ elsif uri.is_a?(URI::FTP)
+ require 'net/ftp'
+ ftp = Net::FTP.new(uri.host)
+ ftp.login
+ begin
+ length = ftp.size(uri.path)
+ found = true
+ rescue Net::FTPReplyError => e
+ reply = e.message
+ err_code = reply[0,3].to_i
+ unless err_code == 500 || err_code == 502
+ # other problem, raise
+ raise "Got ftp site but doesn't support size subcommand"
+ end
+ # fallback solution
+ end
+
end
end
- length=response['content-length']
if length.to_i < 10000
puts definition.iso_src
- p response['content-type']
+ puts "Incorrect length #{length.to_i}"
puts uri.host,uri.port, uri.path,response.code
end
rescue Exception => ex
puts "Error"+ex.to_s+definition.iso_src
end
end
end
+
+desc 'Autobuilds all templates and runs validation.'
+task :autotest, [:pattern] do |t,args|
+
+ # We overrule all timeouts for tcp and ssh
+ #ENV['VEEWEE_TIMEOUT']='600'
+
+ ve=Veewee::Environment.new()
+ ve.templates.each do |name,template|
+
+ # If pattern was given, only take the ones that match the pattern
+ unless args[:pattern].nil?
+ next unless name.match(args[:pattern])
+ end
+
+ begin
+ ve.definitions.define("auto",name, { 'force' => true})
+ vd=ve.definitions["auto"]
+ box=ve.providers["virtualbox"].get_box("auto")
+ puts "AUTO: Building #{name}"
+ box.build({"auto" => true,"force" => true, 'nogui' => true })
+ puts "AUTO: Validating #{name}"
+ box.validate_vagrant
+ puts "AUTO: Success #{name}"
+ box.destroy
+ rescue Exception => ex
+ puts "AUTO: Template #{name} failed - #{ex}"
+ if box.running?
+ begin
+ screenshot="screenshot-auto-#{name}.png"
+ puts "AUTO: Taking snapshot #{screenshot}"
+ box.screenshot(screenshot)
+ rescue Veewee::Error => ex
+ puts "AUTO: Error taking screenshot"
+ end
+ end
+ end
+
+ end
+end
View
7 bin/veewee
@@ -1,4 +1,9 @@
#!/usr/bin/env ruby
+begin
+ require 'rubygems'
+rescue LoadError
+end
+
require 'veewee'
env = Veewee::Environment.new
@@ -18,5 +23,5 @@ begin
::Veewee::CLI.start(ARGV,:env => env)
rescue Veewee::Error => e
- puts "#{e}"
+ env.ui.error "#{e}"
end
View
3 doc/README-changes.txt
@@ -1,5 +1,6 @@
Changelog
now has include-postinstall, exclude-postinstall
+ now has pre_postinstall_file allowing pre postinstall execution (ie to export http_proxy, https_proxy)
ostypes are now synchronized accross kvm
require libvirt 0.8+ version
user veewee instead of vagrant
@@ -13,7 +14,7 @@ Todo:
validate vms - + features selection
check libvirt version
windows test
- validation of checks (also - inclide/exclude)
+ validation of checks (also - include/exclude)
check execs with exit code
multinetwork card
dkms for kernel installs
View
2 doc/TODO
@@ -54,7 +54,7 @@ Todo:
validate vms - + features selection
check libvirt version
windows test
- validation of checks (also - inclide/exclude)
+ validation of checks (also - include/exclude)
check execs with exit code
multinetwork card
dkms for kernel installs
View
9 doc/definition.md
@@ -1,12 +1,16 @@
# Veewee definition
## Creating a definition
-A definition is create be 'cloning' a *template*.
+A definition is created by 'cloning' a *template*.
To create a definition you use the 'define' subcommand:
veewee vbox define 'myubuntu' 'ubuntu-10.10-server-amd64'
+If you want to use an external repo for the definition you can specify a git-url
+
+ veewee vbox define 'myubuntu' 'git://github.com/jedi4ever/myubuntu'
+
## Modifying a definition
Definitions are stored under a directory 'definitions' relative to the current directory.
@@ -48,6 +52,9 @@ The 'Veewee::Session.declare' is now deprecated and you should use 'Veewee::Defi
The default user of definitions is now 'veewee' and not 'vagrant'. This is because on other virtualizations like fusion and kvm, there is not relationship with the 'vagrant'. Users 'vagrant' are created by the 'vagrant.sh' script and not by the preseed or kickstart.
+_Using ERB in files_
+
+Add '.erb' to your files in a definition and they will get rendered (useful for generting kickstart,postinstall) (thx @mconigilaro)
## Listing existing definitions
View
10 doc/kvm.md
@@ -1,2 +1,10 @@
-Coming Soon
+NOTE:Virtualbox doesn't like KVM to be enabled
+check with
+
+ kvm_ok
+
+Remove modules:
+
+ rmmod kvm_intel
+ rmmod kvm
View
8 doc/requirements.md
@@ -1 +1,7 @@
-Coming Soon
+More Coming Soon
+
+Development Libraries:
+
+libxslt1-dev
+libxml2-dev
+zlib1g-dev
View
14 doc/vagrant.md
@@ -2,11 +2,11 @@
Let's define a Ubuntu 10.10 server i386 basebox called myunbuntubox
this is essentially making a copy based on the templates provided above.
- $ veewee vbox basebox define 'myubuntubox' 'ubuntu-10.10-server-i386'
+ $ veewee vbox define 'myubuntubox' 'ubuntu-10.10-server-i386'
The basebox 'myubuntubox' has been succesfully created from the template ''ubuntu-10.10-server-i386'
You can now edit the definition files stored in definitions/myubuntubox
or build the box with:
- veewee vbox basebox build 'myubuntubox'
+ veewee vbox build 'myubuntubox'
-> This copies over the templates/ubuntu-10.10-server-i386 to definition/myubuntubox
@@ -17,7 +17,7 @@ this is essentially making a copy based on the templates provided above.
Veewee::Definition.declare( {
:cpu_count => '1', :memory_size=> '256',
- :disk_size => '10140', :disk_format => 'VDI',
+ :disk_size => '10140', :disk_format => 'VDI', :disk_variant => 'Standard',
:os_type_id => 'Ubuntu',
:iso_file => "ubuntu-10.10-server-i386.iso",
:iso_src => "http://releases.ubuntu.com/maverick/ubuntu-10.10-server-i386.iso",
@@ -47,15 +47,15 @@ If you need to change values in the templates, be sure to run the rake undefine,
## Getting the cdrom file in place
Put your isofile inside the 'currentdir'/iso directory or if you don't run
- $ veewee vbox basebox build 'myubuntubox'
+ $ veewee vbox build 'myubuntubox'
- the build assumes your iso files are in 'currentdir'/iso
- if it can not find it will suggest to download the iso for you
- use '--force' to overwrite an existing install
## Build the new box:
- $ veewee vbox basebox build 'myubuntubox'
+ $ veewee vbox build 'myubuntubox'
- This will create a machine + disk according to the definition.rb
- Note: :os_type_id = The internal Name Virtualbox uses for that Distribution
@@ -104,11 +104,11 @@ I suggest the easiest way is to get an account on github and fork of the veewee
If you don't use rvm, be sure to execute vagrant through bundle exec
- $ alias vagrant="bundle exec vagrant"
+ $ alias veewee="bundle exec veewee"
Start of an existing one
- $ veewee vbox basebox define 'mynewos' 'ubuntu...'
+ $ veewee vbox define 'mynewos' 'ubuntu...'
- Do changes in the currentdir/definitions/mynewos
- When it builds ok, move the definition/mynewos to a sensible directory under templates
View
8 lib/fission.rb
@@ -5,9 +5,10 @@
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
-require 'fission/error'
+#require 'fission/error'
require 'fission/cli'
require 'fission/command'
+require 'fission/command_helpers'
require 'fission/command/clone'
require 'fission/command/snapshot_create'
require 'fission/command/snapshot_list'
@@ -16,12 +17,12 @@
require 'fission/command/status'
require 'fission/command/stop'
require 'fission/command/suspend'
-require 'fission/command/delete'
require 'fission/config'
require 'fission/core_ext/class'
require 'fission/core_ext/file'
require 'fission/core_ext/object'
require 'fission/fusion'
+require 'fission/lease'
require 'fission/metadata'
require 'fission/response'
require 'fission/ui'
@@ -35,7 +36,4 @@ def config
@config ||= Fission::Config.new
end
- def ui
- @ui ||= Fission::UI.new
- end
end
View
76 lib/fission/cli.rb
@@ -1,76 +0,0 @@
-module Fission
- class CLI
- def self.execute(args=ARGV)
- optparse = OptionParser.new do |opts|
- opts.banner = "\nUsage: fission [options] COMMAND [arguments]"
-
- opts.on_head('-v', '--version', 'Output the version of fission') do
- Fission.ui.output Fission::VERSION
- exit(0)
- end
-
- opts.on_head('-h', '--help', 'Displays this message') do
- show_all_help(optparse)
- exit(0)
- end
-
- opts.define_tail do
- commands_banner
- end
-
- end
-
- begin
- optparse.order! args
- rescue OptionParser::InvalidOption => e
- Fission.ui.output e
- show_all_help(optparse)
- exit(1)
- end
-
- if commands.include?(args.first)
- @cmd = Fission::Command.const_get(args.first.capitalize).new args.drop 1
- elsif is_snapshot_command?(args)
- klass = args.take(2).map {|c| c.capitalize}.join('')
- @cmd = Fission::Command.const_get(klass).new args.drop 2
- else
- show_all_help(optparse)
- exit(1)
- end
-
- begin
- @cmd.execute
- rescue Error => e
- puts "Error: #{e}"
- end
- end
-
- def self.commands
- cmds = Dir.entries(File.join(File.dirname(__FILE__), 'command')).select do |file|
- !File.directory? file
- end
-
- cmds.map { |cmd| File.basename(cmd, '.rb').gsub '_', ' ' }
- end
-
- private
- def self.is_snapshot_command?(args)
- args.first == 'snapshot' && args.count > 1 && commands.include?(args.take(2).join(' '))
- end
-
- def self.commands_banner
- text = "\nCommands:\n"
- Fission::Command.descendants.each do |command_klass|
- text << (command_klass.send :help)
- end
-
- text
- end
-
- def self.show_all_help(options)
- Fission.ui.output options
- Fission.ui.output commands_banner
- end
-
- end
-end
View
15 lib/fission/command.rb
@@ -1,15 +0,0 @@
-module Fission
- class Command
- attr_reader :options, :args
-
- def initialize(args=[])
- @options = OpenStruct.new
- @args = args
- end
-
- def self.help
- self.new.option_parser.to_s
- end
-
- end
-end
View
68 lib/fission/command/clone.rb
@@ -1,68 +0,0 @@
-module Fission
- class Command
- class Clone < Command
-
- def initialize(args=[])
- super
- @options.start = false
- end
-
- def execute
- option_parser.parse! @args
-
- unless @args.count > 1
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for clone command", 1
- end
-
- source_vm_name = @args.first
- target_vm_name = @args[1]
- source_vm=Fission::VM.new(source_vm_name)
- target_vm=Fission::VM.new(target_vm_name)
-
- unless source_vm.exists?
- Fission.ui.output_and_exit "Unable to find the source vm #{source_vm_name} (#{source_vm.path})", 1
- end
-
- if target_vm.exists?
- Fission::ui.output_and_exit "The target vm #{target_vm_name} already exists", 1
- end
-
- clone_task = Fission::VM.clone source_vm_name, target_vm_name
-
- if clone_task.successful?
- Fission.ui.output ''
- Fission.ui.output 'Clone complete!'
-
- if @options.start
- Fission.ui.output "Starting '#{target_vm_name}'"
-
- start_task = target_vm.start
-
- if start_task.successful?
- Fission.ui.output "VM '#{target_vm_name}' started"
- else
- Fission.ui.output_and_exit "There was an error starting the VM. The error was:\n#{start_task.output}", start_task.code
- end
- end
- else
- Fission.ui.output_and_exit "There was an error cloning the VM. The error was:\n#{clone_task.output}", clone_task.code
- end
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nclone usage: fission clone source_vm target_vm [options]"
-
- opts.on '--start', 'Start the VM after cloning' do
- @options.start = true
- end
- end
-
- optparse
- end
-
- end
- end
-end
View
71 lib/fission/command/delete.rb
@@ -1,71 +0,0 @@
-module Fission
- class Command
- class Delete < Command
-
- def initialize(args=[])
- super
- @options.force = false
- end
-
- def execute
- option_parser.parse! @args
-
- if @args.count < 1
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for delete command", 1
- end
-
- target_vm_name = @args.first
- target_vm=Fission::VM.new(target_vm_name)
- unless target_vm.exists?
- Fission.ui.output_and_exit "Vm #{target_vm_name} does not exist at (#{target_vm.path})", 1
- end
-
- if target_vm.running?
- Fission.ui.output 'VM is currently running'
- if @options.force
- Fission.ui.output 'Going to stop it'
- Fission::Command::Stop.new([target_vm_name]).execute
- else
- Fission.ui.output_and_exit "Either stop/suspend the VM or use '--force' and try again.", 1
- end
- end
-
-
- if Fission::Fusion.running?
- Fission.ui.output 'It looks like the Fusion GUI is currently running'
-
- if @options.force
- Fission.ui.output 'The Fusion metadata for the VM may not be removed completely'
- else
- Fission.ui.output "Either exit the Fusion GUI or use '--force' and try again"
- Fission.ui.output_and_exit "NOTE: Forcing a VM deletion with the Fusion GUI running may not clean up all of the VM metadata", 1
- end
- end
-
- delete_task = Fission::VM.delete target_vm_name
-
- if delete_task.successful?
- Fission.ui.output ''
- Fission.ui.output "Deletion complete!"
- else
- Fission.ui.output_and_exit "There was an error deleting the VM. The error was:\n#{delete_task.output}", delete_task.code
- end
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\ndelete usage: fission delete target_vm [--force]"
-
- opts.on '--force', "Stop the VM if it's running and then delete it" do
- @options.force = true
- end
- end
-
- optparse
- end
-
- end
- end
-end
View
52 lib/fission/command/snapshot_create.rb
@@ -1,52 +0,0 @@
-module Fission
- class Command
- class SnapshotCreate < Command
-
- def initialize(args=[])
- super
- end
-
- def execute
- unless @args.count == 2
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for snapshot create command", 1
- end
-
- vm_name, snap_name = @args.take 2
-
- vm = Fission::VM.new vm_name
- unless vm.exists?
- Fission.ui.output_and_exit "Unable to find the VM #{vm_name} (#{Fission::VM.path(vm_name)})", 1
- end
-
- unless vm.running?
- Fission.ui.output "VM '#{vm_name}' is not running"
- Fission.ui.output_and_exit 'A snapshot cannot be created unless the VM is running', 1
- end
-
- if vm.snapshots.include? snap_name
- Fission.ui.output_and_exit "VM '#{vm_name}' already has a snapshot named '#{snap_name}'", 1
- end
-
- Fission.ui.output "Creating snapshot"
- task = vm.create_snapshot(snap_name)
-
- if task.successful?
- Fission.ui.output "Snapshot '#{snap_name}' created"
- else
- Fission.ui.output_and_exit "There was an error creating the snapshot. The error was:\n#{task.output}", task.code
- end
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nsnapshot create: fission snapshot create my_vm snapshot_1"
- end
-
- optparse
- end
-
- end
- end
-end
View
45 lib/fission/command/snapshot_list.rb
@@ -1,45 +0,0 @@
-module Fission
- class Command
- class SnapshotList < Command
-
- def initialize(args=[])
- super
- end
-
- def execute
- unless @args.count == 1
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for snapshot list command", 1
- end
-
- vm_name = @args.first
-
- vm = Fission::VM.new vm_name
-
- unless vm.exists?
- Fission.ui.output_and_exit "Unable to find the VM #{vm_name} (#{vm.path})", 1
- end
-
- snaps=vm.snapshots
- unless snaps.empty?
- Fission.ui.output snaps.join("\n")
- else
- Fission.ui.output "No snapshots found for VM '#{vm_name}'"
- end
-
- # TODO
- Fission.ui.output_and_exit "There was an error listing the snapshots. The error was:\n#{task.output}", task.code
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nsnapshot list: fission snapshot list my_vm"
- end
-
- optparse
- end
-
- end
- end
-end
View
54 lib/fission/command/snapshot_revert.rb
@@ -1,54 +0,0 @@
-module Fission
- class Command
- class SnapshotRevert < Command
-
- def initialize(args=[])
- super
- end
-
- def execute
- unless @args.count == 2
- Fission.ui.output self.class.help
- Fission.ui.output ''
- Fission.ui.output_and_exit 'Incorrect arguments for snapshot revert command', 1
- end
-
- vm_name, snap_name = @args.take 2
- vm = Fission::VM.new vm_name
-
- unless vm.exists? vm_name
- Fission.ui.output_and_exit "Unable to find the VM #{vm_name} (#{Fission::VM.path(vm_name)})", 1
- end
-
- if Fission::Fusion.running?
- Fission.ui.output 'It looks like the Fusion GUI is currently running'
- Fission.ui.output_and_exit 'Please exit the Fusion GUI and try again', 1
- end
-
- snaps = vm.snapshots
-
- unless snaps.include? snap_name
- Fission.ui.output_and_exit "Unable to find the snapshot '#{snap_name}'", 1
- end
-
- Fission.ui.output "Reverting to snapshot '#{snap_name}'"
- task = vm.revert_to_snapshot snap_name
-
- if task.successful?
- Fission.ui.output "Reverted to snapshot '#{snap_name}'"
- else
- Fission.ui.output_and_exit "There was an error reverting to the snapshot. The error was:\n#{task.output}", task.code
- end
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nsnapshot revert: fission snapshot revert my_vm snapshot_1"
- end
-
- optparse
- end
-
- end
- end
-end
View
69 lib/fission/command/start.rb
@@ -1,69 +0,0 @@
-module Fission
- class Command
- class Start < Command
-
- def initialize(args=[])
- super
- @options.headless = false
- end
-
- def execute
- option_parser.parse! @args
-
- if @args.empty?
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for start command", 1
- end
-
- vm_name = @args.first
-
- vm = Fission::VM.new(vm_name)
-
- unless vm.exists?
- Fission.ui.output_and_exit "Unable to find the VM #{vm_name} (#{Fission::VM.path(vm_name)})", 1
- end
-
- if vm.running?
- Fission.ui.output ''
- Fission.ui.output_and_exit "VM '#{vm_name}' is already running", 0
- end
-
- Fission.ui.output "Starting '#{vm_name}'"
- start_args = {}
-
- if @options.headless
-
- if Fission::Fusion.running?
- Fission.ui.output 'It looks like the Fusion GUI is currently running'
- Fission.ui.output 'A VM cannot be started in headless mode when the Fusion GUI is running'
- Fission.ui.output_and_exit "Exit the Fusion GUI and try again", 1
- else
- start_args[:headless] = true
- end
- end
-
- task = vm.start(start_args)
-
- if task.successful?
- Fission.ui.output "VM '#{vm_name}' started"
- else
- Fission.ui.output_and_exit "There was a problem starting the VM. The error was:\n#{task.output}", task.code
- end
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nstart usage: fission start vm [options]"
-
- opts.on '--headless', 'Start the VM in headless mode (i.e. no Fusion GUI console)' do
- @options.headless = true
- end
- end
-
- optparse
- end
-
- end
- end
-end
View
31 lib/fission/command/status.rb
@@ -1,31 +0,0 @@
-module Fission
- class Command
- class Status < Command
-
- def initialize(args=[])
- super
- end
-
- def execute
-
- all_vms=Fission::VM.all
- vm_with_longest_name = all_vms.max { |a,b| a.name.length <=> b.name.length }
- max_name_length=vm_with_longest_name.name.length
- all_vms.each do |vm|
- status = vm.state
- Fission.ui.output_printf "%-#{max_name_length}s %s\n", vm.name, "["+status+"]"
- end
-
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nstatus usage: fission status"
- end
-
- optparse
- end
-
- end
- end
-end
View
49 lib/fission/command/stop.rb
@@ -1,49 +0,0 @@
-module Fission
- class Command
- class Stop < Command
-
- def initialize(args=[])
- super
- end
-
- def execute
- unless @args.count == 1
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for stop command", 1
- end
-
- vm_name = @args.first
- vm = Fission::VM.new vm_name
-
- unless vm.exists?
- Fission.ui.output_and_exit "VM #{vm_name} does not exist at (#{vm.path})", 1
- end
-
-
- unless vm.running?
- Fission.ui.output ''
- Fission.ui.output_and_exit "VM '#{vm_name}' is not running", 0
- end
-
- Fission.ui.output "Stopping '#{vm_name}'"
- task = vm.stop
-
- if task.successful?
- Fission.ui.output "VM '#{vm_name}' stopped"
- else
- Fission.ui.output_and_exit "There was an error stopping the VM. The error was:\n#{response.output}", response.code
- end
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nstop usage: fission stop vm"
- end
-
- optparse
- end
-
- end
- end
-end
View
67 lib/fission/command/suspend.rb
@@ -1,67 +0,0 @@
-module Fission
- class Command
- class Suspend < Command
-
- def initialize(args=[])
- super
- @options.all = false
- end
-
- def execute
- option_parser.parse! @args
-
- if @args.count != 1 && !@options.all
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for suspend command", 1
- end
-
- vms_to_suspend.each do |vm|
- Fission.ui.output "Suspending '#{vm.name}'"
- task = vm.suspend
-
- if task.successful?
- Fission.ui.output "VM '#{vm.name}' suspended"
- else
- Fission.ui.output_and_exit "There was an error suspending the VM. The error was:\n#{task.output}", task.code
- end
- end
- end
-
- def vms_to_suspend
- if @options.all
- vms=Fission::VM.all_running
- else
- vm_name = @args.first
- vm=Fission::VM.new(vm_name)
-
- unless vm.exists?
- Fission.ui.output ''
- Fission.ui.output_and_exit "VM #{vm_name} does not exist (#{Fission::VM.path(vm_name)})", 1
- end
-
- unless vm.running?
- Fission.ui.output ''
- Fission.ui.output_and_exit "VM '#{vm_name}' is not running", 1
- end
-
- vms = [vm]
- end
- vms
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nsuspend usage: fission suspend [vm | --all]"
-
- opts.on '--all', 'Suspend all running VMs' do
- @options.all = true
- end
- end
-
- optparse
- end
-
- end
- end
-end
View
57 lib/fission/config.rb
@@ -1,24 +1,71 @@
module Fission
class Config
+
+ # Public: Gets/Sets the Hash of attributes.
attr_accessor :attributes
+ # Public: Path to the Fission conf file (default: ~/.fissionrc).
CONF_FILE = File.expand_path '~/.fissionrc'
+ # Public: Initializes a Config object. This also sets the default config
+ # attributes for 'vmrun_bin', 'vmrun_cmd', 'vm_dir', 'plist_file', and
+ # 'gui_bin'.
+ #
+ # Examples
+ #
+ # Fission::Config.new
+ #
+ # Returns a new Config instance.
def initialize
@attributes = {}
- load_from_file
- if @attributes['vm_dir'].blank?
- @attributes['vm_dir'] = File.expand_path('~/Documents/Virtual Machines.localized/')
+ @attributes['vm_dir'] = File.expand_path('~/Documents/Virtual Machines.localized/')
+ @attributes['lease_file'] = '/var/db/vmware/vmnet-dhcpd-vmnet8.leases'
+
+ fusion_version = :unknown
+
+ if File.exists?("/Library/Application Support/VMware Fusion/vmrun")
+ @attributes['vmrun_bin'] = '/Library/Application Support/VMware Fusion/vmrun'
+ end
+
+ if File.exists?("/Applications/VMware Fusion.app/Contents/Library/vmrun")
+ @attributes['vmrun_bin'] = "/Applications/VMware Fusion.app/Contents/Library/vmrun"
+ end
+
+ if fusion_version == :unknown
end
- @attributes['vmrun_bin'] = '/Library/Application Support/VMware Fusion/vmrun'
- @attributes['vmrun_cmd'] = "#{@attributes['vmrun_bin'].gsub(' ', '\ ')} -T fusion"
@attributes['plist_file'] = File.expand_path('~/Library/Preferences/com.vmware.fusion.plist')
@attributes['gui_bin'] = File.expand_path('/Applications/VMware Fusion.app/Contents/MacOS/vmware')
+
+ load_from_file
+
+ @attributes['vmrun_cmd'] = "#{@attributes['vmrun_bin'].gsub(' ', '\ ')} -T fusion"
+ end
+
+ # Public: Helper method to access config atributes. This is a shortcut for
+ # querying the config attributes.
+ #
+ # item - The config item to query.
+ #
+ # Examples
+ #
+ # Fission.config['vmrun_bin']
+ # # => '/foo/bar/vmrun'
+ #
+ # Returns the value of the specified config item.
+ def [](item)
+ @attributes[item]
end
private
+ # Internal: Loads config values from the Fission conf file into attributes.
+ #
+ # Examples
+ #
+ # load_from_file
+ #
+ # Returns nothing.
def load_from_file
if File.file?(CONF_FILE)
@attributes.merge!(YAML.load_file(CONF_FILE))
View
5 lib/fission/core_ext/class.rb
@@ -1,5 +0,0 @@
-class Class
- def descendants
- ObjectSpace.each_object(Class).select { |klass| klass < self }
- end
-end
View
7 lib/fission/core_ext/file.rb
@@ -1,7 +0,0 @@
-class File
- # from ptools
- def self.binary?(file)
- s = (File.read(file, File.stat(file).blksize) || "").split(//)
- ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
- end
-end
View
112 lib/fission/core_ext/object.rb
@@ -1,112 +0,0 @@
-# this is from active_support
-# github.com/rails/rails/activesupport
-#
-class Object
- # An object is blank if it's false, empty, or a whitespace string.
- # For example, "", " ", +nil+, [], and {} are blank.
- #
- # This simplifies:
- #
- # if !address.nil? && !address.empty?
- #
- # ...to:
- #
- # if !address.blank?
- def blank?
- respond_to?(:empty?) ? empty? : !self
- end
-
- # An object is present if it's not <tt>blank?</tt>.
- def present?
- !blank?
- end
-
- # Returns object if it's <tt>present?</tt> otherwise returns +nil+.
- # <tt>object.presence</tt> is equivalent to <tt>object.present? ? object : nil</tt>.
- #
- # This is handy for any representation of objects where blank is the same
- # as not present at all. For example, this simplifies a common check for
- # HTTP POST/query parameters:
- #
- # state = params[:state] if params[:state].present?
- # country = params[:country] if params[:country].present?
- # region = state || country || 'US'
- #
- # ...becomes:
- #
- # region = params[:state].presence || params[:country].presence || 'US'
- def presence
- self if present?
- end
-end
-
-class NilClass
- # +nil+ is blank:
- #
- # nil.blank? # => true
- #
- def blank?
- true
- end
-end
-
-class FalseClass
- # +false+ is blank:
- #
- # false.blank? # => true
- #
- def blank?
- true
- end
-end
-
-class TrueClass
- # +true+ is not blank:
- #
- # true.blank? # => false
- #
- def blank?
- false
- end
-end
-
-class Array
- # An array is blank if it's empty:
- #
- # [].blank? # => true
- # [1,2,3].blank? # => false
- #
- alias_method :blank?, :empty?
-end
-
-class Hash
- # A hash is blank if it's empty:
- #
- # {}.blank? # => true
- # {:key => 'value'}.blank? # => false
- #
- alias_method :blank?, :empty?
-end
-
-class String
- # A string is blank if it's empty or contains whitespaces only:
- #
- # "".blank? # => true
- # " ".blank? # => true
- # " something here ".blank? # => false
- #
- def blank?
- self !~ /\S/
- end
-end
-
-class Numeric #:nodoc:
- # No number is blank:
- #
- # 1.blank? # => false
- # 0.blank? # => false
- #
- def blank?
- false
- end
-end
View
9 lib/fission/error.rb
@@ -1,9 +0,0 @@
-module Fission
- class Error < StandardError
- attr_reader :orginal
- def initialize(msg, original=$!)
- super(msg)
- @original = original; end
- end
-end
-
View
17 lib/fission/fusion.rb
@@ -1,17 +0,0 @@
-module Fission
- class Fusion
-
- def self.running?
- command = "ps -ef | grep -v grep | grep -c "
- command << "#{Fission.config.attributes['gui_bin'].gsub(' ', '\ ')} 2>&1"
- output = `#{command}`
-
- response = Fission::Response.new :code => 0
-
- output.strip.to_i > 0 ? response.data = true : response.data = false
-
- response
- end
-
- end
-end
View
74 lib/fission/leasesfile.rb
@@ -1,74 +0,0 @@
-require 'date'
-
-class Lease
- attr_accessor :name,:mac,:start,:end,:ip
-
- def initialize(name)
- @name=name
- @ip=name
- end
-
- def expired?
- @end < DateTime.now
- end
-end
-
-class LeasesFile
-
- attr_reader :leases
-
- def initialize(filename)
- @filename=filename
- @leases=Array.new
- load
- end
-
- def load
- @leases=Array.new
- File.open(@filename,"r") do |leasefile|
- lease=nil
- while (line = leasefile.gets)
-
- line=line.lstrip.gsub(';','')
- case line
- when /^lease/
- @leases << lease unless lease.nil?
- name=line.split(' ')[1]
- lease=Lease.new(name)
- when /^hardware/
- lease.mac=line.split(" ")[2]
- when /^starts/
- lease.start=DateTime.parse(line.split(" ")[2..3].join(" "))
- when /^ends/
- lease.end=DateTime.parse(line.split(" ")[2..3].join(" "))
- end
-
- end
- @leases << lease unless lease.nil?
- end
- return @leases
- end
-
- def all_leases
- return @leases
- end
-
- def current_leases
- hash_list=Hash.new
- @leases.each do |lease|
- hash_list[lease.name]=lease
- end
- collapsed_list=Array.new
- hash_list.each do |key,value|
- collapsed_list << value
- end
- return collapsed_list
- end
-
- def find_lease_by_mac(mac)
- matches=current_leases.select{|l| l.mac==mac}
- return nil if matches.nil?
- return matches[0]
- end
-
-end
View
39 lib/fission/metadata.rb
@@ -1,39 +0,0 @@
-module Fission
- class Metadata
-
- require 'cfpropertylist'
-
- attr_accessor :content
-
- def self.delete_vm_info(vm_path)
- metadata = new
- metadata.load
- metadata.delete_vm_restart_document(vm_path)
- metadata.delete_vm_favorite_entry(vm_path)
- metadata.save
- end
-
- def load
- raw_data = CFPropertyList::List.new :file => Fission.config.attributes['plist_file']
- @content = CFPropertyList.native_types raw_data.value
- end
-
- def save
- new_content = CFPropertyList::List.new
- new_content.value = CFPropertyList.guess @content
- new_content.save Fission.config.attributes['plist_file'],
- CFPropertyList::List::FORMAT_BINARY
- end
-
- def delete_vm_restart_document(vm_path)
- if @content.has_key?('PLRestartDocumentPaths')
- @content['PLRestartDocumentPaths'].delete_if { |p| p == vm_path }
- end
- end
-
- def delete_vm_favorite_entry(vm_path)
- @content['VMFavoritesListDefaults2'].delete_if { |vm| vm['path'] == vm_path }
- end
-
- end
-end
View
16 lib/fission/response.rb
@@ -1,16 +0,0 @@
-module Fission
- class Response
- attr_accessor :code, :output, :data
-
- def initialize(args={})
- @code = args.fetch :code, 1
- @output = args.fetch :output, ''
- @data = args.fetch :data, nil
- end
-
- def successful?
- @code == 0
- end
-
- end
-end
View
22 lib/fission/ui.rb
@@ -1,22 +0,0 @@
-module Fission
- class UI
- attr_reader :stdout
-
- def initialize(stdout=$stdout)
- @stdout = stdout
- end
-
- def output(s)
- @stdout.puts s
- end
-
- def output_printf(string, key, value)
- @stdout.send :printf, string, key, value
- end
-
- def output_and_exit(s, exit_code)
- output s
- exit exit_code
- end
- end
-end
View
3 lib/fission/version.rb
@@ -1,3 +0,0 @@
-module Fission
- VERSION = "0.4.0a"
-end
View
361 lib/fission/vm.rb
@@ -1,361 +0,0 @@
-require 'fission/leasesfile'
-require 'shellwords'
-require 'fission/error'
-
-module Fission
- class VM
- attr_reader :name
-
- def initialize(name)
- @name = name
- end
-
- #####################################################
- # Path Helpers
- #####################################################
- # Returns the topdir of the vm
- def path
- File.join Fission.config.attributes['vm_dir'], "#{@name}.vmwarevm"
- end
-
- # Returns a string to the path of the config file
- # There is no guarantee it exists
- def vmx_path
- return File.join(path, "#{@name}.vmx")
- end
-
-
- ####################################################################
- # State information
- ####################################################################
- def running?
- raise Fission::Error,"VM #{@name} does not exist" unless self.exists?
-
- command = "#{vmrun_cmd} list"
- output = `#{command}`
-
- response = Fission::Response.new :code => $?.exitstatus
-
- if response.successful?
- vms = output.split("\n").select do |vm|
- vm.include?('.vmx') && File.exists?(vm) && File.extname(vm) == '.vmx'
- end
- return vms.include?(self.vmx_path)
- else
- raise Fission::Error,"Error listing the state of vm #{@name}:\n#{output}"
- end
- end
-
- def suspended?
- raise Fission::Error,"VM #{@name} does not exist" unless self.exists?
-
- suspend_filename=File.join(File.dirname(vmx_path), File.basename(vmx_path,".vmx")+".vmem")
- return File.exists?(suspend_filename)
- end
-
- # Checks to see if a vm exists
- def exists?
- File.exists? vmx_path
- end
-
- # Returns the state of a vm
- def state
- return "not created" unless self.exists?
-