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