vagrant-skytap 0.1.11 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (342) hide show
  1. checksums.yaml +4 -4
  2. data/.byebug_history +242 -19
  3. data/CHANGELOG.md +9 -0
  4. data/README.md +30 -8
  5. data/Vagrantfile.rej +83 -0
  6. data/_patches-20160112/0 +388 -0
  7. data/_patches-20160112/1 +82 -0
  8. data/_patches-20160112/2 +239 -0
  9. data/_patches-20160112/COMPLETED-ABOVE-THIS-LINE +4 -0
  10. data/_patches-20160112/COMPLETED-BELOW-THIS-LINE +4 -0
  11. data/_patches-20160112/CR-ABOVE-THIS-LINE +4 -0
  12. data/_patches-20160112/CR-BELOW-THIS-LINE +4 -0
  13. data/_patches-20160112/WIP-ABOVE-THIS-LINE +4 -0
  14. data/_patches-20160112/WIP-BELOW-THIS-LINE +4 -0
  15. data/_patches-20160112/acceptance-test-runner +29 -0
  16. data/_patches-20160112/ansible-1 +92 -0
  17. data/_patches-20160112/cache-api-client-in-up +40 -0
  18. data/_patches-20160112/dead-code-in-actions +44 -0
  19. data/_patches-20160112/debug-changes +42 -0
  20. data/_patches-20160112/demo-rails-app +1276 -0
  21. data/_patches-20160112/eng-10166-halt-spec +40 -0
  22. data/_patches-20160112/eng-10256 +527 -0
  23. data/_patches-20160112/eng-10256-2 +162 -0
  24. data/_patches-20160112/eng-10256-ubuntu-testing +88 -0
  25. data/_patches-20160112/eng-10269-test-stuff +87 -0
  26. data/_patches-20160112/eng-10269-wtf +119 -0
  27. data/_patches-20160112/eng-10369 +143 -0
  28. data/_patches-20160112/eng-10369-tmp +60 -0
  29. data/_patches-20160112/eng-10919 +56 -0
  30. data/_patches-20160112/eng-11177-fix-actions-requires +44 -0
  31. data/_patches-20160112/eng-11442 +4 -0
  32. data/_patches-20160112/eng-11616 +403 -0
  33. data/_patches-20160112/eng-11616-2 +67 -0
  34. data/_patches-20160112/eng-11616-actual +184 -0
  35. data/_patches-20160112/eng-11625a +4 -0
  36. data/_patches-20160112/eng-11711 +85 -0
  37. data/_patches-20160112/eng-12232-command-spec +236 -0
  38. data/_patches-20160112/eng-12235 +83 -0
  39. data/_patches-20160112/eng-12235-override-refactor +140 -0
  40. data/_patches-20160112/eng-12240 +103 -0
  41. data/_patches-20160112/eng-12249 +40 -0
  42. data/_patches-20160112/eng-12301 +50 -0
  43. data/_patches-20160112/eng-12843 +95 -0
  44. data/_patches-20160112/env-source +112 -0
  45. data/_patches-20160112/frickin-vagrant-spec +163 -0
  46. data/_patches-20160112/gem-pre-version +14 -0
  47. data/_patches-20160112/gems-old +9 -0
  48. data/_patches-20160112/googles-specs +713 -0
  49. data/_patches-20160112/local-configs-ignore +61 -0
  50. data/_patches-20160112/misc +79 -0
  51. data/_patches-20160112/network-unreachable +31 -0
  52. data/_patches-20160112/new-boxfile +288 -0
  53. data/_patches-20160112/parallelization-maybe +198 -0
  54. data/_patches-20160112/read-state +23 -0
  55. data/_patches-20160112/refactor-to-use-public_address-cap +25 -0
  56. data/_patches-20160112/series +60 -0
  57. data/_patches-20160112/status +12 -0
  58. data/_patches-20160112/test-move-env-data +231 -0
  59. data/_patches-20160112/test-vagrantfile-vm1 +167 -0
  60. data/_patches-20160112/the_version_in_0.1.13.pre1 +598 -0
  61. data/_patches-20160112/vagrant-spec-mock-api +137 -0
  62. data/_patches-20160112/vagrant-vmware-plugin +233 -0
  63. data/_patches-20160112/vagrantfile +403 -0
  64. data/_patches-20160112/vagrantfile-for-acceptance-tests +29 -0
  65. data/_patches-20160112/vagrantfile-for-nick +95 -0
  66. data/_patches-20160112/vagrantfiles-to-forget-what-they-are-for +134 -0
  67. data/_patches-20160112/vm-vanished +42 -0
  68. data/_patches-20160112a/01 +148 -0
  69. data/_patches-20160112a/2 +239 -0
  70. data/_patches-20160112a/COMPLETED-ABOVE-THIS-LINE +4 -0
  71. data/_patches-20160112a/COMPLETED-BELOW-THIS-LINE +4 -0
  72. data/_patches-20160112a/CR-ABOVE-THIS-LINE +4 -0
  73. data/_patches-20160112a/CR-BELOW-THIS-LINE +4 -0
  74. data/_patches-20160112a/WIP-ABOVE-THIS-LINE +4 -0
  75. data/_patches-20160112a/WIP-BELOW-THIS-LINE +4 -0
  76. data/_patches-20160112a/acceptance-test-runner +29 -0
  77. data/_patches-20160112a/ansible-1 +92 -0
  78. data/_patches-20160112a/cache-api-client-in-up +40 -0
  79. data/_patches-20160112a/dead-code-in-actions +44 -0
  80. data/_patches-20160112a/debug-changes +42 -0
  81. data/_patches-20160112a/demo-rails-app +1276 -0
  82. data/_patches-20160112a/eng-10166-halt-spec +40 -0
  83. data/_patches-20160112a/eng-10256-ubuntu-testing +88 -0
  84. data/_patches-20160112a/eng-10269-test-stuff +87 -0
  85. data/_patches-20160112a/eng-10269-wtf +119 -0
  86. data/_patches-20160112a/eng-10369 +143 -0
  87. data/_patches-20160112a/eng-10369-tmp +60 -0
  88. data/_patches-20160112a/eng-10919 +56 -0
  89. data/_patches-20160112a/eng-11177-fix-actions-requires +44 -0
  90. data/_patches-20160112a/eng-11442 +4 -0
  91. data/_patches-20160112a/eng-11616 +403 -0
  92. data/_patches-20160112a/eng-11616-2 +67 -0
  93. data/_patches-20160112a/eng-11616-actual +184 -0
  94. data/_patches-20160112a/eng-11625a +4 -0
  95. data/_patches-20160112a/eng-11711 +85 -0
  96. data/_patches-20160112a/eng-12232-command-spec +236 -0
  97. data/_patches-20160112a/eng-12235 +83 -0
  98. data/_patches-20160112a/eng-12235-override-refactor +140 -0
  99. data/_patches-20160112a/eng-12240 +103 -0
  100. data/_patches-20160112a/eng-12249 +40 -0
  101. data/_patches-20160112a/eng-12301 +50 -0
  102. data/_patches-20160112a/eng-12843 +95 -0
  103. data/_patches-20160112a/env-source +112 -0
  104. data/_patches-20160112a/frickin-vagrant-spec +163 -0
  105. data/_patches-20160112a/gem-pre-version +14 -0
  106. data/_patches-20160112a/gems-old +9 -0
  107. data/_patches-20160112a/googles-specs +713 -0
  108. data/_patches-20160112a/local-configs-ignore +61 -0
  109. data/_patches-20160112a/misc +79 -0
  110. data/_patches-20160112a/network-unreachable +31 -0
  111. data/_patches-20160112a/new-boxfile +288 -0
  112. data/_patches-20160112a/parallelization-maybe +198 -0
  113. data/_patches-20160112a/read-state +23 -0
  114. data/_patches-20160112a/refactor-to-use-public_address-cap +25 -0
  115. data/_patches-20160112a/series +58 -0
  116. data/_patches-20160112a/status +14 -0
  117. data/_patches-20160112a/test-move-env-data +231 -0
  118. data/_patches-20160112a/test-vagrantfile-vm1 +167 -0
  119. data/_patches-20160112a/the_version_in_0.1.13.pre1 +612 -0
  120. data/_patches-20160112a/then-copy-the-newer-files +632 -0
  121. data/_patches-20160112a/vagrant-spec-mock-api +137 -0
  122. data/_patches-20160112a/vagrant-vmware-plugin +233 -0
  123. data/_patches-20160112a/vagrantfile +403 -0
  124. data/_patches-20160112a/vagrantfile-for-acceptance-tests +29 -0
  125. data/_patches-20160112a/vagrantfile-for-nick +95 -0
  126. data/_patches-20160112a/vagrantfiles-to-forget-what-they-are-for +134 -0
  127. data/_patches-20160112a/vm-vanished +42 -0
  128. data/_patches-20160113/COMPLETED-ABOVE-THIS-LINE +4 -0
  129. data/_patches-20160113/COMPLETED-BELOW-THIS-LINE +4 -0
  130. data/_patches-20160113/CR-ABOVE-THIS-LINE +4 -0
  131. data/_patches-20160113/CR-BELOW-THIS-LINE +4 -0
  132. data/_patches-20160113/WIP-ABOVE-THIS-LINE +4 -0
  133. data/_patches-20160113/WIP-BELOW-THIS-LINE +4 -0
  134. data/_patches-20160113/acceptance-test-runner +29 -0
  135. data/_patches-20160113/ansible-1 +92 -0
  136. data/_patches-20160113/cache-api-client-in-up +40 -0
  137. data/_patches-20160113/dead-code-in-actions +44 -0
  138. data/_patches-20160113/debug-changes +55 -0
  139. data/_patches-20160113/demo-rails-app +1276 -0
  140. data/_patches-20160113/eng-10166-halt-spec +40 -0
  141. data/_patches-20160113/eng-10256 +543 -0
  142. data/_patches-20160113/eng-10256-ubuntu-testing +88 -0
  143. data/_patches-20160113/eng-10269-test-stuff +87 -0
  144. data/_patches-20160113/eng-10269-wtf +119 -0
  145. data/_patches-20160113/eng-10369 +143 -0
  146. data/_patches-20160113/eng-10369-tmp +60 -0
  147. data/_patches-20160113/eng-10919 +56 -0
  148. data/_patches-20160113/eng-11177-fix-actions-requires +44 -0
  149. data/_patches-20160113/eng-11442 +4 -0
  150. data/_patches-20160113/eng-11616 +403 -0
  151. data/_patches-20160113/eng-11616-2 +67 -0
  152. data/_patches-20160113/eng-11616-actual +184 -0
  153. data/_patches-20160113/eng-11625a +4 -0
  154. data/_patches-20160113/eng-11711 +85 -0
  155. data/_patches-20160113/eng-12232-command-spec +236 -0
  156. data/_patches-20160113/eng-12235 +83 -0
  157. data/_patches-20160113/eng-12235-override-refactor +140 -0
  158. data/_patches-20160113/eng-12240 +103 -0
  159. data/_patches-20160113/eng-12249 +40 -0
  160. data/_patches-20160113/eng-12301 +50 -0
  161. data/_patches-20160113/eng-12720 +47 -0
  162. data/_patches-20160113/eng-12843 +95 -0
  163. data/_patches-20160113/env-source +112 -0
  164. data/_patches-20160113/frickin-vagrant-spec +163 -0
  165. data/_patches-20160113/gem-pre-version +14 -0
  166. data/_patches-20160113/gems-old +9 -0
  167. data/_patches-20160113/googles-specs +713 -0
  168. data/_patches-20160113/local-configs-ignore +61 -0
  169. data/_patches-20160113/misc +79 -0
  170. data/_patches-20160113/network-unreachable +31 -0
  171. data/_patches-20160113/new-boxfile +288 -0
  172. data/_patches-20160113/parallelization-maybe +198 -0
  173. data/_patches-20160113/read-state +23 -0
  174. data/_patches-20160113/refactor-to-use-public_address-cap +25 -0
  175. data/_patches-20160113/series +56 -0
  176. data/_patches-20160113/status +14 -0
  177. data/_patches-20160113/test-move-env-data +231 -0
  178. data/_patches-20160113/test-vagrantfile-vm1 +167 -0
  179. data/_patches-20160113/vagrant-spec-mock-api +137 -0
  180. data/_patches-20160113/vagrant-vmware-plugin +233 -0
  181. data/_patches-20160113/vagrantfile +403 -0
  182. data/_patches-20160113/vagrantfile-for-acceptance-tests +29 -0
  183. data/_patches-20160113/vagrantfile-for-nick +95 -0
  184. data/_patches-20160113/vagrantfiles-to-forget-what-they-are-for +134 -0
  185. data/_patches-20160113/vm-vanished +42 -0
  186. data/_patches-20160118/COMPLETED-ABOVE-THIS-LINE +4 -0
  187. data/_patches-20160118/COMPLETED-BELOW-THIS-LINE +4 -0
  188. data/_patches-20160118/CR-ABOVE-THIS-LINE +4 -0
  189. data/_patches-20160118/CR-BELOW-THIS-LINE +4 -0
  190. data/_patches-20160118/WIP-ABOVE-THIS-LINE +4 -0
  191. data/_patches-20160118/WIP-BELOW-THIS-LINE +4 -0
  192. data/_patches-20160118/acceptance-test-runner +29 -0
  193. data/_patches-20160118/ansible-1 +92 -0
  194. data/_patches-20160118/cache-api-client-in-up +40 -0
  195. data/_patches-20160118/dead-code-in-actions +44 -0
  196. data/_patches-20160118/debug-changes +55 -0
  197. data/_patches-20160118/demo-rails-app +1276 -0
  198. data/_patches-20160118/eng-10166-halt-spec +40 -0
  199. data/_patches-20160118/eng-10256 +554 -0
  200. data/_patches-20160118/eng-10256-cr +314 -0
  201. data/_patches-20160118/eng-10256-ubuntu-testing +88 -0
  202. data/_patches-20160118/eng-10269-test-stuff +87 -0
  203. data/_patches-20160118/eng-10269-wtf +119 -0
  204. data/_patches-20160118/eng-10369 +143 -0
  205. data/_patches-20160118/eng-10369-tmp +60 -0
  206. data/_patches-20160118/eng-10919 +56 -0
  207. data/_patches-20160118/eng-11177-fix-actions-requires +44 -0
  208. data/_patches-20160118/eng-11442 +4 -0
  209. data/_patches-20160118/eng-11616 +403 -0
  210. data/_patches-20160118/eng-11616-2 +67 -0
  211. data/_patches-20160118/eng-11616-actual +184 -0
  212. data/_patches-20160118/eng-11625a +4 -0
  213. data/_patches-20160118/eng-11711 +85 -0
  214. data/_patches-20160118/eng-12232-command-spec +236 -0
  215. data/_patches-20160118/eng-12235 +83 -0
  216. data/_patches-20160118/eng-12235-override-refactor +140 -0
  217. data/_patches-20160118/eng-12240 +103 -0
  218. data/_patches-20160118/eng-12249 +40 -0
  219. data/_patches-20160118/eng-12301 +50 -0
  220. data/_patches-20160118/eng-12720 +74 -0
  221. data/_patches-20160118/eng-12843 +95 -0
  222. data/_patches-20160118/eng-13040 +291 -0
  223. data/_patches-20160118/env-source +112 -0
  224. data/_patches-20160118/frickin-vagrant-spec +163 -0
  225. data/_patches-20160118/gem-pre-version +14 -0
  226. data/_patches-20160118/gems-old +9 -0
  227. data/_patches-20160118/googles-specs +713 -0
  228. data/_patches-20160118/local-configs-ignore +61 -0
  229. data/_patches-20160118/misc +79 -0
  230. data/_patches-20160118/network-unreachable +31 -0
  231. data/_patches-20160118/new-boxfile +288 -0
  232. data/_patches-20160118/parallelization-maybe +198 -0
  233. data/_patches-20160118/port-forwarding-processes +87 -0
  234. data/_patches-20160118/read-state +23 -0
  235. data/_patches-20160118/refactor-to-use-public_address-cap +25 -0
  236. data/_patches-20160118/series +59 -0
  237. data/_patches-20160118/status +13 -0
  238. data/_patches-20160118/test-move-env-data +231 -0
  239. data/_patches-20160118/test-vagrantfile-vm1 +167 -0
  240. data/_patches-20160118/vagrant-spec-mock-api +137 -0
  241. data/_patches-20160118/vagrant-vmware-plugin +233 -0
  242. data/_patches-20160118/vagrantfile +403 -0
  243. data/_patches-20160118/vagrantfile-for-acceptance-tests +29 -0
  244. data/_patches-20160118/vagrantfile-for-nick +95 -0
  245. data/_patches-20160118/vagrantfiles-to-forget-what-they-are-for +134 -0
  246. data/_patches-20160118/vm-vanished +42 -0
  247. data/_patches-20160118a/COMPLETED-ABOVE-THIS-LINE +4 -0
  248. data/_patches-20160118a/COMPLETED-BELOW-THIS-LINE +4 -0
  249. data/_patches-20160118a/CR-ABOVE-THIS-LINE +4 -0
  250. data/_patches-20160118a/CR-BELOW-THIS-LINE +4 -0
  251. data/_patches-20160118a/WIP-ABOVE-THIS-LINE +4 -0
  252. data/_patches-20160118a/WIP-BELOW-THIS-LINE +4 -0
  253. data/_patches-20160118a/acceptance-test-runner +29 -0
  254. data/_patches-20160118a/ansible-1 +92 -0
  255. data/_patches-20160118a/bar +189 -0
  256. data/_patches-20160118a/cache-api-client-in-up +40 -0
  257. data/_patches-20160118a/dead-code-in-actions +44 -0
  258. data/_patches-20160118a/debug-changes +55 -0
  259. data/_patches-20160118a/demo-rails-app +1276 -0
  260. data/_patches-20160118a/eng-10166-halt-spec +40 -0
  261. data/_patches-20160118a/eng-10256 +554 -0
  262. data/_patches-20160118a/eng-10256-cr +314 -0
  263. data/_patches-20160118a/eng-10256-ubuntu-testing +88 -0
  264. data/_patches-20160118a/eng-10269-test-stuff +87 -0
  265. data/_patches-20160118a/eng-10269-wtf +119 -0
  266. data/_patches-20160118a/eng-10369 +143 -0
  267. data/_patches-20160118a/eng-10369-tmp +60 -0
  268. data/_patches-20160118a/eng-10919 +56 -0
  269. data/_patches-20160118a/eng-11177-fix-actions-requires +44 -0
  270. data/_patches-20160118a/eng-11442 +4 -0
  271. data/_patches-20160118a/eng-11616 +403 -0
  272. data/_patches-20160118a/eng-11616-2 +67 -0
  273. data/_patches-20160118a/eng-11616-actual +184 -0
  274. data/_patches-20160118a/eng-11625a +4 -0
  275. data/_patches-20160118a/eng-11711 +85 -0
  276. data/_patches-20160118a/eng-12232-command-spec +236 -0
  277. data/_patches-20160118a/eng-12235 +83 -0
  278. data/_patches-20160118a/eng-12235-override-refactor +140 -0
  279. data/_patches-20160118a/eng-12240 +103 -0
  280. data/_patches-20160118a/eng-12249 +40 -0
  281. data/_patches-20160118a/eng-12301 +50 -0
  282. data/_patches-20160118a/eng-12720 +74 -0
  283. data/_patches-20160118a/eng-12843 +95 -0
  284. data/_patches-20160118a/eng-13040 +291 -0
  285. data/_patches-20160118a/env-source +112 -0
  286. data/_patches-20160118a/foo +169 -0
  287. data/_patches-20160118a/frickin-vagrant-spec +163 -0
  288. data/_patches-20160118a/gem-pre-version +14 -0
  289. data/_patches-20160118a/gems-old +9 -0
  290. data/_patches-20160118a/googles-specs +713 -0
  291. data/_patches-20160118a/guestport-madness +59 -0
  292. data/_patches-20160118a/local-configs-ignore +61 -0
  293. data/_patches-20160118a/misc +79 -0
  294. data/_patches-20160118a/network-unreachable +31 -0
  295. data/_patches-20160118a/new-boxfile +288 -0
  296. data/_patches-20160118a/parallelization-maybe +198 -0
  297. data/_patches-20160118a/port-forwarding-processes +87 -0
  298. data/_patches-20160118a/read-state +23 -0
  299. data/_patches-20160118a/refactor-to-use-public_address-cap +25 -0
  300. data/_patches-20160118a/series +62 -0
  301. data/_patches-20160118a/status +14 -0
  302. data/_patches-20160118a/test-move-env-data +231 -0
  303. data/_patches-20160118a/test-vagrantfile-vm1 +167 -0
  304. data/_patches-20160118a/vagrant-spec-mock-api +137 -0
  305. data/_patches-20160118a/vagrant-vmware-plugin +233 -0
  306. data/_patches-20160118a/vagrantfile +403 -0
  307. data/_patches-20160118a/vagrantfile-for-acceptance-tests +29 -0
  308. data/_patches-20160118a/vagrantfile-for-nick +95 -0
  309. data/_patches-20160118a/vagrantfiles-to-forget-what-they-are-for +134 -0
  310. data/_patches-20160118a/vm-vanished +42 -0
  311. data/lib/vagrant-skytap/action/clear_forwarded_ports.rb +19 -0
  312. data/lib/vagrant-skytap/action/forward_ports.rb +42 -0
  313. data/lib/vagrant-skytap/action/prepare_forwarded_port_collision_params.rb +37 -0
  314. data/lib/vagrant-skytap/action.rb +18 -0
  315. data/lib/vagrant-skytap/api/environment.rb +19 -4
  316. data/lib/vagrant-skytap/api/vm.rb +10 -6
  317. data/lib/vagrant-skytap/command/up.rb +7 -1
  318. data/lib/vagrant-skytap/errors.rb +4 -0
  319. data/lib/vagrant-skytap/hosts/bsd/cap/ssh_tunnel.rb +15 -0
  320. data/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb +183 -0
  321. data/lib/vagrant-skytap/hosts/linux/cap/ssh_tunnel.rb +15 -0
  322. data/lib/vagrant-skytap/hosts/windows/cap/ssh_tunnel.rb +27 -0
  323. data/lib/vagrant-skytap/model/forwarded_port.rb +78 -0
  324. data/lib/vagrant-skytap/plugin.rb +15 -0
  325. data/lib/vagrant-skytap/util/compile_forwarded_ports.rb +35 -0
  326. data/lib/vagrant-skytap/version.rb +1 -1
  327. data/locales/en.yml +3 -0
  328. data/spec/unit/environment_spec.rb +14 -2
  329. data/spec/unit/forwarded_port_spec.rb +45 -0
  330. data/spec/unit/hosts/common/cap/ssh_tunnel_spec.rb +180 -0
  331. data/spec/unit/prepare_collision_params_spec.rb +57 -0
  332. data/spec/unit/support/forwarded_ports/machines/vm1/skytap/id +1 -0
  333. data/spec/unit/support/forwarded_ports/machines/vm1/skytap/private_key +4 -0
  334. data/spec/unit/support/forwarded_ports/machines/vm1/skytap/tcp9000_tcp_9000_80.pid +1 -0
  335. data/spec/unit/support/forwarded_ports/machines/vm1/skytap/tcp9001_tcp_9001_81.pid +1 -0
  336. data/spec/unit/support/forwarded_ports/machines/vm1/virtualbox/id +1 -0
  337. data/spec/unit/support/forwarded_ports/machines/vm2/skytap/id +1 -0
  338. data/spec/unit/support/forwarded_ports/machines/vm2/skytap/tcp8080_tcp_8080_80.pid +1 -0
  339. data/spec/unit/support/forwarded_ports/machines/vm3/virtualbox/id +1 -0
  340. data/spec/unit/support/forwarded_ports/machines/vm4/skytap/id +1 -0
  341. data/spec/unit/support/forwarded_ports/machines/vm4/skytap/tcp8888_tcp_8888_80.pid +1 -0
  342. metadata +330 -2
@@ -0,0 +1,50 @@
1
+ # HG changeset patch
2
+ # Parent 7bf28b483ba4495c173d9316aee2d8482d9705ab
3
+ ENG-12301 release machine lock
4
+
5
+ diff -r 7bf28b483ba4 lib/vagrant-skytap/action/mixin_machine_index.rb
6
+ --- a/lib/vagrant-skytap/action/mixin_machine_index.rb Thu Dec 03 19:36:57 2015 -0800
7
+ +++ b/lib/vagrant-skytap/action/mixin_machine_index.rb Mon Dec 07 14:42:07 2015 -0800
8
+ @@ -14,6 +14,7 @@
9
+ # NOTE: #get locks the machine. Make sure to #release(entry)
10
+ # when finished.
11
+ def machine_index_entry
12
+ + @logger.debug("Locking machine #{index_uuid}") if @logger
13
+ entry = machine_index.get(env[:machine].index_uuid)
14
+ end
15
+ end
16
+ diff -r 7bf28b483ba4 lib/vagrant-skytap/action/store_extra_data.rb
17
+ --- a/lib/vagrant-skytap/action/store_extra_data.rb Thu Dec 03 19:36:57 2015 -0800
18
+ +++ b/lib/vagrant-skytap/action/store_extra_data.rb Mon Dec 07 14:42:07 2015 -0800
19
+ @@ -17,6 +17,7 @@
20
+
21
+ def call(env)
22
+ entry = machine_index_entry
23
+ + puts "Machine locked. Pausing 5 seconds so you can kill me"
24
+ entry.extra_data.merge!(provider_extra_data)
25
+ entry = machine_index.set(entry)
26
+ machine_index.release(entry)
27
+ diff -r 7bf28b483ba4 lib/vagrant-skytap/provider.rb
28
+ --- a/lib/vagrant-skytap/provider.rb Thu Dec 03 19:36:57 2015 -0800
29
+ +++ b/lib/vagrant-skytap/provider.rb Mon Dec 07 14:42:07 2015 -0800
30
+ @@ -6,6 +6,7 @@
31
+ class Provider < Vagrant.plugin("2", :provider)
32
+ def initialize(machine)
33
+ @machine = machine
34
+ + @logger = Log4r::Logger.new("vagrant_skytap::plugin::provider")
35
+ end
36
+
37
+ def action(name)
38
+ @@ -26,10 +27,11 @@
39
+ end
40
+
41
+ def state
42
+ + @logger.debug("Entered Provider#state")
43
+ # Run a custom action we define called "read_state" which does
44
+ # what it says. It puts the state in the `:machine_state_id`
45
+ # key in the environment.
46
+ - env = @machine.action("read_state")
47
+ + env = @machine.action("read_state", lock: false) # can't be this easy
48
+
49
+ state_id = env[:machine_state_id]
50
+
@@ -0,0 +1,74 @@
1
+ # HG changeset patch
2
+ # Parent cc2ef994b16e0e695ce23413086a3eb891955849
3
+ ENG-12720 add forwarded_ports provider cap for "port" command
4
+
5
+ diff -r cc2ef994b16e lib/vagrant-skytap/action/forward_ports.rb
6
+ --- a/lib/vagrant-skytap/action/forward_ports.rb Wed Jan 13 13:32:23 2016 -0800
7
+ +++ b/lib/vagrant-skytap/action/forward_ports.rb Wed Jan 13 13:33:15 2016 -0800
8
+ @@ -29,6 +29,9 @@
9
+
10
+ env[:ui].output(I18n.t("vagrant.actions.vm.forward_ports.forwarding"))
11
+ forward_ports
12
+ + # these ports have already been remapped
13
+ + # Write a file forwarded_ports, analogous to synced_folders, which maps the
14
+ + # pidsfiles/ids to host ip, guest ip, host port, guest port
15
+
16
+ @app.call(env)
17
+ end
18
+ diff -r cc2ef994b16e lib/vagrant-skytap/cap/forwarded_ports.rb
19
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20
+ +++ b/lib/vagrant-skytap/cap/forwarded_ports.rb Wed Jan 13 13:33:15 2016 -0800
21
+ @@ -0,0 +1,26 @@
22
+ +module VagrantPlugins
23
+ + module Skytap
24
+ + module Cap
25
+ + module ForwardedPorts
26
+ + # Reads the forwarded ports that currently exist on the machine
27
+ + # itself. This raises an exception if the machine isn't running.
28
+ + #
29
+ + # This also may not match up with configured forwarded ports, because
30
+ + # Vagrant auto port collision fixing may have taken place.
31
+ + #
32
+ + # @return [Hash<Integer, Integer>] Host => Guest port mappings.
33
+ + def self.forwarded_ports(machine)
34
+ + return nil if machine.state.id != :running
35
+ +
36
+ + {}.tap do |result|
37
+ + # Since we can't access the host to call host capabilities, we need a
38
+ + # redundant method here which reads from a forwarded_ports file.
39
+ + #env[:host].capability(:read_forwarded_ports, nil, machine).each do |name, hostport, guestport|
40
+ + # result[hostport] = guestport
41
+ + #end
42
+ + end
43
+ + end
44
+ + end
45
+ + end
46
+ + end
47
+ +end
48
+ diff -r cc2ef994b16e lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb
49
+ --- a/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb Wed Jan 13 13:32:23 2016 -0800
50
+ +++ b/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb Wed Jan 13 13:33:15 2016 -0800
51
+ @@ -53,6 +53,8 @@
52
+
53
+ def read_forwarded_ports(env, env_hash, machine = nil)
54
+ machine ||= env_hash[:machine]
55
+ + # this doesn't get enough info (need to return protocol, hostport, guestport, ?).
56
+ + # Read from the forwarded_ports file that we create when forwarding the ports.
57
+ get_pidfiles_for_machine(machine).collect do |pidfile|
58
+ read_pid(machine.data_dir.join(pidfile))
59
+ end
60
+ diff -r cc2ef994b16e lib/vagrant-skytap/plugin.rb
61
+ --- a/lib/vagrant-skytap/plugin.rb Wed Jan 13 13:32:23 2016 -0800
62
+ +++ b/lib/vagrant-skytap/plugin.rb Wed Jan 13 13:33:15 2016 -0800
63
+ @@ -49,6 +49,11 @@
64
+ Cap::PublicAddress
65
+ end
66
+
67
+ + provider_capability(:skytap, :forwarded_ports) do
68
+ + require_relative "cap/forwarded_ports"
69
+ + Cap::ForwardedPorts
70
+ + end
71
+ +
72
+ %w[start_ssh_tunnel kill_ssh_tunnel kill_forwarded_ports read_used_ports read_forwarded_ports].each do |cap|
73
+ host_capability("bsd", cap) do
74
+ require_relative "hosts/bsd/cap/ssh_tunnel"
@@ -0,0 +1,95 @@
1
+ # HG changeset patch
2
+ # Parent d12ff92a5f45243523ff63f49b559dd3793fe41e
3
+ ENG-12843 make Up command work without hacking a copy of the command
4
+
5
+ diff -r d12ff92a5f45 -r 52e7dd5125d7 lib/vagrant-skytap/action.rb
6
+ --- a/lib/vagrant-skytap/action.rb Mon Dec 28 10:54:14 2015 -0800
7
+ +++ b/lib/vagrant-skytap/action.rb Tue Jan 05 13:21:52 2016 -0800
8
+ @@ -190,6 +190,16 @@
9
+ # and initial states for all machines to be run, potentially
10
+ # with a single REST call.
11
+
12
+ + def self.action_up
13
+ + Vagrant::Action::Builder.new.tap do |b|
14
+ + b.use HandleBox
15
+ + #b.use action_fetch_environment
16
+ + b.use ConfigValidate
17
+ +# b.use InitializeAPIClient
18
+ +# b.use FetchEnvironment
19
+ + end
20
+ + end
21
+ +
22
+ def self.action_create
23
+ Vagrant::Action::Builder.new.tap do |b|
24
+ b.use HandleBox
25
+ @@ -320,6 +330,7 @@
26
+ autoload :MessageEnvironmentUrl, action_root.join("message_environment_url")
27
+ autoload :MessageResuming, action_root.join("message_resuming")
28
+ autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
29
+ + autoload :PostActionUp, action_root.join("post_action_up")
30
+ autoload :PrepareForwardedPortCollisionParams, action_root.join("prepare_forwarded_port_collision_params")
31
+ autoload :PrepareNFSSettings, action_root.join("prepare_nfs_settings")
32
+ autoload :PrepareNFSValidIds, action_root.join("prepare_nfs_valid_ids")
33
+ diff -r d12ff92a5f45 -r 52e7dd5125d7 lib/vagrant-skytap/action/post_action_up.rb
34
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35
+ +++ b/lib/vagrant-skytap/action/post_action_up.rb Tue Jan 05 13:21:52 2016 -0800
36
+ @@ -0,0 +1,26 @@
37
+ +require 'byebug'
38
+ +require_relative "mixin_machine_index"
39
+ +
40
+ +module VagrantPlugins
41
+ + module Skytap
42
+ + module Action
43
+ + # This can be used with "Call" built-in to check if the action
44
+ + # is being performed as part of a parallel operation.
45
+ + class PostActionUp
46
+ + include MixinMachineIndex
47
+ + def initialize(app, env)
48
+ + @app = app
49
+ + @logger = Log4r::Logger.new("vagrant_skytap::action::post_action_up")
50
+ + end
51
+ +
52
+ + def call(env)
53
+ + @logger.info env[:action_name]
54
+ + @logger.info env[:machine].try(:name)
55
+ + debugger
56
+ +
57
+ + @app.call(env)
58
+ + end
59
+ + end
60
+ + end
61
+ + end
62
+ +end
63
+ diff -r d12ff92a5f45 -r 52e7dd5125d7 lib/vagrant-skytap/plugin.rb
64
+ --- a/lib/vagrant-skytap/plugin.rb Mon Dec 28 10:54:14 2015 -0800
65
+ +++ b/lib/vagrant-skytap/plugin.rb Tue Jan 05 13:21:52 2016 -0800
66
+ @@ -3,7 +3,7 @@
67
+ rescue LoadError
68
+ raise "The Vagrant Skytap plugin must be run within Vagrant."
69
+ end
70
+ -
71
+ +require 'byebug'
72
+ # This is a sanity check to make sure no one is attempting to install
73
+ # this into an early Vagrant version.
74
+ if Vagrant::VERSION < "1.2.0"
75
+ @@ -34,9 +34,17 @@
76
+ Provider
77
+ end
78
+
79
+ - command("up", primary: true) do
80
+ - require_relative "command/up"
81
+ - Skytap::Command::Up
82
+ +# command("up", primary: true) do
83
+ +# require_relative "command/up"
84
+ +# Skytap::Command::Up
85
+ +# end
86
+ +
87
+ + action_hook(:post_up_behavior1, :environment_unload) do |hook|
88
+ + hook.prepend(VagrantPlugins::Skytap::Action::PostActionUp)
89
+ + end
90
+ +
91
+ + action_hook(:post_up_behavior4, :machine_action_up) do |hook|
92
+ + hook.append(VagrantPlugins::Skytap::Action::PostActionUp)
93
+ end
94
+
95
+ command("publish-url", primary: true) do
@@ -0,0 +1,291 @@
1
+ # HG changeset patch
2
+ # Parent 3e63d0cb1ef6e5757f785da86648be335dc967f5
3
+ ENG-13040 port forwarding collision detection & repair
4
+
5
+ diff -r 3e63d0cb1ef6 Vagrantfile
6
+ --- a/Vagrantfile Wed Jan 13 14:42:59 2016 -0800
7
+ +++ b/Vagrantfile Wed Jan 13 16:48:17 2016 -0800
8
+ @@ -88,7 +88,7 @@
9
+ settings_key = :etrue_prod
10
+ vm1_key = :golden
11
+ vm2_key = :windows_winrm_configured
12
+ -vm3_key = :ubuntu2
13
+ +vm3_key = :golden
14
+ #############################
15
+
16
+
17
+ @@ -125,8 +125,8 @@
18
+ box.vm.provision "shell", path: "provisioning/apache.sh"
19
+ box.vm.provision "shell", path: "provisioning/vagrant.sh"
20
+
21
+ - box.vm.network :forwarded_port, guest: 80, host: 9000
22
+ - #box.vm.network :forwarded_port, guest: 21, host: 9001
23
+ + box.vm.network :forwarded_port, guest: 80, host: 9000, auto_correct: true
24
+ + box.vm.network :forwarded_port, guest: 21, host: 9001, auto_correct: true
25
+ end
26
+
27
+ # config.vm.define "vm2" do |box|
28
+ @@ -140,17 +140,20 @@
29
+ # box.vm.synced_folder "vm2", "/synced", type: :nfs
30
+ # end
31
+ #
32
+ -# config.vm.define "vm3" do |box|
33
+ -# box.vm.hostname = "vm3"
34
+ -# box.vm.provider :skytap do |box|
35
+ -# box.vm_url = vms[vm3_key][:vm_url]
36
+ -# end
37
+ -# box.ssh.username = vms[vm3_key][:username]
38
+ -# box.ssh.password = vms[vm3_key][:password]
39
+ -# box.vm.communicator = vms[vm3_key][:communicator]
40
+ -# box.vm.synced_folder "vm3", "/synced", type: :nfs
41
+ -# box.vm.provision "shell", path: "provisioning/trivial.sh"
42
+ -# end
43
+ + config.vm.define "vm3" do |box|
44
+ + #box.vm.hostname = "vm3"
45
+ + box.vm.provider :skytap do |box|
46
+ + box.vm_url = vms[vm3_key][:vm_url]
47
+ + end
48
+ + box.ssh.username = vms[vm3_key][:username]
49
+ + box.ssh.password = vms[vm3_key][:password]
50
+ + box.vm.communicator = vms[vm3_key][:communicator]
51
+ + #box.vm.synced_folder "vm3", "/synced", type: :nfs
52
+ + box.vm.provision "shell", path: "provisioning/trivial.sh"
53
+ +
54
+ + box.vm.network :forwarded_port, guest: 80, host: 9000, auto_correct: true
55
+ + box.vm.network :forwarded_port, guest: 21, host: 9001, auto_correct: true
56
+ + end
57
+ end
58
+
59
+ #ubuntu.vm.synced_folder "vm1", "/home/skytap/app", type: :nfs, :mount_options => ['actimeo=1']
60
+ diff -r 3e63d0cb1ef6 lib/vagrant-skytap/action.rb
61
+ --- a/lib/vagrant-skytap/action.rb Wed Jan 13 14:42:59 2016 -0800
62
+ +++ b/lib/vagrant-skytap/action.rb Wed Jan 13 16:48:17 2016 -0800
63
+ @@ -289,6 +289,9 @@
64
+ Vagrant::Action::Builder.new.tap do |b|
65
+ b.use ClearForwardedPorts
66
+ b.use ReadSSHInfo
67
+ + b.use EnvSet, port_collision_repair: true
68
+ + b.use PrepareForwardedPortCollisionParams
69
+ + b.use HandleForwardedPortCollisions
70
+ b.use ForwardPorts
71
+ end
72
+ end
73
+ @@ -316,6 +319,7 @@
74
+ autoload :MessageEnvironmentUrl, action_root.join("message_environment_url")
75
+ autoload :MessageResuming, action_root.join("message_resuming")
76
+ autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
77
+ + autoload :PrepareForwardedPortCollisionParams, action_root.join("prepare_forwarded_port_collision_params")
78
+ autoload :PrepareNFSSettings, action_root.join("prepare_nfs_settings")
79
+ autoload :PrepareNFSValidIds, action_root.join("prepare_nfs_valid_ids")
80
+ autoload :ReadSSHInfo, action_root.join("read_ssh_info")
81
+ diff -r 3e63d0cb1ef6 lib/vagrant-skytap/action/prepare_forwarded_port_collision_params.rb
82
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83
+ +++ b/lib/vagrant-skytap/action/prepare_forwarded_port_collision_params.rb Wed Jan 13 16:48:17 2016 -0800
84
+ @@ -0,0 +1,35 @@
85
+ +module VagrantPlugins
86
+ + module Skytap
87
+ + module Action
88
+ + class PrepareForwardedPortCollisionParams
89
+ + def initialize(app, env)
90
+ + @app = app
91
+ + end
92
+ +
93
+ + def call(env)
94
+ + # Get the forwarded ports used by other virtual machines and
95
+ + # consider those in use as well.
96
+ + env[:port_collision_extra_in_use] = env[:host].capability(:read_used_ports, env)
97
+ +
98
+ + # Build the remap for any existing collision detections
99
+ + remap = {}
100
+ + env[:port_collision_remap] = remap
101
+ + env[:host].capability(:read_forwarded_ports, env).each do |name, hostport, guestport|
102
+ + env[:machine].config.vm.networks.each do |type, options|
103
+ + next if type != :forwarded_port
104
+ +
105
+ + # If the ID matches the name of the forwarded port, then
106
+ + # remap.
107
+ + if options[:id] == name
108
+ + remap[options[:host]] = hostport
109
+ + break
110
+ + end
111
+ + end
112
+ + end
113
+ +
114
+ + @app.call(env)
115
+ + end
116
+ + end
117
+ + end
118
+ + end
119
+ +end
120
+ diff -r 3e63d0cb1ef6 lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb
121
+ --- a/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb Wed Jan 13 14:42:59 2016 -0800
122
+ +++ b/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb Wed Jan 13 16:48:17 2016 -0800
123
+ @@ -18,21 +18,21 @@
124
+ def start_ssh_tunnel(env, fp, env_hash)
125
+ logger = create_logger
126
+ machine = env_hash[:machine]
127
+ - pidfile = pidfile_name(fp)
128
+ - pid = read_pid(machine.data_dir.join(pidfile))
129
+ + pid = read_pid(machine.data_dir.join(fp.pidfile))
130
+
131
+ if pid && autossh_pid?(pid)
132
+ logger.info("An autossh process already exists with pid #{pid}.")
133
+ else
134
+ - args = ssh_args(fp, pidfile, env_hash)
135
+ - vars = autossh_environment_variables(pidfile, env_hash)
136
+ + args = ssh_args(fp, machine, env_hash)
137
+ + vars = autossh_environment_variables(fp, machine)
138
+ args << {env: vars}
139
+ Vagrant::Util::Subprocess.execute("autossh", "-f", *args)
140
+ end
141
+ end
142
+
143
+ def kill_forwarded_ports(env, env_hash)
144
+ - get_pidfiles_for_machine(env_hash[:machine]).each do |pidfile|
145
+ + machine = env_hash[:machine]
146
+ + pidfiles_for_directory(machine.data_dir).each do |pidfile|
147
+ kill_ssh_tunnel(env, pidfile, env_hash)
148
+ end
149
+ end
150
+ @@ -49,49 +49,82 @@
151
+ end
152
+ end
153
+
154
+ -
155
+ - def pidfile_name(fp)
156
+ - "#{fp.protocol}#{fp.host_port}.pid"
157
+ - end
158
+ -
159
+ def read_pid(pidfile_path)
160
+ File.read(pidfile_path).presence.try(:to_i) if File.exist?(pidfile_path)
161
+ end
162
+
163
+ - def get_pidfiles_for_machine(machine)
164
+ + # Returns fpinfo for this machine's forwarded ports.
165
+ + def read_forwarded_ports(env, env_hash)
166
+ + machine = env_hash[:machine]
167
+ + fpinfos_for_directory(machine.data_dir)
168
+ + end
169
+ +
170
+ + # Returns fpinfo for the forwarded ports of all *other* machines
171
+ + def read_used_ports(env, env_hash)
172
+ + machine = env_hash[:machine]
173
+ + paths = machine_paths(env).reject!{|k,v| k == machine.name.to_s}
174
+ + paths.values.collect{|path| fpinfos_for_directory(path)}.flatten
175
+ + end
176
+ +
177
+ + # fpinfo (my terminology) is an array of:
178
+ + # [adapter, name, hostport, guestport]
179
+ + # Currently all the info we have is the pid itself,
180
+ + # so guestport is nil. Adapter is unused.
181
+ + def fpinfos_for_directory(dir)
182
+ + pidfiles_for_directory(dir).collect do |pidfile|
183
+ + pidfile =~ /(\w+)(\d+)\.pid/
184
+ + protocol, hostport, guestport = $1, $2, nil
185
+ + [nil, "#{protocol}#{hostport}", hostport, guestport]
186
+ + end
187
+ + end
188
+ +
189
+ + def pidfiles_for_directory(dir)
190
+ pidfiles = []
191
+ - Vagrant::Util::SafeChdir.safe_chdir(machine.data_dir) do
192
+ + Vagrant::Util::SafeChdir.safe_chdir(dir) do
193
+ pidfiles = Dir.glob("*.pid")
194
+ end
195
+ pidfiles
196
+ end
197
+
198
+ + # Map of machine names to absolute data_dirs, including
199
+ + # only Skytap machines.
200
+ + def machine_paths(env)
201
+ + h = {}
202
+ + env_path = env.local_data_path
203
+ + Vagrant::Util::SafeChdir.safe_chdir(env.local_data_path) do
204
+ + Dir.foreach("machines") do |machine_name|
205
+ + data_dir = "machines/#{machine_name}/skytap"
206
+ + if Dir.exist?(data_dir)
207
+ + h[machine_name] = env_path.join(data_dir)
208
+ + end
209
+ + end
210
+ + end
211
+ + h
212
+ + end
213
+ +
214
+ # Checks that the pid is actually an autossh process (and not
215
+ # something else using a recycled pid).
216
+ def autossh_pid?(pid)
217
+ - # get_comm_for_pid(pid) == 'autossh'
218
+ - true
219
+ + get_comm_for_pid(pid) == 'autossh'
220
+ end
221
+
222
+ # Get the command, minus any arguments, for the given
223
+ - # pid. This probably needs to be overridden per host cap
224
+ + # pid. These arguments give the desired results
225
+ + # on MacOS, Ubuntu
226
+ def get_comm_for_pid(pid)
227
+ result = Vagrant::Util::Subprocess.execute("ps", "-p", pid.to_s, "-o", "comm")
228
+ result.stdout.split("\n").last
229
+ end
230
+
231
+ -
232
+ - # these args seem to work on MacOS and Ubuntu ...
233
+ - # untested on other implementations
234
+ - def ssh_args(fp, pidfile, env_hash)
235
+ - machine = env_hash[:machine]
236
+ + # These arguments give the desired results
237
+ + # on MacOS, Ubuntu
238
+ + def ssh_args(fp, machine, env_hash)
239
+ ssh_info = env_hash[:machine_ssh_info]
240
+ ssh_options = {
241
+ "ServerAliveInterval" => 10,
242
+ "ServerAliveCountMax" => 3,
243
+ "StrictHostKeyChecking" => "no",
244
+ }
245
+ -
246
+ args = []
247
+ args << "-q" # quiet
248
+ args << "-N" # no remote command
249
+ @@ -104,10 +137,9 @@
250
+ args << "#{ssh_info[:username]}@#{ssh_info[:host]}"
251
+ end
252
+
253
+ - def autossh_environment_variables(pidfile, env_hash, monitoring_port = 0)
254
+ - machine = env_hash[:machine]
255
+ + def autossh_environment_variables(fp, machine, monitoring_port = 0)
256
+ {
257
+ - "AUTOSSH_PIDFILE" => machine.data_dir.join(pidfile),
258
+ + "AUTOSSH_PIDFILE" => machine.data_dir.join(fp.pidfile),
259
+ "AUTOSSH_PORT" => monitoring_port,
260
+ "AUTOSSH_LOGFILE" => "/tmp/#{pidfile}_#{machine.id}_autossh.log",
261
+ }
262
+ diff -r 3e63d0cb1ef6 lib/vagrant-skytap/model/forwarded_port.rb
263
+ --- a/lib/vagrant-skytap/model/forwarded_port.rb Wed Jan 13 14:42:59 2016 -0800
264
+ +++ b/lib/vagrant-skytap/model/forwarded_port.rb Wed Jan 13 16:48:17 2016 -0800
265
+ @@ -64,6 +64,14 @@
266
+ def correct_host_port(new_port)
267
+ @host_port = new_port
268
+ end
269
+ +
270
+ + # This generates a filename which can be used to
271
+ + # store the pid of an ssh tunnel.
272
+ + #
273
+ + # @return [String]
274
+ + def pidfile
275
+ + "#{protocol}#{host_port}.pid"
276
+ + end
277
+ end
278
+ end
279
+ end
280
+ diff -r 3e63d0cb1ef6 lib/vagrant-skytap/plugin.rb
281
+ --- a/lib/vagrant-skytap/plugin.rb Wed Jan 13 14:42:59 2016 -0800
282
+ +++ b/lib/vagrant-skytap/plugin.rb Wed Jan 13 16:48:17 2016 -0800
283
+ @@ -49,7 +49,7 @@
284
+ Cap::PublicAddress
285
+ end
286
+
287
+ - %w[start_ssh_tunnel kill_ssh_tunnel kill_forwarded_ports].each do |cap|
288
+ + %w[start_ssh_tunnel kill_ssh_tunnel kill_forwarded_ports read_used_ports read_forwarded_ports].each do |cap|
289
+ host_capability("bsd", cap) do
290
+ require_relative "hosts/bsd/cap/ssh_tunnel"
291
+ HostBSD::Cap::SSHTunnel
@@ -0,0 +1,112 @@
1
+ # HG changeset patch
2
+ # Parent 2d0352ab9e88823add32c339d95d9782c00fba51
3
+ ENG-11604 support using environment vms (this is impossible without an API change)
4
+
5
+ diff -r 2d0352ab9e88 Vagrantfile
6
+ --- a/Vagrantfile Wed Nov 04 16:26:46 2015 -0800
7
+ +++ b/Vagrantfile Wed Nov 04 16:28:24 2015 -0800
8
+ @@ -39,7 +39,7 @@
9
+ config.vm.define "vm1" do |ubuntu|
10
+ ubuntu.vm.hostname = "vm1"
11
+ ubuntu.vm.provider :skytap do |box|
12
+ - box.vm_url = UBUNTU1#GENERIC_UBUNTU
13
+ + box.vm_url = UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_A#GENERIC_UBUNTU
14
+ #box.cpus = 1
15
+ #box.cpuspersocket = 1
16
+ #box.ram = 1024
17
+ @@ -64,7 +64,7 @@
18
+ config.vm.define "vm3" do |ubuntu|
19
+ ubuntu.vm.hostname = "vm3"
20
+ ubuntu.vm.provider :skytap do |box|
21
+ - box.vm_url = UBUNTU2#GENERIC_UBUNTU
22
+ + box.vm_url = UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_B#GENERIC_UBUNTU
23
+ end
24
+ ubuntu.vm.communicator = :ssh
25
+ ubuntu.ssh.username = "skytap"
26
+ diff -r 2d0352ab9e88 lib/vagrant-skytap/api/environment.rb
27
+ --- a/lib/vagrant-skytap/api/environment.rb Wed Nov 04 16:26:46 2015 -0800
28
+ +++ b/lib/vagrant-skytap/api/environment.rb Wed Nov 04 16:28:24 2015 -0800
29
+ @@ -18,8 +18,27 @@
30
+ vm = Vm.fetch(env, vm_url)
31
+ check_vm_before_adding(env, vm)
32
+
33
+ - resp = env[:api_client].post(RESOURCE_ROOT, JSON.dump(template_id: vm.template_id, vm_ids: [vm.id]))
34
+ - fetch(env, resp['Location'])
35
+ + params = {
36
+ + vm_ids: [vm.id]
37
+ + }.tap do |params|
38
+ + if vm.from_template?
39
+ + params[:template_id] = vm.template_id
40
+ + else
41
+ + params[:configuration_id] = vm.environment_id
42
+ + end
43
+ + end
44
+ +
45
+ + puts params
46
+ + debugger
47
+ +
48
+ + resp = env[:api_client].post(RESOURCE_ROOT, JSON.dump(params))#_for_add(vm)))
49
+ + if resp['Location']
50
+ + puts "Redirected to #{resp['Location']}"
51
+ + fetch(env, resp['Location'])
52
+ + else
53
+ + puts "call returned #{resp.body}"
54
+ + new(JSON.load(resp.body), env)
55
+ + end
56
+ end
57
+
58
+ def fetch(env, url)
59
+ @@ -31,6 +50,16 @@
60
+ EnvironmentProperties.read(env[:machine].env.local_data_path)
61
+ end
62
+
63
+ + def params_for_add(vm)
64
+ + {
65
+ + vm_ids: [vm.id]
66
+ + }.tap do |params|
67
+ + unless params[:merge_configuration] = vm.environment_id
68
+ + params[:template_id] = vm.template_id
69
+ + end
70
+ + end
71
+ + end
72
+ +
73
+ def check_vm_before_adding(env, vm)
74
+ raise Errors::NotTemplateVm, url: vm.url unless vm.from_template?
75
+ raise Errors::SourceVmNotStopped, name: env[:machine].name, url: vm.url unless vm.stopped?
76
+ @@ -90,7 +119,20 @@
77
+ check_vm_before_adding(env, vm)
78
+ vm_ids = vms.collect(&:id)
79
+
80
+ - update_with_retry(template_id: vm.template_id, vm_ids: [vm.id])
81
+ + params = {
82
+ + vm_ids: [vm.id]
83
+ + }.tap do |params|
84
+ + if vm.from_template?
85
+ + params[:template_id] = vm.template_id
86
+ + else
87
+ + params[:merge_configuration] = vm.environment_id
88
+ + end
89
+ + end
90
+ +
91
+ +
92
+ + puts params
93
+ + debugger
94
+ + update_with_retry(params)#self.class.params_for_add(vm))
95
+ new_vm_ids = vms.collect(&:id) - vm_ids
96
+ get_vm_by_id(new_vm_ids.last)
97
+ end
98
+ diff -r 2d0352ab9e88 lib/vagrant-skytap/api/vm.rb
99
+ --- a/lib/vagrant-skytap/api/vm.rb Wed Nov 04 16:26:46 2015 -0800
100
+ +++ b/lib/vagrant-skytap/api/vm.rb Wed Nov 04 16:28:24 2015 -0800
101
+ @@ -60,6 +60,11 @@
102
+ !!get_api_attribute('template_url')
103
+ end
104
+
105
+ + def environment_id
106
+ + get_api_attribute('configuration_url') =~ /configurations\/(\d+)/
107
+ + $1
108
+ + end
109
+ +
110
+ def template_id
111
+ get_api_attribute('template_url') =~ /templates\/(\d+)/
112
+ $1