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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/vagrant-skytap/action/add_vm_to_environment.rb +4 -4
- data/lib/vagrant-skytap/action/compose_environment.rb +131 -0
- data/lib/vagrant-skytap/action/create_environment.rb +3 -1
- data/lib/vagrant-skytap/action/initialize_api_client.rb +6 -5
- data/lib/vagrant-skytap/action/set_up_vm.rb +3 -1
- data/lib/vagrant-skytap/action/store_extra_data.rb +4 -2
- data/lib/vagrant-skytap/action.rb +4 -17
- data/lib/vagrant-skytap/api/environment.rb +53 -25
- data/lib/vagrant-skytap/api/vm.rb +9 -3
- data/lib/vagrant-skytap/command/up.rb +46 -30
- data/lib/vagrant-skytap/errors.rb +4 -0
- data/lib/vagrant-skytap/version.rb +1 -1
- data/locales/en.yml +5 -1
- data/spec/unit/actions/compose_environment_spec.rb +101 -0
- data/spec/unit/environment_spec.rb +26 -45
- data/spec/unit/support/shared/skytap_context.rb +5 -0
- data/vagrant-skytap.gemspec +3 -3
- metadata +9 -311
- data/.byebug_history +0 -256
- data/.project +0 -11
- data/_patches-20160112/0 +0 -388
- data/_patches-20160112/1 +0 -82
- data/_patches-20160112/2 +0 -239
- data/_patches-20160112/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160112/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160112/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160112/acceptance-test-runner +0 -29
- data/_patches-20160112/ansible-1 +0 -92
- data/_patches-20160112/cache-api-client-in-up +0 -40
- data/_patches-20160112/dead-code-in-actions +0 -44
- data/_patches-20160112/debug-changes +0 -42
- data/_patches-20160112/demo-rails-app +0 -1276
- data/_patches-20160112/eng-10166-halt-spec +0 -40
- data/_patches-20160112/eng-10256 +0 -527
- data/_patches-20160112/eng-10256-2 +0 -162
- data/_patches-20160112/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160112/eng-10269-test-stuff +0 -87
- data/_patches-20160112/eng-10269-wtf +0 -119
- data/_patches-20160112/eng-10369 +0 -143
- data/_patches-20160112/eng-10369-tmp +0 -60
- data/_patches-20160112/eng-10919 +0 -56
- data/_patches-20160112/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160112/eng-11442 +0 -4
- data/_patches-20160112/eng-11616 +0 -403
- data/_patches-20160112/eng-11616-2 +0 -67
- data/_patches-20160112/eng-11616-actual +0 -184
- data/_patches-20160112/eng-11625a +0 -4
- data/_patches-20160112/eng-11711 +0 -85
- data/_patches-20160112/eng-12232-command-spec +0 -236
- data/_patches-20160112/eng-12235 +0 -83
- data/_patches-20160112/eng-12235-override-refactor +0 -140
- data/_patches-20160112/eng-12240 +0 -103
- data/_patches-20160112/eng-12249 +0 -40
- data/_patches-20160112/eng-12301 +0 -50
- data/_patches-20160112/eng-12843 +0 -95
- data/_patches-20160112/env-source +0 -112
- data/_patches-20160112/frickin-vagrant-spec +0 -163
- data/_patches-20160112/gem-pre-version +0 -14
- data/_patches-20160112/gems-old +0 -9
- data/_patches-20160112/googles-specs +0 -713
- data/_patches-20160112/local-configs-ignore +0 -61
- data/_patches-20160112/misc +0 -79
- data/_patches-20160112/network-unreachable +0 -31
- data/_patches-20160112/new-boxfile +0 -288
- data/_patches-20160112/parallelization-maybe +0 -198
- data/_patches-20160112/read-state +0 -23
- data/_patches-20160112/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160112/series +0 -60
- data/_patches-20160112/status +0 -12
- data/_patches-20160112/test-move-env-data +0 -231
- data/_patches-20160112/test-vagrantfile-vm1 +0 -167
- data/_patches-20160112/the_version_in_0.1.13.pre1 +0 -598
- data/_patches-20160112/vagrant-spec-mock-api +0 -137
- data/_patches-20160112/vagrant-vmware-plugin +0 -233
- data/_patches-20160112/vagrantfile +0 -403
- data/_patches-20160112/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160112/vagrantfile-for-nick +0 -95
- data/_patches-20160112/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160112/vm-vanished +0 -42
- data/_patches-20160112a/01 +0 -148
- data/_patches-20160112a/2 +0 -239
- data/_patches-20160112a/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112a/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160112a/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112a/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160112a/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112a/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160112a/acceptance-test-runner +0 -29
- data/_patches-20160112a/ansible-1 +0 -92
- data/_patches-20160112a/cache-api-client-in-up +0 -40
- data/_patches-20160112a/dead-code-in-actions +0 -44
- data/_patches-20160112a/debug-changes +0 -42
- data/_patches-20160112a/demo-rails-app +0 -1276
- data/_patches-20160112a/eng-10166-halt-spec +0 -40
- data/_patches-20160112a/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160112a/eng-10269-test-stuff +0 -87
- data/_patches-20160112a/eng-10269-wtf +0 -119
- data/_patches-20160112a/eng-10369 +0 -143
- data/_patches-20160112a/eng-10369-tmp +0 -60
- data/_patches-20160112a/eng-10919 +0 -56
- data/_patches-20160112a/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160112a/eng-11442 +0 -4
- data/_patches-20160112a/eng-11616 +0 -403
- data/_patches-20160112a/eng-11616-2 +0 -67
- data/_patches-20160112a/eng-11616-actual +0 -184
- data/_patches-20160112a/eng-11625a +0 -4
- data/_patches-20160112a/eng-11711 +0 -85
- data/_patches-20160112a/eng-12232-command-spec +0 -236
- data/_patches-20160112a/eng-12235 +0 -83
- data/_patches-20160112a/eng-12235-override-refactor +0 -140
- data/_patches-20160112a/eng-12240 +0 -103
- data/_patches-20160112a/eng-12249 +0 -40
- data/_patches-20160112a/eng-12301 +0 -50
- data/_patches-20160112a/eng-12843 +0 -95
- data/_patches-20160112a/env-source +0 -112
- data/_patches-20160112a/frickin-vagrant-spec +0 -163
- data/_patches-20160112a/gem-pre-version +0 -14
- data/_patches-20160112a/gems-old +0 -9
- data/_patches-20160112a/googles-specs +0 -713
- data/_patches-20160112a/local-configs-ignore +0 -61
- data/_patches-20160112a/misc +0 -79
- data/_patches-20160112a/network-unreachable +0 -31
- data/_patches-20160112a/new-boxfile +0 -288
- data/_patches-20160112a/parallelization-maybe +0 -198
- data/_patches-20160112a/read-state +0 -23
- data/_patches-20160112a/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160112a/series +0 -58
- data/_patches-20160112a/status +0 -14
- data/_patches-20160112a/test-move-env-data +0 -231
- data/_patches-20160112a/test-vagrantfile-vm1 +0 -167
- data/_patches-20160112a/the_version_in_0.1.13.pre1 +0 -612
- data/_patches-20160112a/then-copy-the-newer-files +0 -632
- data/_patches-20160112a/vagrant-spec-mock-api +0 -137
- data/_patches-20160112a/vagrant-vmware-plugin +0 -233
- data/_patches-20160112a/vagrantfile +0 -403
- data/_patches-20160112a/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160112a/vagrantfile-for-nick +0 -95
- data/_patches-20160112a/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160112a/vm-vanished +0 -42
- data/_patches-20160113/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160113/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160113/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160113/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160113/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160113/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160113/acceptance-test-runner +0 -29
- data/_patches-20160113/ansible-1 +0 -92
- data/_patches-20160113/cache-api-client-in-up +0 -40
- data/_patches-20160113/dead-code-in-actions +0 -44
- data/_patches-20160113/debug-changes +0 -55
- data/_patches-20160113/demo-rails-app +0 -1276
- data/_patches-20160113/eng-10166-halt-spec +0 -40
- data/_patches-20160113/eng-10256 +0 -543
- data/_patches-20160113/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160113/eng-10269-test-stuff +0 -87
- data/_patches-20160113/eng-10269-wtf +0 -119
- data/_patches-20160113/eng-10369 +0 -143
- data/_patches-20160113/eng-10369-tmp +0 -60
- data/_patches-20160113/eng-10919 +0 -56
- data/_patches-20160113/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160113/eng-11442 +0 -4
- data/_patches-20160113/eng-11616 +0 -403
- data/_patches-20160113/eng-11616-2 +0 -67
- data/_patches-20160113/eng-11616-actual +0 -184
- data/_patches-20160113/eng-11625a +0 -4
- data/_patches-20160113/eng-11711 +0 -85
- data/_patches-20160113/eng-12232-command-spec +0 -236
- data/_patches-20160113/eng-12235 +0 -83
- data/_patches-20160113/eng-12235-override-refactor +0 -140
- data/_patches-20160113/eng-12240 +0 -103
- data/_patches-20160113/eng-12249 +0 -40
- data/_patches-20160113/eng-12301 +0 -50
- data/_patches-20160113/eng-12720 +0 -47
- data/_patches-20160113/eng-12843 +0 -95
- data/_patches-20160113/env-source +0 -112
- data/_patches-20160113/frickin-vagrant-spec +0 -163
- data/_patches-20160113/gem-pre-version +0 -14
- data/_patches-20160113/gems-old +0 -9
- data/_patches-20160113/googles-specs +0 -713
- data/_patches-20160113/local-configs-ignore +0 -61
- data/_patches-20160113/misc +0 -79
- data/_patches-20160113/network-unreachable +0 -31
- data/_patches-20160113/new-boxfile +0 -288
- data/_patches-20160113/parallelization-maybe +0 -198
- data/_patches-20160113/read-state +0 -23
- data/_patches-20160113/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160113/series +0 -56
- data/_patches-20160113/status +0 -14
- data/_patches-20160113/test-move-env-data +0 -231
- data/_patches-20160113/test-vagrantfile-vm1 +0 -167
- data/_patches-20160113/vagrant-spec-mock-api +0 -137
- data/_patches-20160113/vagrant-vmware-plugin +0 -233
- data/_patches-20160113/vagrantfile +0 -403
- data/_patches-20160113/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160113/vagrantfile-for-nick +0 -95
- data/_patches-20160113/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160113/vm-vanished +0 -42
- data/_patches-20160118/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160118/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160118/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160118/acceptance-test-runner +0 -29
- data/_patches-20160118/ansible-1 +0 -92
- data/_patches-20160118/cache-api-client-in-up +0 -40
- data/_patches-20160118/dead-code-in-actions +0 -44
- data/_patches-20160118/debug-changes +0 -55
- data/_patches-20160118/demo-rails-app +0 -1276
- data/_patches-20160118/eng-10166-halt-spec +0 -40
- data/_patches-20160118/eng-10256 +0 -554
- data/_patches-20160118/eng-10256-cr +0 -314
- data/_patches-20160118/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160118/eng-10269-test-stuff +0 -87
- data/_patches-20160118/eng-10269-wtf +0 -119
- data/_patches-20160118/eng-10369 +0 -143
- data/_patches-20160118/eng-10369-tmp +0 -60
- data/_patches-20160118/eng-10919 +0 -56
- data/_patches-20160118/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160118/eng-11442 +0 -4
- data/_patches-20160118/eng-11616 +0 -403
- data/_patches-20160118/eng-11616-2 +0 -67
- data/_patches-20160118/eng-11616-actual +0 -184
- data/_patches-20160118/eng-11625a +0 -4
- data/_patches-20160118/eng-11711 +0 -85
- data/_patches-20160118/eng-12232-command-spec +0 -236
- data/_patches-20160118/eng-12235 +0 -83
- data/_patches-20160118/eng-12235-override-refactor +0 -140
- data/_patches-20160118/eng-12240 +0 -103
- data/_patches-20160118/eng-12249 +0 -40
- data/_patches-20160118/eng-12301 +0 -50
- data/_patches-20160118/eng-12720 +0 -74
- data/_patches-20160118/eng-12843 +0 -95
- data/_patches-20160118/eng-13040 +0 -291
- data/_patches-20160118/env-source +0 -112
- data/_patches-20160118/frickin-vagrant-spec +0 -163
- data/_patches-20160118/gem-pre-version +0 -14
- data/_patches-20160118/gems-old +0 -9
- data/_patches-20160118/googles-specs +0 -713
- data/_patches-20160118/local-configs-ignore +0 -61
- data/_patches-20160118/misc +0 -79
- data/_patches-20160118/network-unreachable +0 -31
- data/_patches-20160118/new-boxfile +0 -288
- data/_patches-20160118/parallelization-maybe +0 -198
- data/_patches-20160118/port-forwarding-processes +0 -87
- data/_patches-20160118/read-state +0 -23
- data/_patches-20160118/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160118/series +0 -59
- data/_patches-20160118/status +0 -13
- data/_patches-20160118/test-move-env-data +0 -231
- data/_patches-20160118/test-vagrantfile-vm1 +0 -167
- data/_patches-20160118/vagrant-spec-mock-api +0 -137
- data/_patches-20160118/vagrant-vmware-plugin +0 -233
- data/_patches-20160118/vagrantfile +0 -403
- data/_patches-20160118/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160118/vagrantfile-for-nick +0 -95
- data/_patches-20160118/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160118/vm-vanished +0 -42
- data/_patches-20160118a/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118a/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160118a/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118a/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160118a/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118a/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160118a/acceptance-test-runner +0 -29
- data/_patches-20160118a/ansible-1 +0 -92
- data/_patches-20160118a/bar +0 -189
- data/_patches-20160118a/cache-api-client-in-up +0 -40
- data/_patches-20160118a/dead-code-in-actions +0 -44
- data/_patches-20160118a/debug-changes +0 -55
- data/_patches-20160118a/demo-rails-app +0 -1276
- data/_patches-20160118a/eng-10166-halt-spec +0 -40
- data/_patches-20160118a/eng-10256 +0 -554
- data/_patches-20160118a/eng-10256-cr +0 -314
- data/_patches-20160118a/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160118a/eng-10269-test-stuff +0 -87
- data/_patches-20160118a/eng-10269-wtf +0 -119
- data/_patches-20160118a/eng-10369 +0 -143
- data/_patches-20160118a/eng-10369-tmp +0 -60
- data/_patches-20160118a/eng-10919 +0 -56
- data/_patches-20160118a/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160118a/eng-11442 +0 -4
- data/_patches-20160118a/eng-11616 +0 -403
- data/_patches-20160118a/eng-11616-2 +0 -67
- data/_patches-20160118a/eng-11616-actual +0 -184
- data/_patches-20160118a/eng-11625a +0 -4
- data/_patches-20160118a/eng-11711 +0 -85
- data/_patches-20160118a/eng-12232-command-spec +0 -236
- data/_patches-20160118a/eng-12235 +0 -83
- data/_patches-20160118a/eng-12235-override-refactor +0 -140
- data/_patches-20160118a/eng-12240 +0 -103
- data/_patches-20160118a/eng-12249 +0 -40
- data/_patches-20160118a/eng-12301 +0 -50
- data/_patches-20160118a/eng-12720 +0 -74
- data/_patches-20160118a/eng-12843 +0 -95
- data/_patches-20160118a/eng-13040 +0 -291
- data/_patches-20160118a/env-source +0 -112
- data/_patches-20160118a/foo +0 -169
- data/_patches-20160118a/frickin-vagrant-spec +0 -163
- data/_patches-20160118a/gem-pre-version +0 -14
- data/_patches-20160118a/gems-old +0 -9
- data/_patches-20160118a/googles-specs +0 -713
- data/_patches-20160118a/guestport-madness +0 -59
- data/_patches-20160118a/local-configs-ignore +0 -61
- data/_patches-20160118a/misc +0 -79
- data/_patches-20160118a/network-unreachable +0 -31
- data/_patches-20160118a/new-boxfile +0 -288
- data/_patches-20160118a/parallelization-maybe +0 -198
- data/_patches-20160118a/port-forwarding-processes +0 -87
- data/_patches-20160118a/read-state +0 -23
- data/_patches-20160118a/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160118a/series +0 -62
- data/_patches-20160118a/status +0 -14
- data/_patches-20160118a/test-move-env-data +0 -231
- data/_patches-20160118a/test-vagrantfile-vm1 +0 -167
- data/_patches-20160118a/vagrant-spec-mock-api +0 -137
- data/_patches-20160118a/vagrant-vmware-plugin +0 -233
- data/_patches-20160118a/vagrantfile +0 -403
- data/_patches-20160118a/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160118a/vagrantfile-for-nick +0 -95
- data/_patches-20160118a/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160118a/vm-vanished +0 -42
@@ -1,314 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent 330807f4d3365968e3172a68423b8ad5d9ff74c5
|
3
|
-
ENG-10256 fixes based on CR
|
4
|
-
|
5
|
-
diff -r 330807f4d336 lib/vagrant-skytap/action/clear_forwarded_ports.rb
|
6
|
-
--- a/lib/vagrant-skytap/action/clear_forwarded_ports.rb Fri Jan 15 15:39:01 2016 -0800
|
7
|
-
+++ b/lib/vagrant-skytap/action/clear_forwarded_ports.rb Mon Jan 18 13:37:48 2016 -0800
|
8
|
-
@@ -8,7 +8,7 @@
|
9
|
-
|
10
|
-
def call(env)
|
11
|
-
env[:ui].info I18n.t("vagrant.actions.vm.clear_forward_ports.deleting")
|
12
|
-
- env[:host].capability(:kill_forwarded_ports, env)
|
13
|
-
+ env[:host].capability(:kill_forwarded_ports, env[:machine])
|
14
|
-
|
15
|
-
@app.call(env)
|
16
|
-
end
|
17
|
-
diff -r 330807f4d336 lib/vagrant-skytap/action/forward_ports.rb
|
18
|
-
--- a/lib/vagrant-skytap/action/forward_ports.rb Fri Jan 15 15:39:01 2016 -0800
|
19
|
-
+++ b/lib/vagrant-skytap/action/forward_ports.rb Mon Jan 18 13:37:48 2016 -0800
|
20
|
-
@@ -21,7 +21,7 @@
|
21
|
-
|
22
|
-
# Warn if we're port forwarding to any privileged ports...
|
23
|
-
env[:forwarded_ports].each do |fp|
|
24
|
-
- if fp.host_port <= 1024
|
25
|
-
+ if fp.privileged_host_port?
|
26
|
-
env[:ui].warn I18n.t("vagrant.actions.vm.forward_ports.privileged_ports")
|
27
|
-
break
|
28
|
-
end
|
29
|
-
@@ -35,12 +35,12 @@
|
30
|
-
|
31
|
-
def forward_ports
|
32
|
-
@env[:forwarded_ports].each do |fp|
|
33
|
-
- unless fp.guest_port == 22 && fp.host_port == 2222
|
34
|
-
+ unless fp.internal_ssh_port?
|
35
|
-
@env[:ui].detail(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry",
|
36
|
-
adapter: fp.adapter,
|
37
|
-
guest_port: fp.guest_port,
|
38
|
-
host_port: fp.host_port))
|
39
|
-
- @env[:host].capability(:start_ssh_tunnel, fp, @env)
|
40
|
-
+ @env[:host].capability(:start_ssh_tunnel, fp, @env[:machine], @env)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
diff -r 330807f4d336 lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb
|
45
|
-
--- a/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb Fri Jan 15 15:39:01 2016 -0800
|
46
|
-
+++ b/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb Mon Jan 18 13:37:48 2016 -0800
|
47
|
-
@@ -1,9 +1,10 @@
|
48
|
-
+# unused libs?
|
49
|
-
require "pathname"
|
50
|
-
require "tmpdir"
|
51
|
-
-require 'childprocess'
|
52
|
-
require "vagrant/util/subprocess"
|
53
|
-
+require "vagrant/util/safe_chdir"
|
54
|
-
+require "vagrant-skytap/models/forwarded_port"
|
55
|
-
require 'log4r'
|
56
|
-
-require "vagrant/util/safe_chdir"
|
57
|
-
|
58
|
-
module VagrantPlugins
|
59
|
-
module Skytap
|
60
|
-
@@ -15,76 +16,96 @@
|
61
|
-
raise NotImplementedError
|
62
|
-
end
|
63
|
-
|
64
|
-
- def start_ssh_tunnel(env, fp, env_hash)
|
65
|
-
+ # Create an ssh tunnel for the current machine
|
66
|
-
+ # using the given [ForwardedPort] object.
|
67
|
-
+ #
|
68
|
-
+ # @return [Vagrant::Util::Subprocess::Result]
|
69
|
-
+ def start_ssh_tunnel(env, fp, machine, env_hash)
|
70
|
-
logger = create_logger
|
71
|
-
- machine = env_hash[:machine]
|
72
|
-
- pidfile = pidfile_name(fp)
|
73
|
-
+
|
74
|
-
+ # just in case there's something left over
|
75
|
-
+ env.host.capability(:kill_ssh_tunnel, fp, machine)
|
76
|
-
+
|
77
|
-
+ args = ssh_args(fp, machine, env_hash[:machine_ssh_info])
|
78
|
-
+ vars = autossh_environment_variables(fp, machine)
|
79
|
-
+ args << {env: vars}
|
80
|
-
+ # ensure that we delete or overwrite any existing pidfile
|
81
|
-
+ Vagrant::Util::Subprocess.execute("autossh", "-f", *args)
|
82
|
-
+ end
|
83
|
-
+
|
84
|
-
+ # Kill the autossh process for the given [ForwardedPort]
|
85
|
-
+ # (after confirming that it's not stale)
|
86
|
-
+ #
|
87
|
-
+ # @return [Vagrant::Util::Subprocess::Result]
|
88
|
-
+ def kill_ssh_tunnel(env, fp, machine)
|
89
|
-
+ logger = create_logger
|
90
|
-
+ pidfile = fp.pidfile_name
|
91
|
-
pid = read_pid(machine.data_dir.join(pidfile))
|
92
|
-
-
|
93
|
-
- if pid && autossh_pid?(pid)
|
94
|
-
- logger.info("An autossh process already exists with pid #{pid}.")
|
95
|
-
+ if pid && autossh_pid?(env, pid)
|
96
|
-
+ Vagrant::Util::Subprocess.execute("kill", pid.to_s)
|
97
|
-
else
|
98
|
-
- args = ssh_args(fp, env_hash)
|
99
|
-
- vars = autossh_environment_variables(pidfile, env_hash)
|
100
|
-
- args << {env: vars}
|
101
|
-
- Vagrant::Util::Subprocess.execute("autossh", "-f", *args)
|
102
|
-
+ logger.info("Cleaning up stale autossh pidfile #{pidfile}.")
|
103
|
-
+ result = Vagrant::Util::Subprocess.execute("rm", machine.data_dir.join(pidfile).to_s)
|
104
|
-
+ puts result.inspect
|
105
|
-
+ false
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
- def kill_forwarded_ports(env, env_hash)
|
110
|
-
- get_pidfiles_for_machine(env_hash[:machine]).each do |pidfile|
|
111
|
-
- kill_ssh_tunnel(env, pidfile, env_hash)
|
112
|
-
+ # Convenience method which kills all autossh
|
113
|
-
+ # processes for the given machine
|
114
|
-
+ #
|
115
|
-
+ # @return [Array] A list of the pidfiles which were
|
116
|
-
+ # killed.
|
117
|
-
+ def kill_forwarded_ports(env, machine)
|
118
|
-
+ get_fp_for_machine(machine).each do |fp|
|
119
|
-
+ env.host.capability(:kill_ssh_tunnel, fp, machine)
|
120
|
-
end
|
121
|
-
+ # delete *.pid?
|
122
|
-
end
|
123
|
-
|
124
|
-
- def kill_ssh_tunnel(env, pidfile, env_hash)
|
125
|
-
- logger = create_logger
|
126
|
-
- machine = env_hash[:machine]
|
127
|
-
- pid = read_pid(machine.data_dir.join(pidfile))
|
128
|
-
- if pid && autossh_pid?(pid)
|
129
|
-
- Vagrant::Util::Subprocess.execute("kill", pid.to_s)
|
130
|
-
- else
|
131
|
-
- logger.info("Cleaning up stale autossh pidfile #{pidfile}.")
|
132
|
-
- Vagrant::Util::Subprocess.execute("rm", pidfile)
|
133
|
-
- end
|
134
|
-
- end
|
135
|
-
-
|
136
|
-
-
|
137
|
-
- def pidfile_name(fp)
|
138
|
-
- "#{fp.protocol}#{fp.host_port}.pid"
|
139
|
-
- end
|
140
|
-
-
|
141
|
-
+ # Reads the pid from the given pidfile_path (full
|
142
|
-
+ # path, not relative to the machine data_dir)
|
143
|
-
+ #
|
144
|
-
+ # @return [Integer], or nil if not found.
|
145
|
-
def read_pid(pidfile_path)
|
146
|
-
File.read(pidfile_path).presence.try(:to_i) if File.exist?(pidfile_path)
|
147
|
-
end
|
148
|
-
|
149
|
-
- def get_pidfiles_for_machine(machine)
|
150
|
-
+ # Reads all the pidfiles from the machine's data_dir.
|
151
|
-
+ # TODO make this return [ForwardedPort] objects
|
152
|
-
+ #
|
153
|
-
+ # @return [Array] of [ForwardedPort] objects
|
154
|
-
+ def get_fp_for_machine(machine)
|
155
|
-
pidfiles = []
|
156
|
-
Vagrant::Util::SafeChdir.safe_chdir(machine.data_dir) do
|
157
|
-
pidfiles = Dir.glob("*.pid")
|
158
|
-
end
|
159
|
-
- pidfiles
|
160
|
-
+ pidfiles.collect do |pidfile|
|
161
|
-
+ pidfile =~ /(\w+)(\d+)\.pid/
|
162
|
-
+ protocol, hostport, guestport = $1, $2, nil
|
163
|
-
+ ForwardedPort.new("#{protocol}#{hostport}", hostport, guestport, protocol: protocol)
|
164
|
-
+ end
|
165
|
-
end
|
166
|
-
|
167
|
-
- # Checks that the pid is actually an autossh process (and not
|
168
|
-
- # something else using a recycled pid).
|
169
|
-
- def autossh_pid?(pid)
|
170
|
-
- # get_comm_for_pid(pid) == 'autossh'
|
171
|
-
- true
|
172
|
-
+ # Determines whether the given pid corresponds to a running
|
173
|
-
+ # autossh process.
|
174
|
-
+ #
|
175
|
-
+ # @return [Boolean]
|
176
|
-
+ def autossh_pid?(env, pid)
|
177
|
-
+ begin
|
178
|
-
+ env.host.capability(:get_comm_for_pid, pid) == 'autossh'
|
179
|
-
+ rescue NotImplementedError, Vagrant::Errors::CapabilityNotFound => ex
|
180
|
-
+ create_logger.info("Could not confirm that the given pid corresponds to a running autossh process.")
|
181
|
-
+ false
|
182
|
-
+ end
|
183
|
-
end
|
184
|
-
|
185
|
-
- # Get the command, minus any arguments, for the given
|
186
|
-
- # pid. This probably needs to be overridden per host cap
|
187
|
-
- def get_comm_for_pid(pid)
|
188
|
-
- result = Vagrant::Util::Subprocess.execute("ps", "-p", pid.to_s, "-o", "comm")
|
189
|
-
- result.stdout.split("\n").last
|
190
|
-
- end
|
191
|
-
-
|
192
|
-
- # these args seem to work on MacOS and Ubuntu ...
|
193
|
-
- # untested on other implementations
|
194
|
-
- def ssh_args(fp, env_hash)
|
195
|
-
- machine = env_hash[:machine]
|
196
|
-
- ssh_info = env_hash[:machine_ssh_info]
|
197
|
-
+ # Gets the args to be passed to ssh for the given
|
198
|
-
+ # [ForwardedPort] on the given machine.
|
199
|
-
+ #
|
200
|
-
+ # @return [Array]
|
201
|
-
+ def ssh_args(fp, machine, ssh_info)
|
202
|
-
+ # TODO read ssh_info without having to pass it in
|
203
|
-
ssh_options = {
|
204
|
-
"ServerAliveInterval" => 10,
|
205
|
-
"ServerAliveCountMax" => 3,
|
206
|
-
@@ -103,10 +124,13 @@
|
207
|
-
args << "#{ssh_info[:username]}@#{ssh_info[:host]}"
|
208
|
-
end
|
209
|
-
|
210
|
-
- def autossh_environment_variables(pidfile, env_hash, monitoring_port = 0)
|
211
|
-
- machine = env_hash[:machine]
|
212
|
-
+ # Gets the environment variables to be set when calling
|
213
|
-
+ # autossh.
|
214
|
-
+ #
|
215
|
-
+ # @return [Hash]
|
216
|
-
+ def autossh_environment_variables(fp, machine, monitoring_port = 0)
|
217
|
-
{
|
218
|
-
- "AUTOSSH_PIDFILE" => machine.data_dir.join(pidfile).to_s,
|
219
|
-
+ "AUTOSSH_PIDFILE" => machine.data_dir.join(fp.pidfile_name).to_s,
|
220
|
-
"AUTOSSH_PORT" => monitoring_port,
|
221
|
-
}
|
222
|
-
end
|
223
|
-
diff -r 330807f4d336 lib/vagrant-skytap/hosts/darwin/cap/ssh_tunnel.rb
|
224
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
225
|
-
+++ b/lib/vagrant-skytap/hosts/darwin/cap/ssh_tunnel.rb Mon Jan 18 13:37:48 2016 -0800
|
226
|
-
@@ -0,0 +1,44 @@
|
227
|
-
+require "vagrant-skytap/hosts/common/cap/ssh_tunnel"
|
228
|
-
+
|
229
|
-
+module VagrantPlugins
|
230
|
-
+ module Skytap
|
231
|
-
+ module HostDarwin
|
232
|
-
+ module Cap
|
233
|
-
+ class SSHTunnel < VagrantPlugins::Skytap::HostCommon::Cap::SSHTunnel
|
234
|
-
+ class << self
|
235
|
-
+ def create_logger
|
236
|
-
+ Log4r::Logger.new("vagrant::hosts::darwin")
|
237
|
-
+ end
|
238
|
-
+
|
239
|
-
+# def start_ssh_tunnel(*args)
|
240
|
-
+# debugger
|
241
|
-
+# raise NotImplementedError
|
242
|
-
+# end
|
243
|
-
+#
|
244
|
-
+# def kill_ssh_tunnel(*args)
|
245
|
-
+# debugger
|
246
|
-
+# raise NotImplementedError
|
247
|
-
+# end
|
248
|
-
+#
|
249
|
-
+# def kill_forwarded_ports(*args)
|
250
|
-
+# debugger
|
251
|
-
+# raise NotImplementedError
|
252
|
-
+# end
|
253
|
-
+
|
254
|
-
+ # Gets the name of the executable for the given pid.
|
255
|
-
+ #
|
256
|
-
+ # @return [String]
|
257
|
-
+ def get_comm_for_pid(pid)
|
258
|
-
+ logger = create_logger
|
259
|
-
+ debugger
|
260
|
-
+ result = Vagrant::Util::Subprocess.execute("ps", "-p", pid.to_s, "-o", "comm")
|
261
|
-
+ logger.info result.inspect
|
262
|
-
+ logger.info result.stdout
|
263
|
-
+ result.stdout.split("\n").last
|
264
|
-
+ end
|
265
|
-
+ end
|
266
|
-
+ end
|
267
|
-
+ end
|
268
|
-
+ end
|
269
|
-
+ end
|
270
|
-
+end
|
271
|
-
diff -r 330807f4d336 lib/vagrant-skytap/hosts/ubuntu/cap/ssh_tunnel.rb
|
272
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
273
|
-
+++ b/lib/vagrant-skytap/hosts/ubuntu/cap/ssh_tunnel.rb Mon Jan 18 13:37:48 2016 -0800
|
274
|
-
@@ -0,0 +1,15 @@
|
275
|
-
+require "vagrant-skytap/hosts/common/cap/ssh_tunnel"
|
276
|
-
+
|
277
|
-
+module VagrantPlugins
|
278
|
-
+ module Skytap
|
279
|
-
+ module HostUbuntu
|
280
|
-
+ module Cap
|
281
|
-
+ class SSHTunnel < VagrantPlugins::Skytap::HostCommon::Cap::SSHTunnel
|
282
|
-
+ def self.create_logger
|
283
|
-
+ Log4r::Logger.new("vagrant::hosts::ubuntu")
|
284
|
-
+ end
|
285
|
-
+ end
|
286
|
-
+ end
|
287
|
-
+ end
|
288
|
-
+ end
|
289
|
-
+end
|
290
|
-
diff -r 330807f4d336 lib/vagrant-skytap/model/forwarded_port.rb
|
291
|
-
--- a/lib/vagrant-skytap/model/forwarded_port.rb Fri Jan 15 15:39:01 2016 -0800
|
292
|
-
+++ b/lib/vagrant-skytap/model/forwarded_port.rb Mon Jan 18 13:37:48 2016 -0800
|
293
|
-
@@ -64,6 +64,21 @@
|
294
|
-
def correct_host_port(new_port)
|
295
|
-
@host_port = new_port
|
296
|
-
end
|
297
|
-
+
|
298
|
-
+ # Returns a filename suitable for use as a pidfile.
|
299
|
-
+ #
|
300
|
-
+ # @return [String]
|
301
|
-
+ def pidfile_name
|
302
|
-
+ "#{protocol}#{host_port}.pid"
|
303
|
-
+ end
|
304
|
-
+
|
305
|
-
+ def privileged_host_port?
|
306
|
-
+ host_port <= 1024
|
307
|
-
+ end
|
308
|
-
+
|
309
|
-
+ def internal_ssh_port?
|
310
|
-
+ guest_port == 22 && host_port == 2222
|
311
|
-
+ end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|
@@ -1,88 +0,0 @@
|
|
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
|
-
+
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent 6547dde950c57c1f4694245d8a41ab5a5a8b7d28
|
3
|
-
improvements to tests for ENG-10269. sighhhhhhh. This will not be ready when the main patch is ready, just live with it.
|
4
|
-
|
5
|
-
diff -r 6547dde950c5 lib/vagrant-skytap/action/read_state.rb
|
6
|
-
--- a/lib/vagrant-skytap/action/read_state.rb Wed Nov 25 18:56:41 2015 -0800
|
7
|
-
+++ b/lib/vagrant-skytap/action/read_state.rb Mon Nov 30 11:51:41 2015 -0800
|
8
|
-
@@ -17,6 +17,7 @@
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(env)
|
12
|
-
+ debugger
|
13
|
-
env[:machine_state_id] = read_state(env[:machine])
|
14
|
-
|
15
|
-
@app.call(env)
|
16
|
-
diff -r 6547dde950c5 spec/acceptance/provider/up_spec.rb
|
17
|
-
--- a/spec/acceptance/provider/up_spec.rb Wed Nov 25 18:56:41 2015 -0800
|
18
|
-
+++ b/spec/acceptance/provider/up_spec.rb Mon Nov 30 11:51:41 2015 -0800
|
19
|
-
@@ -19,6 +19,15 @@
|
20
|
-
it 'should bring up the machine and halt it' do
|
21
|
-
status("Test: machine can be brought up, parallel by default")
|
22
|
-
up_result = execute("vagrant", "up")
|
23
|
-
+
|
24
|
-
+ # up_result.stderr =~ /REST API call: PUT .*multiselect.*\[(.*)\]/
|
25
|
-
+ # (byebug) $1
|
26
|
-
+ # "\"7677382\""
|
27
|
-
+ # assert exactly one match with two separate ids
|
28
|
-
+ # could we make rest calls from this test? or get by without?
|
29
|
-
+ #multiselect should occur once
|
30
|
-
+ # vagrant status output?
|
31
|
-
+
|
32
|
-
expect(up_result).to exit_with(0)
|
33
|
-
|
34
|
-
status("Test: machine is running after up")
|
35
|
-
@@ -30,6 +39,10 @@
|
36
|
-
it 'should bring up the machine and halt it' do
|
37
|
-
status("Test: machine can be brought up no parallel")
|
38
|
-
up_result = execute("vagrant", "up", "--no-parallel")
|
39
|
-
+
|
40
|
-
+# up_result.stderr =~ /REST API call: PUT .*multiselect.*\[(.*)\]/
|
41
|
-
+ # assert no match
|
42
|
-
+
|
43
|
-
expect(up_result).to exit_with(0)
|
44
|
-
|
45
|
-
status("Test: machine is running after up")
|
46
|
-
@@ -37,4 +50,10 @@
|
47
|
-
expect(echo_result).to exit_with(0)
|
48
|
-
expect(echo_result.stdout).to match(/foo\n$/)
|
49
|
-
end
|
50
|
-
+
|
51
|
-
+ # what else to test?
|
52
|
-
+ # 2 new vms. Provisioners should run on both.
|
53
|
-
+ # Only one runstate API call should be made by default.
|
54
|
-
+ # 2 vms, one new, one already running.
|
55
|
-
+ # Parallelness should be discernible in the output.
|
56
|
-
end
|
57
|
-
diff -r 6547dde950c5 spec/acceptance/skeletons/generic/Vagrantfile
|
58
|
-
--- a/spec/acceptance/skeletons/generic/Vagrantfile Wed Nov 25 18:56:41 2015 -0800
|
59
|
-
+++ b/spec/acceptance/skeletons/generic/Vagrantfile Mon Nov 30 11:51:41 2015 -0800
|
60
|
-
@@ -2,14 +2,20 @@
|
61
|
-
config.vm.box = "skytap/empty"
|
62
|
-
|
63
|
-
config.vm.provider :skytap do |skytap, override|
|
64
|
-
- skytap.username = "user"
|
65
|
-
- skytap.api_token = "9999999999999999999999"
|
66
|
-
- skytap.base_url = "https://example.com/"
|
67
|
-
+ skytap.vm_url = "/vms/7285844"
|
68
|
-
+ skytap.vpn_url = "/vpns/vpn-711360"
|
69
|
-
+# skytap.vpn_url = "/vpns/vpn-3195669"
|
70
|
-
end
|
71
|
-
|
72
|
-
- config.vm.define "vm1" do |ubuntu|
|
73
|
-
- ubuntu.vm.provider :skytap do |box|
|
74
|
-
- box.vm_url = "https://example.com/vms/1"
|
75
|
-
- end
|
76
|
-
+ config.vm.define "vm1" do |vm1|
|
77
|
-
+ vm1.ssh.username = "skytap"
|
78
|
-
+ vm1.ssh.password = "ChangeMe!"
|
79
|
-
+ vm1.vm.provision "shell", inline: "echo '****** HALLO EVERYONE this is vm1 ******'"
|
80
|
-
+ end
|
81
|
-
+
|
82
|
-
+ config.vm.define "vm2" do |vm2|
|
83
|
-
+ vm2.ssh.username = "skytap"
|
84
|
-
+ vm2.ssh.password = "ChangeMe!"
|
85
|
-
+ vm2.vm.provision "shell", inline: "echo '****** HALLO EVERYONE this is vm2 ******'"
|
86
|
-
end
|
87
|
-
end
|
@@ -1,119 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent b774dc85ccd962a862c877e9a4c3fe3684c344e5
|
3
|
-
ENG-10269 parallel halt operation
|
4
|
-
|
5
|
-
diff -r b774dc85ccd9 lib/vagrant-skytap/action/fetch_environment.rb
|
6
|
-
--- a/lib/vagrant-skytap/action/fetch_environment.rb Mon Nov 16 15:45:01 2015 -0800
|
7
|
-
+++ b/lib/vagrant-skytap/action/fetch_environment.rb Mon Nov 16 15:45:23 2015 -0800
|
8
|
-
@@ -21,6 +21,7 @@
|
9
|
-
rescue Errors::DoesNotExist => ex
|
10
|
-
@logger.info("Ignoring missing environment '#{props['url']}'.")
|
11
|
-
end
|
12
|
-
+ # env[:environment_fetched] = true # this might be useful, come back to it
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
diff -r b774dc85ccd9 lib/vagrant-skytap/action/stop_vm.rb
|
17
|
-
--- a/lib/vagrant-skytap/action/stop_vm.rb Mon Nov 16 15:45:01 2015 -0800
|
18
|
-
+++ b/lib/vagrant-skytap/action/stop_vm.rb Mon Nov 16 15:45:23 2015 -0800
|
19
|
-
@@ -24,17 +24,36 @@
|
20
|
-
end
|
21
|
-
|
22
|
-
def call(env)
|
23
|
-
- vm = env[:environment].current_vm
|
24
|
-
- if env[:force_halt]
|
25
|
-
- vm.poweroff!
|
26
|
-
+ # Is this stale, I wonder?
|
27
|
-
+ case state = env[:machine_state_id]
|
28
|
-
+ when :not_created
|
29
|
-
+ env[:ui].info(I18n.t("vagrant_skytap.not_created"))
|
30
|
-
+ when :stopped
|
31
|
-
+ env[:ui].info(I18n.t("vagrant_skytap.already_status", :status => "stopped"))
|
32
|
-
+ when :suspended
|
33
|
-
+ if env[:force_halt]
|
34
|
-
+ stop = true
|
35
|
-
+ else
|
36
|
-
+ env[:ui].info(I18n.t("vagrant_skytap.cannot_halt_if_suspended"))
|
37
|
-
+ end
|
38
|
-
else
|
39
|
-
- begin
|
40
|
-
- vm.stop!
|
41
|
-
- rescue Errors::InstanceReadyTimeout
|
42
|
-
- @logger.info(I18n.t("vagrant_skytap.graceful_halt_vm_failed"))
|
43
|
-
+ stop = true
|
44
|
-
+ end
|
45
|
-
+
|
46
|
-
+ if stop
|
47
|
-
+ vm = env[:environment].current_vm
|
48
|
-
+ if env[:force_halt]
|
49
|
-
vm.poweroff!
|
50
|
-
+ else
|
51
|
-
+ begin
|
52
|
-
+ vm.stop!
|
53
|
-
+ rescue Errors::InstanceReadyTimeout
|
54
|
-
+ @logger.info(I18n.t("vagrant_skytap.graceful_halt_vm_failed"))
|
55
|
-
+ vm.poweroff!
|
56
|
-
+ end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
+
|
60
|
-
@app.call(env)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
diff -r b774dc85ccd9 lib/vagrant-skytap/command/halt.rb
|
64
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
65
|
-
+++ b/lib/vagrant-skytap/command/halt.rb Mon Nov 16 15:45:23 2015 -0800
|
66
|
-
@@ -0,0 +1,41 @@
|
67
|
-
+require 'optparse'
|
68
|
-
+
|
69
|
-
+module VagrantPlugins
|
70
|
-
+ module Skytap
|
71
|
-
+ module Command
|
72
|
-
+ class Halt < Vagrant.plugin("2", :command)
|
73
|
-
+ def self.synopsis
|
74
|
-
+ "stops the vagrant machine (hi mom)"
|
75
|
-
+ end
|
76
|
-
+
|
77
|
-
+ def execute
|
78
|
-
+ options = {}
|
79
|
-
+ options[:force] = false
|
80
|
-
+
|
81
|
-
+ opts = OptionParser.new do |o|
|
82
|
-
+ o.banner = "Usage: vagrant halt [options] [name]"
|
83
|
-
+ o.separator ""
|
84
|
-
+ o.separator "Options:"
|
85
|
-
+ o.separator ""
|
86
|
-
+
|
87
|
-
+ o.on("-f", "--force", "Force shut down (equivalent of pulling power)") do |f|
|
88
|
-
+ options[:force] = f
|
89
|
-
+ end
|
90
|
-
+ end
|
91
|
-
+
|
92
|
-
+ # Parse the options
|
93
|
-
+ argv = parse_options(opts)
|
94
|
-
+ return if !argv
|
95
|
-
+
|
96
|
-
+ @logger.debug("Halt command: #{argv.inspect} #{options.inspect}")
|
97
|
-
+ with_target_vms(argv, reverse: true) do |vm|
|
98
|
-
+ vm.action(:halt, force_halt: options[:force])
|
99
|
-
+ end
|
100
|
-
+
|
101
|
-
+ # Success, exit status 0
|
102
|
-
+ 0
|
103
|
-
+ end
|
104
|
-
+ end
|
105
|
-
+ end
|
106
|
-
+ end
|
107
|
-
+end
|
108
|
-
diff -r b774dc85ccd9 locales/en.yml
|
109
|
-
--- a/locales/en.yml Mon Nov 16 15:45:01 2015 -0800
|
110
|
-
+++ b/locales/en.yml Mon Nov 16 15:45:23 2015 -0800
|
111
|
-
@@ -42,6 +42,8 @@
|
112
|
-
The environment could not be halted gracefully. Forcing halt.
|
113
|
-
graceful_halt_vm_failed: |-
|
114
|
-
The VM could not be halted gracefully. Forcing halt.
|
115
|
-
+ cannot_halt_if_suspended: |-
|
116
|
-
+ A suspended VM cannot be halted without the --force flag.
|
117
|
-
|
118
|
-
config:
|
119
|
-
username_required:
|