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,35 @@
|
|
1
|
+
require "vagrant/util/scoped_hash_override"
|
2
|
+
require 'vagrant-skytap/model/forwarded_port'
|
3
|
+
module VagrantPlugins
|
4
|
+
module Skytap
|
5
|
+
module Util
|
6
|
+
# This is based on code from the VirtualBox provider.
|
7
|
+
module CompileForwardedPorts
|
8
|
+
include Vagrant::Util::ScopedHashOverride
|
9
|
+
|
10
|
+
# This method compiles the forwarded ports into {ForwardedPort}
|
11
|
+
# models.
|
12
|
+
def compile_forwarded_ports(config)
|
13
|
+
mappings = {}
|
14
|
+
|
15
|
+
config.vm.networks.each do |type, options|
|
16
|
+
if type == :forwarded_port
|
17
|
+
guest_port = options[:guest]
|
18
|
+
host_port = options[:host]
|
19
|
+
protocol = options[:protocol] || "tcp"
|
20
|
+
options = scoped_hash_override(options, :skytap)
|
21
|
+
id = options[:id]
|
22
|
+
|
23
|
+
# If the forwarded port was marked as disabled, ignore.
|
24
|
+
next if options[:disabled]
|
25
|
+
mappings[host_port.to_s + protocol.to_s] =
|
26
|
+
Model::ForwardedPort.new(id, host_port, guest_port, options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
mappings.values
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/locales/en.yml
CHANGED
@@ -109,6 +109,9 @@ en:
|
|
109
109
|
region_mismatch: |-
|
110
110
|
A VM from the '%{vm_region}' region cannot be added to an environment in the '%{environment_region}' region.
|
111
111
|
|
112
|
+
feature_not_supported_for_host_os: |-
|
113
|
+
The %{feature_name} feature is currently not supported for your host operating system.
|
114
|
+
|
112
115
|
states:
|
113
116
|
short_not_created: |-
|
114
117
|
not created
|
@@ -81,9 +81,21 @@ describe VagrantPlugins::Skytap::API::Environment do
|
|
81
81
|
expect {described_class.check_vm_before_adding(env, subject)}.to_not raise_error
|
82
82
|
end
|
83
83
|
|
84
|
-
it "raises
|
84
|
+
it "raises nothing if the vm is part of an environment" do
|
85
85
|
vm = VagrantPlugins::Skytap::API::Vm.new(config_vm_attrs, nil, env)
|
86
|
-
expect {described_class.check_vm_before_adding(env, vm)}.
|
86
|
+
expect {described_class.check_vm_before_adding(env, vm)}.to_not raise_error
|
87
|
+
end
|
88
|
+
|
89
|
+
it "raises SourceVmNotStopped if the environment vm is running" do
|
90
|
+
vm = VagrantPlugins::Skytap::API::Vm.new(config_vm_attrs, nil, env)
|
91
|
+
allow(vm).to receive(:runstate).and_return('running')
|
92
|
+
expect {described_class.check_vm_before_adding(env, vm)}.to raise_error(Errors::SourceVmNotStopped)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "raises SourceVmNotStopped if the environment vm is suspended" do
|
96
|
+
vm = VagrantPlugins::Skytap::API::Vm.new(config_vm_attrs, nil, env)
|
97
|
+
allow(vm).to receive(:runstate).and_return('suspended')
|
98
|
+
expect {described_class.check_vm_before_adding(env, vm)}.to raise_error(Errors::SourceVmNotStopped)
|
87
99
|
end
|
88
100
|
end
|
89
101
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
require "vagrant-skytap/model/forwarded_port"
|
3
|
+
|
4
|
+
describe VagrantPlugins::Skytap::Model::ForwardedPort do
|
5
|
+
include_context "unit"
|
6
|
+
|
7
|
+
let(:fp1) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp9000", 9000, 80, protocol: 'tcp') }
|
8
|
+
let(:fp2) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp80", 80, 80, protocol: 'tcp') }
|
9
|
+
let(:fp3) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp2222", 2222, 22, protocol: 'tcp') }
|
10
|
+
let(:fp4) { VagrantPlugins::Skytap::Model::ForwardedPort.new("ssh", 2201, 22, protocol: 'tcp') }
|
11
|
+
let(:fp5) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp1024", 1024, 80, protocol: 'tcp') }
|
12
|
+
let(:fp6) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp9000", 80, 1025, protocol: 'tcp') }
|
13
|
+
|
14
|
+
describe "privileged_host_port?" do
|
15
|
+
it "returns false for host port above 1024" do
|
16
|
+
expect(fp1.privileged_host_port?).to be false
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns true for host port below 1024" do
|
20
|
+
expect(fp2.privileged_host_port?).to be true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns true for host port 1024" do
|
24
|
+
expect(fp5.privileged_host_port?).to be true
|
25
|
+
end
|
26
|
+
|
27
|
+
it "returns true for host port 80 if guest port is over 1024" do
|
28
|
+
expect(fp6.privileged_host_port?).to be true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "internal_ssh_port?" do
|
33
|
+
it "returns false for typical host port" do
|
34
|
+
expect(fp1.internal_ssh_port?).to be false
|
35
|
+
end
|
36
|
+
|
37
|
+
it "returns true when guest port is 22 and host port is 2222" do
|
38
|
+
expect(fp3.internal_ssh_port?).to be true
|
39
|
+
end
|
40
|
+
|
41
|
+
it "returns true when id has special value 'ssh'" do
|
42
|
+
expect(fp4.internal_ssh_port?).to be true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
require File.expand_path("../../../../base", __FILE__)
|
2
|
+
require "vagrant-skytap/model/forwarded_port"
|
3
|
+
|
4
|
+
describe "VagrantPlugins::Skytap::HostCommon::Cap::SSHTunnel" do
|
5
|
+
let(:described_class) do
|
6
|
+
VagrantPlugins::Skytap::Plugin.components.host_capabilities[:bsd].get(:start_ssh_tunnel)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:machine) { double("machine") }
|
10
|
+
let(:forwarded_port1) { VagrantPlugins::Skytap::Model::ForwardedPort.new('tcp9000', 9000, 80, protocol: "tcp") }
|
11
|
+
let(:forwarded_port2) { VagrantPlugins::Skytap::Model::ForwardedPort.new('tcp9001', 9001, 81, protocol: "tcp") }
|
12
|
+
let(:pidfile1) { "tcp9000_tcp_9000_80.pid" }
|
13
|
+
let(:ssh_info) { {username: 'user', host: '10.0.0.1'} }
|
14
|
+
let(:env_path) { Pathname.new(File.expand_path("../../../../support/forwarded_ports", __FILE__)) }
|
15
|
+
let(:env) { double("env") }
|
16
|
+
|
17
|
+
let(:subprocess) { double("Vagrant::Util::Subprocess") }
|
18
|
+
let(:result) { Vagrant::Util::Subprocess::Result.new(0, "", "") }
|
19
|
+
|
20
|
+
before do
|
21
|
+
allow(env).to receive(:local_data_path).and_return(env_path)
|
22
|
+
allow(machine).to receive(:data_dir).and_return(env.local_data_path.join("machines/vm1/skytap"))
|
23
|
+
allow(machine).to receive(:ssh_info).and_return(ssh_info)
|
24
|
+
allow(machine).to receive(:name).and_return('vm1')
|
25
|
+
|
26
|
+
result
|
27
|
+
stub_const("Vagrant::Util::Subprocess", subprocess)
|
28
|
+
allow(subprocess).to receive(:execute).and_return(result)
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "start_ssh_tunnel" do
|
32
|
+
it "kills an existing tunnel" do
|
33
|
+
expect(described_class).to receive(:kill_ssh_tunnel)
|
34
|
+
#expect(subprocess).to receive(:execute).with('kill', '99999')
|
35
|
+
#expect(subprocess).to receive(:execute).with('autossh', "-f", anything)
|
36
|
+
described_class.start_ssh_tunnel(env, forwarded_port1, machine)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "kill_ssh_tunnel" do
|
41
|
+
it "kills the right process" do
|
42
|
+
expect(subprocess).to receive(:execute).once.with('kill', '99999')
|
43
|
+
described_class.kill_ssh_tunnel(env, forwarded_port1, machine)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "clear_forwarded_ports" do
|
48
|
+
it "kills two processes" do
|
49
|
+
expect(subprocess).to receive(:execute).with('kill', '99999')
|
50
|
+
expect(subprocess).to receive(:execute).with('kill', '90210')
|
51
|
+
described_class.clear_forwarded_ports(env, machine)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "read_forwarded_ports" do
|
56
|
+
it "returns two ForwardedPort objects for vm1 only" do
|
57
|
+
fps = described_class.read_forwarded_ports(env, machine)
|
58
|
+
expect(fps.count).to eq(2)
|
59
|
+
fp1, fp2 = fps.sort_by(&:id)
|
60
|
+
|
61
|
+
expect(fp1.id).to eq("tcp9000")
|
62
|
+
expect(fp1.host_port).to eq(9000)
|
63
|
+
expect(fp1.guest_port).to eq(80)
|
64
|
+
expect(fp1.protocol).to eq("tcp")
|
65
|
+
|
66
|
+
expect(fp2.id).to eq("tcp9001")
|
67
|
+
expect(fp2.host_port).to eq(9001)
|
68
|
+
expect(fp2.guest_port).to eq(81)
|
69
|
+
expect(fp2.protocol).to eq("tcp")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "read_used_ports" do
|
74
|
+
it "returns one ForwardedPort object for all skytap machines except vm1" do
|
75
|
+
fps = described_class.read_used_ports(env, machine)
|
76
|
+
expect(fps.count).to eq(2)
|
77
|
+
fp1, fp2 = fps.sort_by(&:id)
|
78
|
+
|
79
|
+
expect(fp1.id).to eq("tcp8080")
|
80
|
+
expect(fp1.host_port).to eq(8080)
|
81
|
+
expect(fp1.guest_port).to eq(80)
|
82
|
+
expect(fp1.protocol).to eq("tcp")
|
83
|
+
|
84
|
+
expect(fp2.id).to eq("tcp8888")
|
85
|
+
expect(fp2.host_port).to eq(8888)
|
86
|
+
expect(fp2.guest_port).to eq(80)
|
87
|
+
expect(fp2.protocol).to eq("tcp")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "read_pid" do
|
92
|
+
it "reads the pid" do
|
93
|
+
pid = described_class.read_pid(machine.data_dir.join(pidfile1))
|
94
|
+
expect(pid).to eq(99999)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "returns nil if pidfile missing" do
|
98
|
+
pid = described_class.read_pid(machine.data_dir.join("tcp12345.pid"))
|
99
|
+
expect(pid).to be(nil)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "get_fp_from_directory" do
|
104
|
+
it "gets the ForwardedPorts for the directory" do
|
105
|
+
fps = described_class.get_fp_from_directory(machine.data_dir)
|
106
|
+
expect(fps.count).to eq(2)
|
107
|
+
fp1, fp2 = fps.sort_by(&:id)
|
108
|
+
|
109
|
+
expect(fp1.id).to eq("tcp9000")
|
110
|
+
expect(fp1.host_port).to eq(9000)
|
111
|
+
expect(fp1.guest_port).to eq(80)
|
112
|
+
expect(fp1.protocol).to eq("tcp")
|
113
|
+
|
114
|
+
expect(fp2.id).to eq("tcp9001")
|
115
|
+
expect(fp2.host_port).to eq(9001)
|
116
|
+
expect(fp2.guest_port).to eq(81)
|
117
|
+
expect(fp2.protocol).to eq("tcp")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "machine_data_dirs" do
|
122
|
+
it "gets only skytap machine dirs" do
|
123
|
+
map = described_class.machine_data_dirs(env)
|
124
|
+
expect(map).to eq({
|
125
|
+
'vm1' => env_path.join("machines/vm1/skytap"),
|
126
|
+
'vm2' => env_path.join("machines/vm2/skytap"),
|
127
|
+
'vm4' => env_path.join("machines/vm4/skytap"),
|
128
|
+
})
|
129
|
+
expect(map.values.first).to be_a(Pathname)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe "pidfile_to_fp" do
|
134
|
+
it "parses the pidfile name" do
|
135
|
+
fp = described_class.pidfile_to_fp(pidfile1)
|
136
|
+
expect(fp.id).to eq("tcp9000")
|
137
|
+
expect(fp.host_port).to eq(9000)
|
138
|
+
expect(fp.guest_port).to eq(80)
|
139
|
+
expect(fp.protocol).to eq("tcp")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "fp_to_pidfile" do
|
144
|
+
it "creates the pidfile name" do
|
145
|
+
pidfile = described_class.fp_to_pidfile(forwarded_port1)
|
146
|
+
expect(pidfile).to eq(pidfile1)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe "pidfile_path" do
|
151
|
+
it "gets the pidfile path" do
|
152
|
+
path = described_class.pidfile_path(forwarded_port1, machine)
|
153
|
+
expect(path).to eq(machine.data_dir.join(pidfile1).to_s)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe "ssh_args" do
|
158
|
+
it "returns expected args" do
|
159
|
+
args = described_class.ssh_args(forwarded_port1, machine)
|
160
|
+
expect(args).to eq(["-q", "-N",
|
161
|
+
"-i", machine.data_dir.join("private_key").to_s,
|
162
|
+
"-L", "9000:localhost:80",
|
163
|
+
"-o", "ServerAliveInterval=10",
|
164
|
+
"-o", "ServerAliveCountMax=3",
|
165
|
+
"-o", "StrictHostKeyChecking=no",
|
166
|
+
"user@10.0.0.1"
|
167
|
+
])
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "autossh_environment_variables" do
|
172
|
+
it "defaults monitoring port to 0" do
|
173
|
+
vars = described_class.autossh_environment_variables(forwarded_port1, machine)
|
174
|
+
expect(vars).to eq({
|
175
|
+
"AUTOSSH_PIDFILE" => machine.data_dir.join(pidfile1).to_s,
|
176
|
+
"AUTOSSH_PORT" => 0,
|
177
|
+
})
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
require "vagrant-skytap/model/forwarded_port"
|
3
|
+
|
4
|
+
describe VagrantPlugins::Skytap::Model::ForwardedPort do
|
5
|
+
include_context "unit"
|
6
|
+
|
7
|
+
let(:fp1) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp9000", 9000, 80, protocol: 'tcp') }
|
8
|
+
let(:fp2) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp80", 80, 80, protocol: 'tcp') }
|
9
|
+
let(:fp3) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp2222", 2222, 22, protocol: 'tcp') }
|
10
|
+
let(:fp4) { VagrantPlugins::Skytap::Model::ForwardedPort.new("ssh", 2201, 22, protocol: 'tcp') }
|
11
|
+
let(:fp5) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp1024", 1024, 80, protocol: 'tcp') }
|
12
|
+
let(:fp6) { VagrantPlugins::Skytap::Model::ForwardedPort.new("tcp9000", 80, 1025, protocol: 'tcp') }
|
13
|
+
|
14
|
+
describe "privileged_host_port?" do
|
15
|
+
it "returns false for host port above 1024" do
|
16
|
+
expect(fp1.privileged_host_port?).to be false
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns true for host port below 1024" do
|
20
|
+
expect(fp2.privileged_host_port?).to be true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns true for host port 1024" do
|
24
|
+
expect(fp5.privileged_host_port?).to be true
|
25
|
+
end
|
26
|
+
|
27
|
+
it "returns true for host port 80 if guest port is over 1024" do
|
28
|
+
expect(fp6.privileged_host_port?).to be true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "internal_ssh_port?" do
|
33
|
+
it "returns false for typical host port" do
|
34
|
+
expect(fp1.internal_ssh_port?).to be false
|
35
|
+
end
|
36
|
+
|
37
|
+
it "returns true when guest port is 22 and host port is 2222" do
|
38
|
+
expect(fp3.internal_ssh_port?).to be true
|
39
|
+
end
|
40
|
+
|
41
|
+
it "returns true when id has special value 'ssh'" do
|
42
|
+
expect(fp4.internal_ssh_port?).to be true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
#- [ ] Set up a “real" environment & machine
|
49
|
+
#- [ ] Give it a Vagrantfile with a collision
|
50
|
+
#- [ ] Provide matching machine folders.
|
51
|
+
#- [ ] read_used_ports and read_forwarded_ports will have natural return values.
|
52
|
+
#- [ ] Check that :port_collision_extra_in_use and :port_collision_remap are correct.
|
53
|
+
#- [ ] Case where read_forwarded_ports returns []. :port_collision_remap should be {}.
|
54
|
+
#- [ ] Case where read_forwarded_ports returns an object with the same id as something
|
55
|
+
# in env[:machine].config.vm.networks: :port_collision_remap should be
|
56
|
+
# {<config hostport> => FP hostport}
|
57
|
+
# - [ ] observe what virtualbox does
|
@@ -0,0 +1 @@
|
|
1
|
+
1
|
@@ -0,0 +1 @@
|
|
1
|
+
99999
|
@@ -0,0 +1 @@
|
|
1
|
+
90210
|
@@ -0,0 +1 @@
|
|
1
|
+
vb1
|
@@ -0,0 +1 @@
|
|
1
|
+
2
|
@@ -0,0 +1 @@
|
|
1
|
+
1111111111
|
@@ -0,0 +1 @@
|
|
1
|
+
vb3
|
@@ -0,0 +1 @@
|
|
1
|
+
4
|
@@ -0,0 +1 @@
|
|
1
|
+
22222222222
|