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,140 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent 1325e55248225f2602b39dc54aa9a3b820e65174
|
3
|
-
# Parent 1325e55248225f2602b39dc54aa9a3b820e65174
|
4
|
-
ENG-12235 Refactoring: OverriddenCommand class.
|
5
|
-
* * *
|
6
|
-
imported patch eng-12235-noodling
|
7
|
-
|
8
|
-
diff -r 1325e5524822 lib/vagrant-skytap/command/overridden_command.rb
|
9
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
10
|
-
+++ b/lib/vagrant-skytap/command/overridden_command.rb Wed Dec 16 12:26:58 2015 -0800
|
11
|
-
@@ -0,0 +1,91 @@
|
12
|
-
+# Parent class for commands that need to dispatch to existing
|
13
|
-
+# implementations. Registering a command with the same name
|
14
|
-
+# as an existing command overwrites it, which can inadvertently
|
15
|
-
+# break things for other providers.
|
16
|
-
+
|
17
|
-
+require 'vagrant'
|
18
|
-
+
|
19
|
-
+module VagrantPlugins
|
20
|
-
+ module Skytap
|
21
|
-
+ module Command
|
22
|
-
+ class OverriddenCommand < Vagrant.plugin("2", :command)
|
23
|
-
+
|
24
|
-
+ class MixedProvidersError ; end
|
25
|
-
+
|
26
|
-
+ def command_name
|
27
|
-
+ self.class.to_s.split("::").last.downcase
|
28
|
-
+ end
|
29
|
-
+
|
30
|
-
+ # Look for command inside specified plugin, rather than the
|
31
|
-
+ # command registry
|
32
|
-
+ def command_class(plugin, name)
|
33
|
-
+ if command = plugin.components.commands[name.to_sym].try(:first)
|
34
|
-
+ command.call
|
35
|
-
+ else
|
36
|
-
+ raise "Command '#{name}' not found in plugin"
|
37
|
-
+ end
|
38
|
-
+ end
|
39
|
-
+
|
40
|
-
+ def default_command_plugin
|
41
|
-
+ raise NotImplementedError
|
42
|
-
+ end
|
43
|
-
+
|
44
|
-
+ def provider_to_use
|
45
|
-
+ options = {}
|
46
|
-
+ opts = OptionParser.new do |o|
|
47
|
-
+ build_start_options(o, options)
|
48
|
-
+ o.on("--provider PROVIDER", String) do |provider|
|
49
|
-
+ options[:provider] = provider
|
50
|
-
+ end
|
51
|
-
+ end
|
52
|
-
+
|
53
|
-
+ if parse_options(opts) && options[:provider]
|
54
|
-
+ # Provider on command line
|
55
|
-
+ options[:provider].to_sym
|
56
|
-
+ elsif @env.active_machines.empty?
|
57
|
-
+ # No machines yet, and no provider specified
|
58
|
-
+ @env.default_provider
|
59
|
-
+ else
|
60
|
-
+ # Inspect machines which have already been created.
|
61
|
-
+ providers = @env.active_machines.collect(&:last).uniq
|
62
|
-
+ if providers.count > 1
|
63
|
-
+ # If the Vagrant project is heterogeneous (not all machines have
|
64
|
-
+ # the same provider), give up.
|
65
|
-
+ @logger.debug("This environment has active machines for multiple providers! Active machines: #{@env.active_machines}")
|
66
|
-
+ raise MixedProvidersError
|
67
|
-
+ else
|
68
|
-
+ providers.first
|
69
|
-
+ end
|
70
|
-
+ end
|
71
|
-
+ end
|
72
|
-
+
|
73
|
-
+ def execute
|
74
|
-
+ begin
|
75
|
-
+ provider = provider_to_use
|
76
|
-
+ rescue MixedProvidersError
|
77
|
-
+ # Fall back to the default implementation, which might still be
|
78
|
-
+ # able to perform the requested operation, and if not, it will use
|
79
|
-
+ # the default error handling.
|
80
|
-
+ end
|
81
|
-
+
|
82
|
-
+ if provider == :skytap
|
83
|
-
+ @logger.info("Calling Skytap overridden implementation of '#{command_name}' command.")
|
84
|
-
+ skytap_implementation
|
85
|
-
+ else
|
86
|
-
+ @logger.info("Calling default implementation of '#{command_name}' command.")
|
87
|
-
+ default_implementation
|
88
|
-
+ end
|
89
|
-
+ end
|
90
|
-
+
|
91
|
-
+ def default_implementation
|
92
|
-
+ command_class(default_command_plugin, command_name).new(@argv, @env).execute
|
93
|
-
+ end
|
94
|
-
+
|
95
|
-
+ def skytap_implementation
|
96
|
-
+ raise NotImplementedError
|
97
|
-
+ end
|
98
|
-
+ end
|
99
|
-
+ end
|
100
|
-
+ end
|
101
|
-
+end
|
102
|
-
+
|
103
|
-
diff -r 1325e5524822 lib/vagrant-skytap/command/up.rb
|
104
|
-
--- a/lib/vagrant-skytap/command/up.rb Wed Dec 16 12:25:57 2015 -0800
|
105
|
-
+++ b/lib/vagrant-skytap/command/up.rb Wed Dec 16 12:26:58 2015 -0800
|
106
|
-
@@ -1,25 +1,19 @@
|
107
|
-
-# We've subclassed the builtin "up" command to alter how
|
108
|
-
-# parallelization is implemented. Instead of making concurrent requests to run
|
109
|
-
-# individual VMs, we make a single REST call to update the runstates of
|
110
|
-
-# multiple VMs within the containing Skytap environment.
|
111
|
-
+# Modified "up" implementation which runs VMs in parallel using the Skytap REST API.
|
112
|
-
|
113
|
-
-require Vagrant.source_root.join("plugins/commands/up/command")
|
114
|
-
+require_relative 'overridden_command'
|
115
|
-
+require Vagrant.source_root.join("plugins/commands/up/start_mixins")
|
116
|
-
|
117
|
-
module VagrantPlugins
|
118
|
-
module Skytap
|
119
|
-
module Command
|
120
|
-
- class Up < VagrantPlugins::CommandUp::Command
|
121
|
-
+ class Up < OverriddenCommand
|
122
|
-
+ include VagrantPlugins::CommandUp::StartMixins
|
123
|
-
|
124
|
-
- def execute
|
125
|
-
- # This implementation of the "up" command overrides
|
126
|
-
- # the default implementation due to load order.
|
127
|
-
- if @env.default_provider == :skytap
|
128
|
-
- @logger.debug("Executing Skytap 'Up' implementation.")
|
129
|
-
- else
|
130
|
-
- @logger.debug("Calling default 'Up' implementation.")
|
131
|
-
- return super
|
132
|
-
- end
|
133
|
-
+ def default_command_plugin
|
134
|
-
+ VagrantPlugins::CommandUp::Plugin
|
135
|
-
+ end
|
136
|
-
|
137
|
-
+ def skytap_implementation
|
138
|
-
options = {}
|
139
|
-
options[:destroy_on_error] = true
|
140
|
-
options[:parallel] = true
|
data/_patches-20160112/eng-12240
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent 8722732470b5a0c961d7e764f64cd20410c240db
|
3
|
-
ENG-12240 no tty present
|
4
|
-
|
5
|
-
diff -r 8722732470b5 Vagrantfile
|
6
|
-
--- a/Vagrantfile Thu Dec 03 15:09:16 2015 -0800
|
7
|
-
+++ b/Vagrantfile Thu Dec 03 18:21:47 2015 -0800
|
8
|
-
@@ -1,87 +1,17 @@
|
9
|
-
Vagrant.configure(2) do |config|
|
10
|
-
config.vm.box = "skytap/empty"
|
11
|
-
- config.vm.synced_folder ".", "/vagrant", disabled: true
|
12
|
-
+ #rsync
|
13
|
-
|
14
|
-
config.vm.provider :skytap do |skytap, override|
|
15
|
-
- skytap.username = "etrue"
|
16
|
-
- skytap.api_token = "fcb2620b72efddbc8239e25db9d812f510c7e166"
|
17
|
-
- #skytap.base_url = "https://cloud.skytap.com/"
|
18
|
-
- skytap.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
|
19
|
-
- #skytap.username = "vagrant_provider_admin"
|
20
|
-
- #skytap.api_token = "7c5718531a32eb90e92c804ce1f73da98be22cdf"
|
21
|
-
- #skytap.base_url = "https://test.skytap.com/"
|
22
|
-
- #skytap.username = "jsmith"
|
23
|
-
- #skytap.api_token = "754be5220955f35840498340606b4dfa89f7eb61"
|
24
|
-
- #skytap.base_url = "https://cloud.skytap.dev/"
|
25
|
-
+ #skytap.username = "<username>"
|
26
|
-
+ #skytap.api_token = "<api_token>"
|
27
|
-
end
|
28
|
-
|
29
|
-
- GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/6869434'
|
30
|
-
- # for test user
|
31
|
-
- #GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/4840008'
|
32
|
-
- # local user
|
33
|
-
- #GENERIC_UBUNTU = 'https://cloud.skytap.dev/vms/374'
|
34
|
-
-
|
35
|
-
- UBUNTU1 = "https://cloud.skytap.com/vms/7285844"
|
36
|
-
- UBUNTU2 = "https://cloud.skytap.com/vms/7285846"
|
37
|
-
- UBUNTU_WITH_VAGRANT = "https://cloud.skytap.com/vms/7397734"
|
38
|
-
- FROM_US_EAST = "https://cloud.skytap.com/vms/6232386"
|
39
|
-
- FROM_EMEA = "https://cloud.skytap.com/vms/4153172"
|
40
|
-
- ENG11490 = "https://cloud.skytap.com/templates/696065"
|
41
|
-
- NO_DISK = "https://cloud.skytap.com/vms/7500356"
|
42
|
-
-
|
43
|
-
- # may be gone by the time you see this
|
44
|
-
- ENVIRONMENT_VM = "https://cloud.skytap.com/vms/7457184"
|
45
|
-
- UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_A = "https://cloud.skytap.com/vms/7457184"
|
46
|
-
- UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_B = "https://cloud.skytap.com/vms/7468766"
|
47
|
-
-
|
48
|
-
- # separate template
|
49
|
-
- # another ubuntu = 'https://cloud.skytap.com/vms/7242466'
|
50
|
-
- WINDOWS_WINRM_CONFIGURED = 'https://cloud.skytap.com/vms/7242468'
|
51
|
-
-
|
52
|
-
- config.vm.define "vm1" do |ubuntu|
|
53
|
-
- ubuntu.vm.hostname = "vm1"
|
54
|
-
- ubuntu.vm.provider :skytap do |box|
|
55
|
-
- box.vm_url = UBUNTU1#GENERIC_UBUNTU
|
56
|
-
- #box.cpus = 1
|
57
|
-
- #box.cpuspersocket = 1
|
58
|
-
- #box.ram = 1024
|
59
|
-
- #box.guestos = "ubuntu"
|
60
|
-
- #box.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
|
61
|
-
+ config.vm.define "web" do |server|
|
62
|
-
+ server.vm.provider :skytap do |box|
|
63
|
-
+ box.vm_url = "https://cloud.skytap.com/vms/7285844"
|
64
|
-
+ #box.cpus = 2
|
65
|
-
end
|
66
|
-
- ubuntu.vm.synced_folder "vm1", "/synced", type: :nfs
|
67
|
-
- #ubuntu.vm.synced_folder "vm1", "/home/skytap/app", type: :nfs, :mount_options => ['actimeo=1']
|
68
|
-
- ubuntu.vm.communicator = :ssh
|
69
|
-
- ubuntu.ssh.username = "skytap"
|
70
|
-
- ubuntu.ssh.password = "ChangeMe!"
|
71
|
-
-
|
72
|
-
- ubuntu.vm.provision "shell", path: "provisioning/trivial.sh"
|
73
|
-
- #ubuntu.vm.provision "shell", path: "provisioning/apache.sh"
|
74
|
-
- #ubuntu.vm.provision "rails", type: "shell", path: "provisioning/rails.sh"
|
75
|
-
- end
|
76
|
-
-
|
77
|
-
- config.vm.define "vm2" do |windows|
|
78
|
-
- windows.vm.provider :skytap do |box, override|
|
79
|
-
- box.vm_url = WINDOWS_WINRM_CONFIGURED
|
80
|
-
- override.vm.guest = "windows"
|
81
|
-
- end
|
82
|
-
- windows.vm.communicator = :winrm
|
83
|
-
- end
|
84
|
-
- config.winrm.username = 'Administrator'
|
85
|
-
- config.winrm.password = 'admin'
|
86
|
-
-
|
87
|
-
- config.vm.define "vm3" do |ubuntu|
|
88
|
-
- ubuntu.vm.hostname = "vm3"
|
89
|
-
- ubuntu.vm.provider :skytap do |box|
|
90
|
-
- box.vm_url = UBUNTU2#GENERIC_UBUNTU
|
91
|
-
- #box.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
|
92
|
-
- end
|
93
|
-
- ubuntu.vm.communicator = :ssh
|
94
|
-
- ubuntu.ssh.username = "skytap"
|
95
|
-
- ubuntu.ssh.password = "CarpYe$$$"
|
96
|
-
- ubuntu.vm.synced_folder "vm3", "/synced", type: :nfs
|
97
|
-
- ubuntu.vm.provision "shell", path: "provisioning/trivial.sh"
|
98
|
-
- #ubuntu.vm.provision "shell", path: "provisioning/mysql.sh"
|
99
|
-
+ server.vm.synced_folder "vm1", "/synced", type: :nfs
|
100
|
-
end
|
101
|
-
end
|
102
|
-
-
|
103
|
-
-
|
data/_patches-20160112/eng-12249
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent 7474cf487118146a0f4fa1a2a796efffd9d0e603
|
3
|
-
ENG-12249 insecure public key, etc. for base box
|
4
|
-
|
5
|
-
diff -r 7474cf487118 vm1/vagrant
|
6
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
7
|
-
+++ b/vm1/vagrant Mon Dec 14 12:57:19 2015 -0800
|
8
|
-
@@ -0,0 +1,27 @@
|
9
|
-
+-----BEGIN RSA PRIVATE KEY-----
|
10
|
-
+MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
|
11
|
-
+w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
|
12
|
-
+kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
|
13
|
-
+hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
|
14
|
-
+Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
|
15
|
-
+yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd
|
16
|
-
+ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1
|
17
|
-
+Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf
|
18
|
-
+TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK
|
19
|
-
+iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A
|
20
|
-
+sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf
|
21
|
-
+4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP
|
22
|
-
+cXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk
|
23
|
-
+EjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN
|
24
|
-
+CAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX
|
25
|
-
+3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG
|
26
|
-
+YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj
|
27
|
-
+3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+
|
28
|
-
+dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz
|
29
|
-
+6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC
|
30
|
-
+P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF
|
31
|
-
+llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ
|
32
|
-
+kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
|
33
|
-
++vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
|
34
|
-
+NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
|
35
|
-
+-----END RSA PRIVATE KEY-----
|
36
|
-
diff -r 7474cf487118 vm1/vagrant.pub
|
37
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
38
|
-
+++ b/vm1/vagrant.pub Mon Dec 14 12:57:19 2015 -0800
|
39
|
-
@@ -0,0 +1,1 @@
|
40
|
-
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
|
data/_patches-20160112/eng-12301
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent 7bf28b483ba4495c173d9316aee2d8482d9705ab
|
3
|
-
ENG-12301 release machine lock
|
4
|
-
|
5
|
-
diff -r 7bf28b483ba4 lib/vagrant-skytap/action/mixin_machine_index.rb
|
6
|
-
--- a/lib/vagrant-skytap/action/mixin_machine_index.rb Thu Dec 03 19:36:57 2015 -0800
|
7
|
-
+++ b/lib/vagrant-skytap/action/mixin_machine_index.rb Mon Dec 07 14:42:07 2015 -0800
|
8
|
-
@@ -14,6 +14,7 @@
|
9
|
-
# NOTE: #get locks the machine. Make sure to #release(entry)
|
10
|
-
# when finished.
|
11
|
-
def machine_index_entry
|
12
|
-
+ @logger.debug("Locking machine #{index_uuid}") if @logger
|
13
|
-
entry = machine_index.get(env[:machine].index_uuid)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
diff -r 7bf28b483ba4 lib/vagrant-skytap/action/store_extra_data.rb
|
17
|
-
--- a/lib/vagrant-skytap/action/store_extra_data.rb Thu Dec 03 19:36:57 2015 -0800
|
18
|
-
+++ b/lib/vagrant-skytap/action/store_extra_data.rb Mon Dec 07 14:42:07 2015 -0800
|
19
|
-
@@ -17,6 +17,7 @@
|
20
|
-
|
21
|
-
def call(env)
|
22
|
-
entry = machine_index_entry
|
23
|
-
+ puts "Machine locked. Pausing 5 seconds so you can kill me"
|
24
|
-
entry.extra_data.merge!(provider_extra_data)
|
25
|
-
entry = machine_index.set(entry)
|
26
|
-
machine_index.release(entry)
|
27
|
-
diff -r 7bf28b483ba4 lib/vagrant-skytap/provider.rb
|
28
|
-
--- a/lib/vagrant-skytap/provider.rb Thu Dec 03 19:36:57 2015 -0800
|
29
|
-
+++ b/lib/vagrant-skytap/provider.rb Mon Dec 07 14:42:07 2015 -0800
|
30
|
-
@@ -6,6 +6,7 @@
|
31
|
-
class Provider < Vagrant.plugin("2", :provider)
|
32
|
-
def initialize(machine)
|
33
|
-
@machine = machine
|
34
|
-
+ @logger = Log4r::Logger.new("vagrant_skytap::plugin::provider")
|
35
|
-
end
|
36
|
-
|
37
|
-
def action(name)
|
38
|
-
@@ -26,10 +27,11 @@
|
39
|
-
end
|
40
|
-
|
41
|
-
def state
|
42
|
-
+ @logger.debug("Entered Provider#state")
|
43
|
-
# Run a custom action we define called "read_state" which does
|
44
|
-
# what it says. It puts the state in the `:machine_state_id`
|
45
|
-
# key in the environment.
|
46
|
-
- env = @machine.action("read_state")
|
47
|
-
+ env = @machine.action("read_state", lock: false) # can't be this easy
|
48
|
-
|
49
|
-
state_id = env[:machine_state_id]
|
50
|
-
|
data/_patches-20160112/eng-12843
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent d12ff92a5f45243523ff63f49b559dd3793fe41e
|
3
|
-
ENG-12843 make Up command work without hacking a copy of the command
|
4
|
-
|
5
|
-
diff -r d12ff92a5f45 -r 52e7dd5125d7 lib/vagrant-skytap/action.rb
|
6
|
-
--- a/lib/vagrant-skytap/action.rb Mon Dec 28 10:54:14 2015 -0800
|
7
|
-
+++ b/lib/vagrant-skytap/action.rb Tue Jan 05 13:21:52 2016 -0800
|
8
|
-
@@ -190,6 +190,16 @@
|
9
|
-
# and initial states for all machines to be run, potentially
|
10
|
-
# with a single REST call.
|
11
|
-
|
12
|
-
+ def self.action_up
|
13
|
-
+ Vagrant::Action::Builder.new.tap do |b|
|
14
|
-
+ b.use HandleBox
|
15
|
-
+ #b.use action_fetch_environment
|
16
|
-
+ b.use ConfigValidate
|
17
|
-
+# b.use InitializeAPIClient
|
18
|
-
+# b.use FetchEnvironment
|
19
|
-
+ end
|
20
|
-
+ end
|
21
|
-
+
|
22
|
-
def self.action_create
|
23
|
-
Vagrant::Action::Builder.new.tap do |b|
|
24
|
-
b.use HandleBox
|
25
|
-
@@ -320,6 +330,7 @@
|
26
|
-
autoload :MessageEnvironmentUrl, action_root.join("message_environment_url")
|
27
|
-
autoload :MessageResuming, action_root.join("message_resuming")
|
28
|
-
autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
|
29
|
-
+ autoload :PostActionUp, action_root.join("post_action_up")
|
30
|
-
autoload :PrepareForwardedPortCollisionParams, action_root.join("prepare_forwarded_port_collision_params")
|
31
|
-
autoload :PrepareNFSSettings, action_root.join("prepare_nfs_settings")
|
32
|
-
autoload :PrepareNFSValidIds, action_root.join("prepare_nfs_valid_ids")
|
33
|
-
diff -r d12ff92a5f45 -r 52e7dd5125d7 lib/vagrant-skytap/action/post_action_up.rb
|
34
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
35
|
-
+++ b/lib/vagrant-skytap/action/post_action_up.rb Tue Jan 05 13:21:52 2016 -0800
|
36
|
-
@@ -0,0 +1,26 @@
|
37
|
-
+require 'byebug'
|
38
|
-
+require_relative "mixin_machine_index"
|
39
|
-
+
|
40
|
-
+module VagrantPlugins
|
41
|
-
+ module Skytap
|
42
|
-
+ module Action
|
43
|
-
+ # This can be used with "Call" built-in to check if the action
|
44
|
-
+ # is being performed as part of a parallel operation.
|
45
|
-
+ class PostActionUp
|
46
|
-
+ include MixinMachineIndex
|
47
|
-
+ def initialize(app, env)
|
48
|
-
+ @app = app
|
49
|
-
+ @logger = Log4r::Logger.new("vagrant_skytap::action::post_action_up")
|
50
|
-
+ end
|
51
|
-
+
|
52
|
-
+ def call(env)
|
53
|
-
+ @logger.info env[:action_name]
|
54
|
-
+ @logger.info env[:machine].try(:name)
|
55
|
-
+ debugger
|
56
|
-
+
|
57
|
-
+ @app.call(env)
|
58
|
-
+ end
|
59
|
-
+ end
|
60
|
-
+ end
|
61
|
-
+ end
|
62
|
-
+end
|
63
|
-
diff -r d12ff92a5f45 -r 52e7dd5125d7 lib/vagrant-skytap/plugin.rb
|
64
|
-
--- a/lib/vagrant-skytap/plugin.rb Mon Dec 28 10:54:14 2015 -0800
|
65
|
-
+++ b/lib/vagrant-skytap/plugin.rb Tue Jan 05 13:21:52 2016 -0800
|
66
|
-
@@ -3,7 +3,7 @@
|
67
|
-
rescue LoadError
|
68
|
-
raise "The Vagrant Skytap plugin must be run within Vagrant."
|
69
|
-
end
|
70
|
-
-
|
71
|
-
+require 'byebug'
|
72
|
-
# This is a sanity check to make sure no one is attempting to install
|
73
|
-
# this into an early Vagrant version.
|
74
|
-
if Vagrant::VERSION < "1.2.0"
|
75
|
-
@@ -34,9 +34,17 @@
|
76
|
-
Provider
|
77
|
-
end
|
78
|
-
|
79
|
-
- command("up", primary: true) do
|
80
|
-
- require_relative "command/up"
|
81
|
-
- Skytap::Command::Up
|
82
|
-
+# command("up", primary: true) do
|
83
|
-
+# require_relative "command/up"
|
84
|
-
+# Skytap::Command::Up
|
85
|
-
+# end
|
86
|
-
+
|
87
|
-
+ action_hook(:post_up_behavior1, :environment_unload) do |hook|
|
88
|
-
+ hook.prepend(VagrantPlugins::Skytap::Action::PostActionUp)
|
89
|
-
+ end
|
90
|
-
+
|
91
|
-
+ action_hook(:post_up_behavior4, :machine_action_up) do |hook|
|
92
|
-
+ hook.append(VagrantPlugins::Skytap::Action::PostActionUp)
|
93
|
-
end
|
94
|
-
|
95
|
-
command("publish-url", primary: true) do
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent 2d0352ab9e88823add32c339d95d9782c00fba51
|
3
|
-
ENG-11604 support using environment vms (this is impossible without an API change)
|
4
|
-
|
5
|
-
diff -r 2d0352ab9e88 Vagrantfile
|
6
|
-
--- a/Vagrantfile Wed Nov 04 16:26:46 2015 -0800
|
7
|
-
+++ b/Vagrantfile Wed Nov 04 16:28:24 2015 -0800
|
8
|
-
@@ -39,7 +39,7 @@
|
9
|
-
config.vm.define "vm1" do |ubuntu|
|
10
|
-
ubuntu.vm.hostname = "vm1"
|
11
|
-
ubuntu.vm.provider :skytap do |box|
|
12
|
-
- box.vm_url = UBUNTU1#GENERIC_UBUNTU
|
13
|
-
+ box.vm_url = UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_A#GENERIC_UBUNTU
|
14
|
-
#box.cpus = 1
|
15
|
-
#box.cpuspersocket = 1
|
16
|
-
#box.ram = 1024
|
17
|
-
@@ -64,7 +64,7 @@
|
18
|
-
config.vm.define "vm3" do |ubuntu|
|
19
|
-
ubuntu.vm.hostname = "vm3"
|
20
|
-
ubuntu.vm.provider :skytap do |box|
|
21
|
-
- box.vm_url = UBUNTU2#GENERIC_UBUNTU
|
22
|
-
+ box.vm_url = UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_B#GENERIC_UBUNTU
|
23
|
-
end
|
24
|
-
ubuntu.vm.communicator = :ssh
|
25
|
-
ubuntu.ssh.username = "skytap"
|
26
|
-
diff -r 2d0352ab9e88 lib/vagrant-skytap/api/environment.rb
|
27
|
-
--- a/lib/vagrant-skytap/api/environment.rb Wed Nov 04 16:26:46 2015 -0800
|
28
|
-
+++ b/lib/vagrant-skytap/api/environment.rb Wed Nov 04 16:28:24 2015 -0800
|
29
|
-
@@ -18,8 +18,27 @@
|
30
|
-
vm = Vm.fetch(env, vm_url)
|
31
|
-
check_vm_before_adding(env, vm)
|
32
|
-
|
33
|
-
- resp = env[:api_client].post(RESOURCE_ROOT, JSON.dump(template_id: vm.template_id, vm_ids: [vm.id]))
|
34
|
-
- fetch(env, resp['Location'])
|
35
|
-
+ params = {
|
36
|
-
+ vm_ids: [vm.id]
|
37
|
-
+ }.tap do |params|
|
38
|
-
+ if vm.from_template?
|
39
|
-
+ params[:template_id] = vm.template_id
|
40
|
-
+ else
|
41
|
-
+ params[:configuration_id] = vm.environment_id
|
42
|
-
+ end
|
43
|
-
+ end
|
44
|
-
+
|
45
|
-
+ puts params
|
46
|
-
+ debugger
|
47
|
-
+
|
48
|
-
+ resp = env[:api_client].post(RESOURCE_ROOT, JSON.dump(params))#_for_add(vm)))
|
49
|
-
+ if resp['Location']
|
50
|
-
+ puts "Redirected to #{resp['Location']}"
|
51
|
-
+ fetch(env, resp['Location'])
|
52
|
-
+ else
|
53
|
-
+ puts "call returned #{resp.body}"
|
54
|
-
+ new(JSON.load(resp.body), env)
|
55
|
-
+ end
|
56
|
-
end
|
57
|
-
|
58
|
-
def fetch(env, url)
|
59
|
-
@@ -31,6 +50,16 @@
|
60
|
-
EnvironmentProperties.read(env[:machine].env.local_data_path)
|
61
|
-
end
|
62
|
-
|
63
|
-
+ def params_for_add(vm)
|
64
|
-
+ {
|
65
|
-
+ vm_ids: [vm.id]
|
66
|
-
+ }.tap do |params|
|
67
|
-
+ unless params[:merge_configuration] = vm.environment_id
|
68
|
-
+ params[:template_id] = vm.template_id
|
69
|
-
+ end
|
70
|
-
+ end
|
71
|
-
+ end
|
72
|
-
+
|
73
|
-
def check_vm_before_adding(env, vm)
|
74
|
-
raise Errors::NotTemplateVm, url: vm.url unless vm.from_template?
|
75
|
-
raise Errors::SourceVmNotStopped, name: env[:machine].name, url: vm.url unless vm.stopped?
|
76
|
-
@@ -90,7 +119,20 @@
|
77
|
-
check_vm_before_adding(env, vm)
|
78
|
-
vm_ids = vms.collect(&:id)
|
79
|
-
|
80
|
-
- update_with_retry(template_id: vm.template_id, vm_ids: [vm.id])
|
81
|
-
+ params = {
|
82
|
-
+ vm_ids: [vm.id]
|
83
|
-
+ }.tap do |params|
|
84
|
-
+ if vm.from_template?
|
85
|
-
+ params[:template_id] = vm.template_id
|
86
|
-
+ else
|
87
|
-
+ params[:merge_configuration] = vm.environment_id
|
88
|
-
+ end
|
89
|
-
+ end
|
90
|
-
+
|
91
|
-
+
|
92
|
-
+ puts params
|
93
|
-
+ debugger
|
94
|
-
+ update_with_retry(params)#self.class.params_for_add(vm))
|
95
|
-
new_vm_ids = vms.collect(&:id) - vm_ids
|
96
|
-
get_vm_by_id(new_vm_ids.last)
|
97
|
-
end
|
98
|
-
diff -r 2d0352ab9e88 lib/vagrant-skytap/api/vm.rb
|
99
|
-
--- a/lib/vagrant-skytap/api/vm.rb Wed Nov 04 16:26:46 2015 -0800
|
100
|
-
+++ b/lib/vagrant-skytap/api/vm.rb Wed Nov 04 16:28:24 2015 -0800
|
101
|
-
@@ -60,6 +60,11 @@
|
102
|
-
!!get_api_attribute('template_url')
|
103
|
-
end
|
104
|
-
|
105
|
-
+ def environment_id
|
106
|
-
+ get_api_attribute('configuration_url') =~ /configurations\/(\d+)/
|
107
|
-
+ $1
|
108
|
-
+ end
|
109
|
-
+
|
110
|
-
def template_id
|
111
|
-
get_api_attribute('template_url') =~ /templates\/(\d+)/
|
112
|
-
$1
|