vagrant-skytap 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/vagrant-skytap/action/add_vm_to_environment.rb +4 -4
  4. data/lib/vagrant-skytap/action/compose_environment.rb +131 -0
  5. data/lib/vagrant-skytap/action/create_environment.rb +3 -1
  6. data/lib/vagrant-skytap/action/initialize_api_client.rb +6 -5
  7. data/lib/vagrant-skytap/action/set_up_vm.rb +3 -1
  8. data/lib/vagrant-skytap/action/store_extra_data.rb +4 -2
  9. data/lib/vagrant-skytap/action.rb +4 -17
  10. data/lib/vagrant-skytap/api/environment.rb +53 -25
  11. data/lib/vagrant-skytap/api/vm.rb +9 -3
  12. data/lib/vagrant-skytap/command/up.rb +46 -30
  13. data/lib/vagrant-skytap/errors.rb +4 -0
  14. data/lib/vagrant-skytap/version.rb +1 -1
  15. data/locales/en.yml +5 -1
  16. data/spec/unit/actions/compose_environment_spec.rb +101 -0
  17. data/spec/unit/environment_spec.rb +26 -45
  18. data/spec/unit/support/shared/skytap_context.rb +5 -0
  19. data/vagrant-skytap.gemspec +3 -3
  20. metadata +9 -311
  21. data/.byebug_history +0 -256
  22. data/.project +0 -11
  23. data/_patches-20160112/0 +0 -388
  24. data/_patches-20160112/1 +0 -82
  25. data/_patches-20160112/2 +0 -239
  26. data/_patches-20160112/COMPLETED-ABOVE-THIS-LINE +0 -4
  27. data/_patches-20160112/COMPLETED-BELOW-THIS-LINE +0 -4
  28. data/_patches-20160112/CR-ABOVE-THIS-LINE +0 -4
  29. data/_patches-20160112/CR-BELOW-THIS-LINE +0 -4
  30. data/_patches-20160112/WIP-ABOVE-THIS-LINE +0 -4
  31. data/_patches-20160112/WIP-BELOW-THIS-LINE +0 -4
  32. data/_patches-20160112/acceptance-test-runner +0 -29
  33. data/_patches-20160112/ansible-1 +0 -92
  34. data/_patches-20160112/cache-api-client-in-up +0 -40
  35. data/_patches-20160112/dead-code-in-actions +0 -44
  36. data/_patches-20160112/debug-changes +0 -42
  37. data/_patches-20160112/demo-rails-app +0 -1276
  38. data/_patches-20160112/eng-10166-halt-spec +0 -40
  39. data/_patches-20160112/eng-10256 +0 -527
  40. data/_patches-20160112/eng-10256-2 +0 -162
  41. data/_patches-20160112/eng-10256-ubuntu-testing +0 -88
  42. data/_patches-20160112/eng-10269-test-stuff +0 -87
  43. data/_patches-20160112/eng-10269-wtf +0 -119
  44. data/_patches-20160112/eng-10369 +0 -143
  45. data/_patches-20160112/eng-10369-tmp +0 -60
  46. data/_patches-20160112/eng-10919 +0 -56
  47. data/_patches-20160112/eng-11177-fix-actions-requires +0 -44
  48. data/_patches-20160112/eng-11442 +0 -4
  49. data/_patches-20160112/eng-11616 +0 -403
  50. data/_patches-20160112/eng-11616-2 +0 -67
  51. data/_patches-20160112/eng-11616-actual +0 -184
  52. data/_patches-20160112/eng-11625a +0 -4
  53. data/_patches-20160112/eng-11711 +0 -85
  54. data/_patches-20160112/eng-12232-command-spec +0 -236
  55. data/_patches-20160112/eng-12235 +0 -83
  56. data/_patches-20160112/eng-12235-override-refactor +0 -140
  57. data/_patches-20160112/eng-12240 +0 -103
  58. data/_patches-20160112/eng-12249 +0 -40
  59. data/_patches-20160112/eng-12301 +0 -50
  60. data/_patches-20160112/eng-12843 +0 -95
  61. data/_patches-20160112/env-source +0 -112
  62. data/_patches-20160112/frickin-vagrant-spec +0 -163
  63. data/_patches-20160112/gem-pre-version +0 -14
  64. data/_patches-20160112/gems-old +0 -9
  65. data/_patches-20160112/googles-specs +0 -713
  66. data/_patches-20160112/local-configs-ignore +0 -61
  67. data/_patches-20160112/misc +0 -79
  68. data/_patches-20160112/network-unreachable +0 -31
  69. data/_patches-20160112/new-boxfile +0 -288
  70. data/_patches-20160112/parallelization-maybe +0 -198
  71. data/_patches-20160112/read-state +0 -23
  72. data/_patches-20160112/refactor-to-use-public_address-cap +0 -25
  73. data/_patches-20160112/series +0 -60
  74. data/_patches-20160112/status +0 -12
  75. data/_patches-20160112/test-move-env-data +0 -231
  76. data/_patches-20160112/test-vagrantfile-vm1 +0 -167
  77. data/_patches-20160112/the_version_in_0.1.13.pre1 +0 -598
  78. data/_patches-20160112/vagrant-spec-mock-api +0 -137
  79. data/_patches-20160112/vagrant-vmware-plugin +0 -233
  80. data/_patches-20160112/vagrantfile +0 -403
  81. data/_patches-20160112/vagrantfile-for-acceptance-tests +0 -29
  82. data/_patches-20160112/vagrantfile-for-nick +0 -95
  83. data/_patches-20160112/vagrantfiles-to-forget-what-they-are-for +0 -134
  84. data/_patches-20160112/vm-vanished +0 -42
  85. data/_patches-20160112a/01 +0 -148
  86. data/_patches-20160112a/2 +0 -239
  87. data/_patches-20160112a/COMPLETED-ABOVE-THIS-LINE +0 -4
  88. data/_patches-20160112a/COMPLETED-BELOW-THIS-LINE +0 -4
  89. data/_patches-20160112a/CR-ABOVE-THIS-LINE +0 -4
  90. data/_patches-20160112a/CR-BELOW-THIS-LINE +0 -4
  91. data/_patches-20160112a/WIP-ABOVE-THIS-LINE +0 -4
  92. data/_patches-20160112a/WIP-BELOW-THIS-LINE +0 -4
  93. data/_patches-20160112a/acceptance-test-runner +0 -29
  94. data/_patches-20160112a/ansible-1 +0 -92
  95. data/_patches-20160112a/cache-api-client-in-up +0 -40
  96. data/_patches-20160112a/dead-code-in-actions +0 -44
  97. data/_patches-20160112a/debug-changes +0 -42
  98. data/_patches-20160112a/demo-rails-app +0 -1276
  99. data/_patches-20160112a/eng-10166-halt-spec +0 -40
  100. data/_patches-20160112a/eng-10256-ubuntu-testing +0 -88
  101. data/_patches-20160112a/eng-10269-test-stuff +0 -87
  102. data/_patches-20160112a/eng-10269-wtf +0 -119
  103. data/_patches-20160112a/eng-10369 +0 -143
  104. data/_patches-20160112a/eng-10369-tmp +0 -60
  105. data/_patches-20160112a/eng-10919 +0 -56
  106. data/_patches-20160112a/eng-11177-fix-actions-requires +0 -44
  107. data/_patches-20160112a/eng-11442 +0 -4
  108. data/_patches-20160112a/eng-11616 +0 -403
  109. data/_patches-20160112a/eng-11616-2 +0 -67
  110. data/_patches-20160112a/eng-11616-actual +0 -184
  111. data/_patches-20160112a/eng-11625a +0 -4
  112. data/_patches-20160112a/eng-11711 +0 -85
  113. data/_patches-20160112a/eng-12232-command-spec +0 -236
  114. data/_patches-20160112a/eng-12235 +0 -83
  115. data/_patches-20160112a/eng-12235-override-refactor +0 -140
  116. data/_patches-20160112a/eng-12240 +0 -103
  117. data/_patches-20160112a/eng-12249 +0 -40
  118. data/_patches-20160112a/eng-12301 +0 -50
  119. data/_patches-20160112a/eng-12843 +0 -95
  120. data/_patches-20160112a/env-source +0 -112
  121. data/_patches-20160112a/frickin-vagrant-spec +0 -163
  122. data/_patches-20160112a/gem-pre-version +0 -14
  123. data/_patches-20160112a/gems-old +0 -9
  124. data/_patches-20160112a/googles-specs +0 -713
  125. data/_patches-20160112a/local-configs-ignore +0 -61
  126. data/_patches-20160112a/misc +0 -79
  127. data/_patches-20160112a/network-unreachable +0 -31
  128. data/_patches-20160112a/new-boxfile +0 -288
  129. data/_patches-20160112a/parallelization-maybe +0 -198
  130. data/_patches-20160112a/read-state +0 -23
  131. data/_patches-20160112a/refactor-to-use-public_address-cap +0 -25
  132. data/_patches-20160112a/series +0 -58
  133. data/_patches-20160112a/status +0 -14
  134. data/_patches-20160112a/test-move-env-data +0 -231
  135. data/_patches-20160112a/test-vagrantfile-vm1 +0 -167
  136. data/_patches-20160112a/the_version_in_0.1.13.pre1 +0 -612
  137. data/_patches-20160112a/then-copy-the-newer-files +0 -632
  138. data/_patches-20160112a/vagrant-spec-mock-api +0 -137
  139. data/_patches-20160112a/vagrant-vmware-plugin +0 -233
  140. data/_patches-20160112a/vagrantfile +0 -403
  141. data/_patches-20160112a/vagrantfile-for-acceptance-tests +0 -29
  142. data/_patches-20160112a/vagrantfile-for-nick +0 -95
  143. data/_patches-20160112a/vagrantfiles-to-forget-what-they-are-for +0 -134
  144. data/_patches-20160112a/vm-vanished +0 -42
  145. data/_patches-20160113/COMPLETED-ABOVE-THIS-LINE +0 -4
  146. data/_patches-20160113/COMPLETED-BELOW-THIS-LINE +0 -4
  147. data/_patches-20160113/CR-ABOVE-THIS-LINE +0 -4
  148. data/_patches-20160113/CR-BELOW-THIS-LINE +0 -4
  149. data/_patches-20160113/WIP-ABOVE-THIS-LINE +0 -4
  150. data/_patches-20160113/WIP-BELOW-THIS-LINE +0 -4
  151. data/_patches-20160113/acceptance-test-runner +0 -29
  152. data/_patches-20160113/ansible-1 +0 -92
  153. data/_patches-20160113/cache-api-client-in-up +0 -40
  154. data/_patches-20160113/dead-code-in-actions +0 -44
  155. data/_patches-20160113/debug-changes +0 -55
  156. data/_patches-20160113/demo-rails-app +0 -1276
  157. data/_patches-20160113/eng-10166-halt-spec +0 -40
  158. data/_patches-20160113/eng-10256 +0 -543
  159. data/_patches-20160113/eng-10256-ubuntu-testing +0 -88
  160. data/_patches-20160113/eng-10269-test-stuff +0 -87
  161. data/_patches-20160113/eng-10269-wtf +0 -119
  162. data/_patches-20160113/eng-10369 +0 -143
  163. data/_patches-20160113/eng-10369-tmp +0 -60
  164. data/_patches-20160113/eng-10919 +0 -56
  165. data/_patches-20160113/eng-11177-fix-actions-requires +0 -44
  166. data/_patches-20160113/eng-11442 +0 -4
  167. data/_patches-20160113/eng-11616 +0 -403
  168. data/_patches-20160113/eng-11616-2 +0 -67
  169. data/_patches-20160113/eng-11616-actual +0 -184
  170. data/_patches-20160113/eng-11625a +0 -4
  171. data/_patches-20160113/eng-11711 +0 -85
  172. data/_patches-20160113/eng-12232-command-spec +0 -236
  173. data/_patches-20160113/eng-12235 +0 -83
  174. data/_patches-20160113/eng-12235-override-refactor +0 -140
  175. data/_patches-20160113/eng-12240 +0 -103
  176. data/_patches-20160113/eng-12249 +0 -40
  177. data/_patches-20160113/eng-12301 +0 -50
  178. data/_patches-20160113/eng-12720 +0 -47
  179. data/_patches-20160113/eng-12843 +0 -95
  180. data/_patches-20160113/env-source +0 -112
  181. data/_patches-20160113/frickin-vagrant-spec +0 -163
  182. data/_patches-20160113/gem-pre-version +0 -14
  183. data/_patches-20160113/gems-old +0 -9
  184. data/_patches-20160113/googles-specs +0 -713
  185. data/_patches-20160113/local-configs-ignore +0 -61
  186. data/_patches-20160113/misc +0 -79
  187. data/_patches-20160113/network-unreachable +0 -31
  188. data/_patches-20160113/new-boxfile +0 -288
  189. data/_patches-20160113/parallelization-maybe +0 -198
  190. data/_patches-20160113/read-state +0 -23
  191. data/_patches-20160113/refactor-to-use-public_address-cap +0 -25
  192. data/_patches-20160113/series +0 -56
  193. data/_patches-20160113/status +0 -14
  194. data/_patches-20160113/test-move-env-data +0 -231
  195. data/_patches-20160113/test-vagrantfile-vm1 +0 -167
  196. data/_patches-20160113/vagrant-spec-mock-api +0 -137
  197. data/_patches-20160113/vagrant-vmware-plugin +0 -233
  198. data/_patches-20160113/vagrantfile +0 -403
  199. data/_patches-20160113/vagrantfile-for-acceptance-tests +0 -29
  200. data/_patches-20160113/vagrantfile-for-nick +0 -95
  201. data/_patches-20160113/vagrantfiles-to-forget-what-they-are-for +0 -134
  202. data/_patches-20160113/vm-vanished +0 -42
  203. data/_patches-20160118/COMPLETED-ABOVE-THIS-LINE +0 -4
  204. data/_patches-20160118/COMPLETED-BELOW-THIS-LINE +0 -4
  205. data/_patches-20160118/CR-ABOVE-THIS-LINE +0 -4
  206. data/_patches-20160118/CR-BELOW-THIS-LINE +0 -4
  207. data/_patches-20160118/WIP-ABOVE-THIS-LINE +0 -4
  208. data/_patches-20160118/WIP-BELOW-THIS-LINE +0 -4
  209. data/_patches-20160118/acceptance-test-runner +0 -29
  210. data/_patches-20160118/ansible-1 +0 -92
  211. data/_patches-20160118/cache-api-client-in-up +0 -40
  212. data/_patches-20160118/dead-code-in-actions +0 -44
  213. data/_patches-20160118/debug-changes +0 -55
  214. data/_patches-20160118/demo-rails-app +0 -1276
  215. data/_patches-20160118/eng-10166-halt-spec +0 -40
  216. data/_patches-20160118/eng-10256 +0 -554
  217. data/_patches-20160118/eng-10256-cr +0 -314
  218. data/_patches-20160118/eng-10256-ubuntu-testing +0 -88
  219. data/_patches-20160118/eng-10269-test-stuff +0 -87
  220. data/_patches-20160118/eng-10269-wtf +0 -119
  221. data/_patches-20160118/eng-10369 +0 -143
  222. data/_patches-20160118/eng-10369-tmp +0 -60
  223. data/_patches-20160118/eng-10919 +0 -56
  224. data/_patches-20160118/eng-11177-fix-actions-requires +0 -44
  225. data/_patches-20160118/eng-11442 +0 -4
  226. data/_patches-20160118/eng-11616 +0 -403
  227. data/_patches-20160118/eng-11616-2 +0 -67
  228. data/_patches-20160118/eng-11616-actual +0 -184
  229. data/_patches-20160118/eng-11625a +0 -4
  230. data/_patches-20160118/eng-11711 +0 -85
  231. data/_patches-20160118/eng-12232-command-spec +0 -236
  232. data/_patches-20160118/eng-12235 +0 -83
  233. data/_patches-20160118/eng-12235-override-refactor +0 -140
  234. data/_patches-20160118/eng-12240 +0 -103
  235. data/_patches-20160118/eng-12249 +0 -40
  236. data/_patches-20160118/eng-12301 +0 -50
  237. data/_patches-20160118/eng-12720 +0 -74
  238. data/_patches-20160118/eng-12843 +0 -95
  239. data/_patches-20160118/eng-13040 +0 -291
  240. data/_patches-20160118/env-source +0 -112
  241. data/_patches-20160118/frickin-vagrant-spec +0 -163
  242. data/_patches-20160118/gem-pre-version +0 -14
  243. data/_patches-20160118/gems-old +0 -9
  244. data/_patches-20160118/googles-specs +0 -713
  245. data/_patches-20160118/local-configs-ignore +0 -61
  246. data/_patches-20160118/misc +0 -79
  247. data/_patches-20160118/network-unreachable +0 -31
  248. data/_patches-20160118/new-boxfile +0 -288
  249. data/_patches-20160118/parallelization-maybe +0 -198
  250. data/_patches-20160118/port-forwarding-processes +0 -87
  251. data/_patches-20160118/read-state +0 -23
  252. data/_patches-20160118/refactor-to-use-public_address-cap +0 -25
  253. data/_patches-20160118/series +0 -59
  254. data/_patches-20160118/status +0 -13
  255. data/_patches-20160118/test-move-env-data +0 -231
  256. data/_patches-20160118/test-vagrantfile-vm1 +0 -167
  257. data/_patches-20160118/vagrant-spec-mock-api +0 -137
  258. data/_patches-20160118/vagrant-vmware-plugin +0 -233
  259. data/_patches-20160118/vagrantfile +0 -403
  260. data/_patches-20160118/vagrantfile-for-acceptance-tests +0 -29
  261. data/_patches-20160118/vagrantfile-for-nick +0 -95
  262. data/_patches-20160118/vagrantfiles-to-forget-what-they-are-for +0 -134
  263. data/_patches-20160118/vm-vanished +0 -42
  264. data/_patches-20160118a/COMPLETED-ABOVE-THIS-LINE +0 -4
  265. data/_patches-20160118a/COMPLETED-BELOW-THIS-LINE +0 -4
  266. data/_patches-20160118a/CR-ABOVE-THIS-LINE +0 -4
  267. data/_patches-20160118a/CR-BELOW-THIS-LINE +0 -4
  268. data/_patches-20160118a/WIP-ABOVE-THIS-LINE +0 -4
  269. data/_patches-20160118a/WIP-BELOW-THIS-LINE +0 -4
  270. data/_patches-20160118a/acceptance-test-runner +0 -29
  271. data/_patches-20160118a/ansible-1 +0 -92
  272. data/_patches-20160118a/bar +0 -189
  273. data/_patches-20160118a/cache-api-client-in-up +0 -40
  274. data/_patches-20160118a/dead-code-in-actions +0 -44
  275. data/_patches-20160118a/debug-changes +0 -55
  276. data/_patches-20160118a/demo-rails-app +0 -1276
  277. data/_patches-20160118a/eng-10166-halt-spec +0 -40
  278. data/_patches-20160118a/eng-10256 +0 -554
  279. data/_patches-20160118a/eng-10256-cr +0 -314
  280. data/_patches-20160118a/eng-10256-ubuntu-testing +0 -88
  281. data/_patches-20160118a/eng-10269-test-stuff +0 -87
  282. data/_patches-20160118a/eng-10269-wtf +0 -119
  283. data/_patches-20160118a/eng-10369 +0 -143
  284. data/_patches-20160118a/eng-10369-tmp +0 -60
  285. data/_patches-20160118a/eng-10919 +0 -56
  286. data/_patches-20160118a/eng-11177-fix-actions-requires +0 -44
  287. data/_patches-20160118a/eng-11442 +0 -4
  288. data/_patches-20160118a/eng-11616 +0 -403
  289. data/_patches-20160118a/eng-11616-2 +0 -67
  290. data/_patches-20160118a/eng-11616-actual +0 -184
  291. data/_patches-20160118a/eng-11625a +0 -4
  292. data/_patches-20160118a/eng-11711 +0 -85
  293. data/_patches-20160118a/eng-12232-command-spec +0 -236
  294. data/_patches-20160118a/eng-12235 +0 -83
  295. data/_patches-20160118a/eng-12235-override-refactor +0 -140
  296. data/_patches-20160118a/eng-12240 +0 -103
  297. data/_patches-20160118a/eng-12249 +0 -40
  298. data/_patches-20160118a/eng-12301 +0 -50
  299. data/_patches-20160118a/eng-12720 +0 -74
  300. data/_patches-20160118a/eng-12843 +0 -95
  301. data/_patches-20160118a/eng-13040 +0 -291
  302. data/_patches-20160118a/env-source +0 -112
  303. data/_patches-20160118a/foo +0 -169
  304. data/_patches-20160118a/frickin-vagrant-spec +0 -163
  305. data/_patches-20160118a/gem-pre-version +0 -14
  306. data/_patches-20160118a/gems-old +0 -9
  307. data/_patches-20160118a/googles-specs +0 -713
  308. data/_patches-20160118a/guestport-madness +0 -59
  309. data/_patches-20160118a/local-configs-ignore +0 -61
  310. data/_patches-20160118a/misc +0 -79
  311. data/_patches-20160118a/network-unreachable +0 -31
  312. data/_patches-20160118a/new-boxfile +0 -288
  313. data/_patches-20160118a/parallelization-maybe +0 -198
  314. data/_patches-20160118a/port-forwarding-processes +0 -87
  315. data/_patches-20160118a/read-state +0 -23
  316. data/_patches-20160118a/refactor-to-use-public_address-cap +0 -25
  317. data/_patches-20160118a/series +0 -62
  318. data/_patches-20160118a/status +0 -14
  319. data/_patches-20160118a/test-move-env-data +0 -231
  320. data/_patches-20160118a/test-vagrantfile-vm1 +0 -167
  321. data/_patches-20160118a/vagrant-spec-mock-api +0 -137
  322. data/_patches-20160118a/vagrant-vmware-plugin +0 -233
  323. data/_patches-20160118a/vagrantfile +0 -403
  324. data/_patches-20160118a/vagrantfile-for-acceptance-tests +0 -29
  325. data/_patches-20160118a/vagrantfile-for-nick +0 -95
  326. data/_patches-20160118a/vagrantfiles-to-forget-what-they-are-for +0 -134
  327. data/_patches-20160118a/vm-vanished +0 -42
@@ -1,40 +0,0 @@
1
- # HG changeset patch
2
- # Parent 55c178c0f5096eedd87b19b31f647a9f3b37bec9
3
- diff -r 55c178c0f509 -r 1d887cdba67b spec/acceptance/provider/halt_spec.rb
4
- --- a/spec/acceptance/provider/halt_spec.rb Mon Oct 12 11:22:04 2015 -0700
5
- +++ b/spec/acceptance/provider/halt_spec.rb Mon Oct 12 11:22:13 2015 -0700
6
- @@ -1,3 +1,34 @@
7
- +# This tests that an instance can be halted correctly
8
- shared_examples 'provider/halt' do |provider, options|
9
- + if !options[:box]
10
- + raise ArgumentError,
11
- + "box option must be specified for provider: #{provider}"
12
- + end
13
-
14
- + include_context 'acceptance'
15
- +
16
- + before do
17
- + environment.skeleton('generic')
18
- + assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
19
- + assert_execute('vagrant', 'up', "--provider=#{provider}")
20
- + end
21
- +
22
- + after do
23
- + assert_execute('vagrant', 'destroy', '--force')
24
- + end
25
- +
26
- + it 'should halt the machine and bring it back up' do
27
- + status("Test: machine can be halted")
28
- + halt_result = execute("vagrant", "halt")
29
- + expect(halt_result).to exit_with(0)
30
- +
31
- + status("Test: machine can be brought up after halt")
32
- + up_result = execute("vagrant", "up")
33
- + expect(up_result).to exit_with(0)
34
- +
35
- + status("Test: machine is running after up")
36
- + echo_result = execute("vagrant", "ssh", "-c", "echo foo")
37
- + expect(echo_result).to exit_with(0)
38
- + expect(echo_result.stdout).to match(/foo\n$/)
39
- + end
40
- end
@@ -1,527 +0,0 @@
1
- # HG changeset patch
2
- # Parent 9277259db23ef4e33b90e83fbd16f6624145b338
3
- # Parent 9277259db23ef4e33b90e83fbd16f6624145b338
4
- ENG-10256 port forwarding
5
-
6
- diff -r 9277259db23e lib/vagrant-skytap/action.rb
7
- --- a/lib/vagrant-skytap/action.rb Fri Jan 08 11:52:01 2016 -0800
8
- +++ b/lib/vagrant-skytap/action.rb Tue Jan 12 14:34:08 2016 -0800
9
- @@ -16,6 +16,7 @@
10
- b1.use MessageNotCreated
11
- else
12
- b1.use StopVm
13
- + b1.use ClearForwardedPorts
14
- end
15
- end
16
- end
17
- @@ -31,6 +32,7 @@
18
- b1.use MessageNotCreated
19
- else
20
- b1.use SuspendVm
21
- + b1.use ClearForwardedPorts
22
- end
23
- end
24
- end
25
- @@ -65,6 +67,7 @@
26
- end
27
- end
28
- end
29
- + b.use ClearForwardedPorts
30
- b.use PrepareNFSValidIds
31
- b.use SyncedFolderCleanup
32
- end
33
- @@ -251,6 +254,7 @@
34
- end
35
- end
36
- b.use WaitForCommunicator
37
- + b.use action_forward_ports
38
- end
39
- end
40
-
41
- @@ -281,15 +285,25 @@
42
- end
43
- end
44
-
45
- + def self.action_forward_ports
46
- + Vagrant::Action::Builder.new.tap do |b|
47
- + b.use ClearForwardedPorts
48
- + b.use ReadSSHInfo
49
- + b.use ForwardPorts
50
- + end
51
- + end
52
- +
53
- # The autoload farm
54
- action_root = Pathname.new(File.expand_path("../action", __FILE__))
55
- autoload :StoreExtraData, action_root.join("store_extra_data")
56
- autoload :AddVmToEnvironment, action_root.join("add_vm_to_environment")
57
- + autoload :ClearForwardedPorts, action_root.join("clear_forwarded_ports")
58
- autoload :CreateEnvironment, action_root.join("create_environment")
59
- autoload :DeleteEnvironment, action_root.join("delete_environment")
60
- autoload :DeleteVm, action_root.join("delete_vm")
61
- autoload :ExistenceCheck, action_root.join("existence_check")
62
- autoload :FetchEnvironment, action_root.join("fetch_environment")
63
- + autoload :ForwardPorts, action_root.join("forward_ports")
64
- autoload :InitializeAPIClient, action_root.join("initialize_api_client")
65
- autoload :InitialState, action_root.join("initial_state")
66
- autoload :IsParallelized, action_root.join("is_parallelized")
67
- diff -r 9277259db23e lib/vagrant-skytap/action/clear_forwarded_ports.rb
68
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69
- +++ b/lib/vagrant-skytap/action/clear_forwarded_ports.rb Tue Jan 12 14:34:08 2016 -0800
70
- @@ -0,0 +1,23 @@
71
- +#require 'byebug'
72
- +require "vagrant/util/safe_chdir"
73
- +
74
- +
75
- +module VagrantPlugins
76
- + module Skytap
77
- + module Action
78
- + class ClearForwardedPorts
79
- + def initialize(app, env)
80
- + @app = app
81
- + @env = env
82
- + end
83
- +
84
- + def call(env)
85
- + env[:ui].info I18n.t("vagrant.actions.vm.clear_forward_ports.deleting")
86
- + pidfiles = @env[:host].capability(:kill_forwarded_ports, @env)
87
- +
88
- + @app.call(env)
89
- + end
90
- + end
91
- + end
92
- + end
93
- +end
94
- diff -r 9277259db23e lib/vagrant-skytap/action/forward_ports.rb
95
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
96
- +++ b/lib/vagrant-skytap/action/forward_ports.rb Tue Jan 12 14:34:08 2016 -0800
97
- @@ -0,0 +1,45 @@
98
- +require 'vagrant-skytap/util/compile_forwarded_ports'
99
- +#require 'byebug'
100
- +
101
- +module VagrantPlugins
102
- + module Skytap
103
- + module Action
104
- + class ForwardPorts
105
- + include Util::CompileForwardedPorts
106
- +
107
- + def initialize(app, env)
108
- + @app = app
109
- + end
110
- +
111
- + def call(env)
112
- + @env = env
113
- + env[:forwarded_ports] ||= compile_forwarded_ports(env[:machine].config)
114
- +
115
- + env[:forwarded_ports].each do |fp|
116
- + if fp.host_port <= 1024
117
- + env[:ui].warn I18n.t("vagrant.actions.vm.forward_ports.privileged_ports")
118
- + break
119
- + end
120
- + end
121
- +
122
- + env[:ui].output(I18n.t("vagrant.actions.vm.forward_ports.forwarding"))
123
- + forward_ports
124
- +
125
- + @app.call(env)
126
- + end
127
- +
128
- + def forward_ports
129
- + @env[:forwarded_ports].each do |fp|
130
- + unless fp.guest_port == 22 && fp.host_port == 2222
131
- + @env[:ui].detail(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry",
132
- + adapter: fp.adapter,
133
- + guest_port: fp.guest_port,
134
- + host_port: fp.host_port))
135
- + @env[:host].capability(:start_ssh_tunnel, fp, @env)
136
- + end
137
- + end
138
- + end
139
- + end
140
- + end
141
- + end
142
- +end
143
- diff -r 9277259db23e lib/vagrant-skytap/hosts/bsd/cap/ssh_tunnel.rb
144
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
145
- +++ b/lib/vagrant-skytap/hosts/bsd/cap/ssh_tunnel.rb Tue Jan 12 14:34:08 2016 -0800
146
- @@ -0,0 +1,15 @@
147
- +require "vagrant-skytap/hosts/common/cap/ssh_tunnel"
148
- +
149
- +module VagrantPlugins
150
- + module Skytap
151
- + module HostBSD
152
- + module Cap
153
- + class SSHTunnel < VagrantPlugins::Skytap::Common::Cap::SSHTunnel
154
- + def self.create_logger
155
- + Log4r::Logger.new("vagrant::hosts::bsd")
156
- + end
157
- + end
158
- + end
159
- + end
160
- + end
161
- +end
162
- diff -r 9277259db23e lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb
163
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
164
- +++ b/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb Tue Jan 12 14:34:08 2016 -0800
165
- @@ -0,0 +1,119 @@
166
- +require "pathname"
167
- +require "tmpdir"
168
- +require 'childprocess'
169
- +require "vagrant/util/subprocess"
170
- +require 'byebug'
171
- +require 'awesome_print'
172
- +require 'log4r'
173
- +require "vagrant/util/safe_chdir"
174
- +
175
- +module VagrantPlugins
176
- + module Skytap
177
- + module HostCommon
178
- + module Cap
179
- + class SSHTunnel
180
- + def self.create_logger
181
- + Log4r::Logger.new("vagrant::hosts::common")
182
- + end
183
- +
184
- + # called per port by ForwardPorts
185
- + def self.start_ssh_tunnel(env, fp, env_hash)
186
- + logger = create_logger
187
- + machine = env_hash[:machine]
188
- + pid = read_pid(File.join(machine.data_dir, pidfile_name(fp)))
189
- + if pid && autossh_pid?(pid)
190
- + logger.info("An autossh process already exists with pid #{pid}.")
191
- + else
192
- + args = autossh_args(fp, pidfile, env_hash)
193
- + Vagrant::Util::Subprocess.execute("autossh", *args)
194
- + end
195
- + end
196
- +
197
- + # called for machine by ClearForwardedPorts
198
- + def self.kill_forwarded_ports(env, env_hash)
199
- + get_pidfiles_for_machine(env_hash[:machine]).each do |pidfile|
200
- + kill_ssh_tunnel(env, pidfile, env_hash)
201
- + end
202
- + end
203
- +
204
- + # exposed but not called currently from any action
205
- + def self.kill_ssh_tunnel(env, pidfile, env_hash)
206
- + logger = create_logger
207
- + machine = env_hash[:machine]
208
- + pid = read_pid(File.join(machine.data_dir, pidfile))
209
- + if pid && autossh_pid?(pid)
210
- + Vagrant::Util::Subprocess.execute("kill", pid.to_s)
211
- + else
212
- + logger.info("Cleaning up stale autossh pidfile #{pidfile}.")
213
- + Vagrant::Util::Subprocess.execute("rm", pidfile)
214
- + end
215
- + end
216
- +
217
- + ####################################
218
- +
219
- + def self.pidfile_name(fp)
220
- + "#{fp[:host_ip]}.pid"
221
- + end
222
- +
223
- + def self.read_pid(pidfile_path)
224
- + File.read(pidfile_path).presence.try(:to_i) if File.exist?(pidfile_path)
225
- + end
226
- +
227
- + def self.get_pidfiles_for_machine(machine)
228
- + pidfiles = []
229
- + Vagrant::Util::SafeChdir.safe_chdir(machine.data_dir) do
230
- + pidfiles = Dir.glob("*.pid")
231
- + end
232
- + pidfiles
233
- + end
234
- +
235
- + ####################################
236
- +
237
- + # Checks that the pid is actually an autossh process (and not
238
- + # something else using a recycled pid).
239
- + def self.autossh_pid?(pid)
240
- + # get_comm_for_pid(pid) == 'autossh'
241
- + true
242
- + end
243
- +
244
- + # Get the command, minus any arguments, for the given
245
- + # pid. This probably needs to be overridden per host cap
246
- + def self.get_comm_for_pid(pid)
247
- + result = Vagrant::Util::Subprocess.execute("ps", "-p", pid.to_s, "-o", "comm")
248
- + result.stdout.split("\n").last
249
- + end
250
- +
251
- + ####################################
252
- +
253
- + def self.autossh_args(fp, pidfile, env_hash)
254
- + machine = env_hash[:machine]
255
- + ssh_info = env_hash[:machine_ssh_info]
256
- + ssh_options = {
257
- + "ServerAliveInterval" => 10,
258
- + "ServerAliveCountMax" => 3,
259
- + "StrictHostKeyChecking" => "no",
260
- + }
261
- + environment_variables = {
262
- + env: {
263
- + "AUTOSSH_PIDFILE" => pidfile,
264
- + "AUTOSSH_PORT" => 0, # turn off monitoring
265
- + }
266
- + }
267
- +
268
- + autossh_args = []
269
- + autossh_args << "-q"
270
- + autossh_args << "-N"
271
- + autossh_args << "-f"
272
- + autossh_args << "-i" << machine.data_dir.join("private_key").to_s
273
- + autossh_args << "-L" << "#{fp[:host_port]}:localhost:#{fp[:guest_port]}"
274
- + ssh_options.each do |k, v|
275
- + autossh_args << "-o" << "#{k}=#{v}"
276
- + end
277
- + autossh_args << "#{ssh_info[:username]}@#{ssh_info[:host]}"
278
- + autossh_args << environment_variables
279
- + end
280
- + end
281
- + end
282
- + end
283
- + end
284
- +end
285
- diff -r 9277259db23e lib/vagrant-skytap/hosts/linux/cap/ssh_tunnel.rb
286
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
287
- +++ b/lib/vagrant-skytap/hosts/linux/cap/ssh_tunnel.rb Tue Jan 12 14:34:08 2016 -0800
288
- @@ -0,0 +1,15 @@
289
- +require "vagrant-skytap/hosts/common/cap/ssh_tunnel"
290
- +
291
- +module VagrantPlugins
292
- + module Skytap
293
- + module HostLinux
294
- + module Cap
295
- + class SSHTunnel < VagrantPlugins::Skytap::Common::Cap::SSHTunnel
296
- + def self.create_logger
297
- + Log4r::Logger.new("vagrant::hosts::linux")
298
- + end
299
- + end
300
- + end
301
- + end
302
- + end
303
- +end
304
- diff -r 9277259db23e lib/vagrant-skytap/hosts/windows/cap/ssh_tunnel.rb
305
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
306
- +++ b/lib/vagrant-skytap/hosts/windows/cap/ssh_tunnel.rb Tue Jan 12 14:34:08 2016 -0800
307
- @@ -0,0 +1,23 @@
308
- +require "vagrant-skytap/hosts/common/cap/ssh_tunnel"
309
- +
310
- +module VagrantPlugins
311
- + module Skytap
312
- + module HostWindows
313
- + module Cap
314
- + class SSHTunnel < VagrantPlugins::Skytap::Common::Cap::SSHTunnel
315
- + def self.create_logger
316
- + Log4r::Logger.new("vagrant::hosts::windows")
317
- + end
318
- +
319
- + def self.start_ssh_tunnel(env, fp, env_hash)
320
- + env[:ui].info I18n.t("Port forwarding is currently not supported on Windows. Skipping...")
321
- + end
322
- +
323
- + def self.kill_ssh_tunnel(env, pidfile, env_hash)
324
- + env[:ui].info I18n.t("Port forwarding is currently not supported on Windows. Skipping...")
325
- + end
326
- + end
327
- + end
328
- + end
329
- + end
330
- +end
331
- diff -r 9277259db23e lib/vagrant-skytap/model/forwarded_port.rb
332
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
333
- +++ b/lib/vagrant-skytap/model/forwarded_port.rb Tue Jan 12 14:34:08 2016 -0800
334
- @@ -0,0 +1,70 @@
335
- +module VagrantPlugins
336
- + module Skytap
337
- + module Model
338
- + # Represents a single forwarded port for VirtualBox. This has various
339
- + # helpers and defaults for a forwarded port.
340
- + class ForwardedPort
341
- + # The NAT adapter on which to attach the forwarded port.
342
- + #
343
- + # @return [Integer]
344
- + attr_reader :adapter
345
- +
346
- + # If true, this port should be auto-corrected.
347
- + #
348
- + # @return [Boolean]
349
- + attr_reader :auto_correct
350
- +
351
- + # The unique ID for the forwarded port.
352
- + #
353
- + # @return [String]
354
- + attr_reader :id
355
- +
356
- + # The protocol to forward.
357
- + #
358
- + # @return [String]
359
- + attr_reader :protocol
360
- +
361
- + # The IP that the forwarded port will connect to on the guest machine.
362
- + #
363
- + # @return [String]
364
- + attr_reader :guest_ip
365
- +
366
- + # The port on the guest to be exposed on the host.
367
- + #
368
- + # @return [Integer]
369
- + attr_reader :guest_port
370
- +
371
- + # The IP that the forwarded port will bind to on the host machine.
372
- + #
373
- + # @return [String]
374
- + attr_reader :host_ip
375
- +
376
- + # The port on the host used to access the port on the guest.
377
- + #
378
- + # @return [Integer]
379
- + attr_reader :host_port
380
- +
381
- + def initialize(id, host_port, guest_port, options)
382
- + @id = id
383
- + @guest_port = guest_port
384
- + @host_port = host_port
385
- +
386
- + options ||= {}
387
- + @auto_correct = false
388
- + @auto_correct = options[:auto_correct] if options.key?(:auto_correct)
389
- + @adapter = (options[:adapter] || 1).to_i
390
- + @guest_ip = options[:guest_ip] || nil
391
- + @host_ip = options[:host_ip] || nil
392
- + @protocol = options[:protocol] || "tcp"
393
- + end
394
- +
395
- + # This corrects the host port and changes it to the given new port.
396
- + #
397
- + # @param [Integer] new_port The new port
398
- + def correct_host_port(new_port)
399
- + @host_port = new_port
400
- + end
401
- + end
402
- + end
403
- + end
404
- +end
405
- diff -r 9277259db23e lib/vagrant-skytap/plugin.rb
406
- --- a/lib/vagrant-skytap/plugin.rb Fri Jan 08 11:52:01 2016 -0800
407
- +++ b/lib/vagrant-skytap/plugin.rb Tue Jan 12 14:34:08 2016 -0800
408
- @@ -49,6 +49,81 @@
409
- Cap::PublicAddress
410
- end
411
-
412
- + host_capability("bsd", "start_ssh_tunnel") do
413
- + require_relative "hosts/bsd/cap/ssh_tunnel"
414
- + HostBSD::Cap::SSHTunnel
415
- + end
416
- +
417
- + host_capability("bsd", "kill_ssh_tunnel") do
418
- + require_relative "hosts/bsd/cap/ssh_tunnel"
419
- + HostBSD::Cap::SSHTunnel
420
- + end
421
- +
422
- + host_capability("bsd", "kill_forwarded_ports") do
423
- + require_relative "hosts/bsd/cap/ssh_tunnel"
424
- + HostBSD::Cap::SSHTunnel
425
- + end
426
- +
427
- +# host_capability("bsd", "read_used_ports") do
428
- +# require_relative "hosts/bsd/cap/ssh_tunnel"
429
- +# HostBSD::Cap::SSHTunnel
430
- +# end
431
- +#
432
- +# host_capability("bsd", "read_forwarded_ports") do
433
- +# require_relative "hosts/bsd/cap/ssh_tunnel"
434
- +# HostBSD::Cap::SSHTunnel
435
- +# end
436
- +
437
- + host_capability("linux", "start_ssh_tunnel") do
438
- + require_relative "hosts/linux/cap/ssh_tunnel"
439
- + HostLinux::Cap::SSHTunnel
440
- + end
441
- +
442
- + host_capability("linux", "kill_ssh_tunnel") do
443
- + require_relative "hosts/linux/cap/ssh_tunnel"
444
- + HostLinux::Cap::SSHTunnel
445
- + end
446
- +
447
- + host_capability("linux", "kill_forwarded_ports") do
448
- + require_relative "hosts/windows/cap/ssh_tunnel"
449
- + HostWindows::Cap::SSHTunnel
450
- + end
451
- +
452
- +# host_capability("linux", "read_used_ports") do
453
- +# require_relative "hosts/linux/cap/ssh_tunnel"
454
- +# HostLinux::Cap::SSHTunnel
455
- +# end
456
- +#
457
- +# host_capability("linux", "read_forwarded_ports") do
458
- +# require_relative "hosts/linux/cap/ssh_tunnel"
459
- +# HostLinux::Cap::SSHTunnel
460
- +# end
461
- +
462
- + host_capability("windows", "start_ssh_tunnel") do
463
- + require_relative "hosts/windows/cap/ssh_tunnel"
464
- + HostWindows::Cap::SSHTunnel
465
- + end
466
- +
467
- + host_capability("windows", "kill_ssh_tunnel") do
468
- + require_relative "hosts/windows/cap/ssh_tunnel"
469
- + HostWindows::Cap::SSHTunnel
470
- + end
471
- +
472
- + host_capability("windows", "kill_forwarded_ports") do
473
- + require_relative "hosts/windows/cap/ssh_tunnel"
474
- + HostWindows::Cap::SSHTunnel
475
- + end
476
- +
477
- +# host_capability("windows", "read_used_ports") do
478
- +# require_relative "hosts/windows/cap/ssh_tunnel"
479
- +# HostWindows::Cap::SSHTunnel
480
- +# end
481
- +#
482
- +# host_capability("windows", "read_forwarded_ports") do
483
- +# require_relative "hosts/windows/cap/ssh_tunnel"
484
- +# HostWindows::Cap::SSHTunnel
485
- +# end
486
- +
487
- # This initializes the internationalization strings.
488
- def self.setup_i18n
489
- I18n.load_path << File.expand_path("locales/en.yml", Skytap.source_root)
490
- diff -r 9277259db23e lib/vagrant-skytap/util/compile_forwarded_ports.rb
491
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
492
- +++ b/lib/vagrant-skytap/util/compile_forwarded_ports.rb Tue Jan 12 14:34:08 2016 -0800
493
- @@ -0,0 +1,34 @@
494
- +require "vagrant/util/scoped_hash_override"
495
- +require 'vagrant-skytap/model/forwarded_port'
496
- +module VagrantPlugins
497
- + module Skytap
498
- + module Util
499
- + module CompileForwardedPorts
500
- + include Vagrant::Util::ScopedHashOverride
501
- +
502
- + # This method compiles the forwarded ports into {ForwardedPort}
503
- + # models.
504
- + def compile_forwarded_ports(config)
505
- + mappings = {}
506
- +
507
- + config.vm.networks.each do |type, options|
508
- + if type == :forwarded_port
509
- + guest_port = options[:guest]
510
- + host_port = options[:host]
511
- + protocol = options[:protocol] || "tcp"
512
- + options = scoped_hash_override(options, :skytap)
513
- + id = options[:id]
514
- +
515
- + # If the forwarded port was marked as disabled, ignore.
516
- + next if options[:disabled]
517
- + mappings[host_port.to_s + protocol.to_s] =
518
- + Model::ForwardedPort.new(id, host_port, guest_port, options)
519
- + end
520
- + end
521
- +
522
- + mappings.values
523
- + end
524
- + end
525
- + end
526
- + end
527
- +end