vagrant-skytap 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/Vagrantfile.keep ADDED
@@ -0,0 +1,91 @@
1
+ Vagrant.configure(2) do |config|
2
+ config.vm.box = "skytap/empty"
3
+ config.vm.synced_folder ".", "/vagrant", disabled: true
4
+
5
+ config.vm.provider :skytap do |skytap, override|
6
+ skytap.username = "etrue"
7
+ skytap.api_token = "fcb2620b72efddbc8239e25db9d812f510c7e166"
8
+ #skytap.base_url = "https://cloud.skytap.com/"
9
+ skytap.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
10
+ #skytap.username = "vagrant_provider_admin"
11
+ #skytap.api_token = "7c5718531a32eb90e92c804ce1f73da98be22cdf"
12
+ #skytap.base_url = "https://test.skytap.com/"
13
+ #skytap.username = "jsmith"
14
+ #skytap.api_token = "754be5220955f35840498340606b4dfa89f7eb61"
15
+ #skytap.base_url = "https://cloud.skytap.dev/"
16
+ end
17
+
18
+ GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/6869434'
19
+ # for test user
20
+ #GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/4840008'
21
+ # local user
22
+ #GENERIC_UBUNTU = 'https://cloud.skytap.dev/vms/374'
23
+
24
+ UBUNTU1 = "https://cloud.skytap.com/vms/7285844"
25
+ UBUNTU2 = "https://cloud.skytap.com/vms/7285846"
26
+ UBUNTU_WITH_VAGRANT = "https://cloud.skytap.com/vms/7397734"
27
+ FROM_US_EAST = "https://cloud.skytap.com/vms/6232386"
28
+ FROM_EMEA = "https://cloud.skytap.com/vms/4153172"
29
+ ENG11490 = "https://cloud.skytap.com/templates/696065"
30
+ NO_DISK = "https://cloud.skytap.com/vms/7500356"
31
+
32
+ # may be gone by the time you see this
33
+ ENVIRONMENT_VM = "https://cloud.skytap.com/vms/7457184"
34
+ UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_A = "https://cloud.skytap.com/vms/7457184"
35
+ UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_B = "https://cloud.skytap.com/vms/7468766"
36
+
37
+ # separate template
38
+ # another ubuntu = 'https://cloud.skytap.com/vms/7242466'
39
+ WINDOWS_WINRM_CONFIGURED = 'https://cloud.skytap.com/vms/7242468'
40
+
41
+ config.vm.define "vm1" do |ubuntu|
42
+ ubuntu.vm.hostname = "vm1"
43
+ ubuntu.vm.provider :skytap do |box|
44
+ box.vm_url = UBUNTU1#GENERIC_UBUNTU
45
+ #box.cpus = 1
46
+ #box.cpuspersocket = 1
47
+ #box.ram = 1024
48
+ #box.guestos = "ubuntu"
49
+ #box.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
50
+ end
51
+
52
+ ubuntu.vm.network :forwarded_port, guest: 80, host: 8080
53
+
54
+ #ubuntu.vm.synced_folder "vm1", "/synced", type: :nfs
55
+ #ubuntu.vm.synced_folder "vm1", "/home/skytap/app", type: :nfs, :mount_options => ['actimeo=1']
56
+ ubuntu.vm.communicator = :ssh
57
+ ubuntu.ssh.username = "skytap"
58
+ ubuntu.ssh.password = "ChangeMe!"
59
+
60
+
61
+ #ubuntu.vm.provision "shell", path: "provisioning/trivial.sh"
62
+ #ubuntu.vm.provision "shell", path: "provisioning/apache.sh"
63
+ #ubuntu.vm.provision "rails", type: "shell", path: "provisioning/rails.sh"
64
+ end
65
+
66
+ # config.vm.define "vm2" do |windows|
67
+ # windows.vm.provider :skytap do |box, override|
68
+ # box.vm_url = WINDOWS_WINRM_CONFIGURED
69
+ # override.vm.guest = "windows"
70
+ # end
71
+ # windows.vm.communicator = :winrm
72
+ # end
73
+ # config.winrm.username = 'Administrator'
74
+ # config.winrm.password = 'admin'
75
+ #
76
+ # config.vm.define "vm3" do |ubuntu|
77
+ # ubuntu.vm.hostname = "vm3"
78
+ # ubuntu.vm.provider :skytap do |box|
79
+ # box.vm_url = UBUNTU2#GENERIC_UBUNTU
80
+ # #box.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
81
+ # end
82
+ # ubuntu.vm.communicator = :ssh
83
+ # ubuntu.ssh.username = "skytap"
84
+ # ubuntu.ssh.password = "CarpYe$$$"
85
+ # ubuntu.vm.synced_folder "vm3", "/synced", type: :nfs
86
+ # ubuntu.vm.provision "shell", path: "provisioning/trivial.sh"
87
+ # #ubuntu.vm.provision "shell", path: "provisioning/mysql.sh"
88
+ # end
89
+ end
90
+
91
+
@@ -1,25 +1,25 @@
1
- require 'optparse'
2
-
3
- require "vagrant"
4
-
5
- require_relative 'start_mixins'
6
-
7
- # This is a modified copy of the built-in "up" command, which alters how
1
+ # We've subclassed the builtin "up" command to alter how
8
2
  # parallelization is implemented. Instead of making concurrent requests to run
9
3
  # individual VMs, we make a single REST call to update the runstates of
10
4
  # multiple VMs within the containing Skytap environment.
11
5
 
6
+ require Vagrant.source_root.join("plugins/commands/up/command")
7
+
12
8
  module VagrantPlugins
13
9
  module Skytap
14
10
  module Command
15
- class Up < Vagrant.plugin("2", :command)
16
- include StartMixins
17
-
18
- def self.synopsis
19
- "starts and provisions the vagrant environment"
20
- end
11
+ class Up < VagrantPlugins::CommandUp::Command
21
12
 
22
13
  def execute
14
+ # This implementation of the "up" command overrides
15
+ # the default implementation due to load order.
16
+ if @env.default_provider == :skytap
17
+ @logger.debug("Executing Skytap 'Up' implementation.")
18
+ else
19
+ @logger.debug("Calling default 'Up' implementation.")
20
+ return super
21
+ end
22
+
23
23
  options = {}
24
24
  options[:destroy_on_error] = true
25
25
  options[:parallel] = true
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Skytap
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-skytap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Astete
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-30 00:00:00.000000000 Z
11
+ date: 2015-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_pure
@@ -114,15 +114,10 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
- - bar
118
117
  - boxes/empty.box
119
118
  - boxes/metadata.json
120
119
  - boxes/README.md
121
120
  - CHANGELOG.md
122
- - eng-10269-cleanup.diff
123
- - eng-10269-tmp.diff
124
- - eng-10269.diff
125
- - eng-10269.diff.1
126
121
  - eng-10369.diff
127
122
  - Gemfile
128
123
  - lib/vagrant-skytap/action/add_vm_to_environment.rb
@@ -175,7 +170,6 @@ files:
175
170
  - lib/vagrant-skytap/api/vm.rb
176
171
  - lib/vagrant-skytap/api/vpn.rb
177
172
  - lib/vagrant-skytap/api/vpn_attachment.rb
178
- - lib/vagrant-skytap/command/start_mixins.rb
179
173
  - lib/vagrant-skytap/command/up.rb
180
174
  - lib/vagrant-skytap/config.rb
181
175
  - lib/vagrant-skytap/core_ext/object/blank.rb
@@ -226,6 +220,7 @@ files:
226
220
  - tasks/test.rake
227
221
  - vagrant-skytap.gemspec
228
222
  - vagrant-spec.config.rb
223
+ - Vagrantfile.keep
229
224
  - .byebug_history
230
225
  - .gitignore
231
226
  - .hgignore
@@ -251,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
246
  version: 1.3.6
252
247
  requirements: []
253
248
  rubyforge_project: vagrant-skytap
254
- rubygems_version: 2.0.14
249
+ rubygems_version: 2.0.14.1
255
250
  signing_key:
256
251
  specification_version: 4
257
252
  summary: Enables Vagrant to manage Skytap machines.
data/bar DELETED
@@ -1,6 +0,0 @@
1
- 2015-11-09T18:14:57.1402+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] perf_stat_counters.rb:109 Perf: 118||DB: 0.0ms|V: 0.0ms|GET /ibm_marketplace/subscribe html||Chrome 46.0.2490.80|406
2
- 2015-11-09T18:14:57.1391+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] log_subscriber.rb:105 Completed 406 Not Acceptable in 16.5ms (ActiveRecord: 0.0ms)
3
- 2015-11-09T18:14:57.1385+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] log_subscriber.rb:105 Filter chain halted as :verify_oauth_signature rendered or redirected
4
- 2015-11-09T18:14:57.1375+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] ibm_marketplace_controller.rb:636 Request did not include an OAuth consumer key.
5
- 2015-11-09T18:14:57.1220+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] log_subscriber.rb:105 Processing by IbmMarketplaceController#subscribe as HTML
6
- 2015-11-09T18:14:57.0192+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] logger.rb:31 Started GET "/ibm_marketplace/subscribe" for 66.193.98.66 at 2015-11-09 18:14:57 +0000
@@ -1,247 +0,0 @@
1
- # HG changeset patch
2
- # Parent 315fe5d07c6435fdb931fb73df1aef34a8205916
3
- ENG-10269 the last mandatory bit of cleanup: how we capture provide vm state
4
-
5
- diff -r 315fe5d07c64 lib/vagrant-skytap/action.rb
6
- --- a/lib/vagrant-skytap/action.rb Fri Nov 20 12:31:47 2015 -0800
7
- +++ b/lib/vagrant-skytap/action.rb Fri Nov 20 19:19:54 2015 -0800
8
- @@ -168,11 +168,11 @@
9
- end
10
- end
11
-
12
- - # Some middlewares perform further actions after the succeeding
13
- - # middleware returns. Provision and SyncedFolders, specifically,
14
- - # both require the machine to be booted on the way back. This
15
- - # requirement can be satisfied by putting the WaitForCommunicator
16
- - # middleware later in the sequence.
17
- + # Note: Provision and SyncedFolders perform actions before and after
18
- + # calling the next middleware in the sequence. Both require that
19
- + # the machine be booted before those calls return. This requirement
20
- + # can be satisfied by putting the WaitForCommunicator middleware
21
- + # later in the sequence.
22
- def self.action_prepare_boot
23
- Vagrant::Action::Builder.new.tap do |b|
24
- b.use PrepareNFSSettings
25
- @@ -185,19 +185,27 @@
26
-
27
- def self.action_resume
28
- Vagrant::Action::Builder.new.tap do |b|
29
- - b.use action_up
30
- + Vagrant::Action::Builder.new.tap do |b|
31
- + b.use InitializeAPIClient
32
- + b.use FetchEnvironment
33
- + b.use Call, IsSuspended do |env, b1|
34
- + if env[:result]
35
- + b1.use MessageResuming
36
- + b1.use RunVm
37
- + b1.use WaitForCommunicator
38
- + end
39
- + end
40
- + end
41
- end
42
- end
43
-
44
- - # This action is called to bring the box up from nothing.
45
- - def self.action_up
46
- - Vagrant::Action::Builder.new.tap do |b|
47
- - b.use action_create
48
- - b.use action_run_vm
49
- - end
50
- - end
51
- + # The Skytap provider has a modified "vagrant up" command which
52
- + # takes advantage of parallel runstate operations on Skytap
53
- + # environments. The create and update_hardware actions are
54
- + # separated from the run_vm action, so we can pass in the ids
55
- + # and initial states for all machines to be run, potentially
56
- + # with a single REST call.
57
-
58
- - # This action is called by our modified "up" command.
59
- def self.action_create
60
- Vagrant::Action::Builder.new.tap do |b|
61
- b.use HandleBox
62
- @@ -217,6 +225,13 @@
63
- b1.use StoreExtraData
64
- b1.use SetUpVm
65
- end
66
- + end
67
- + end
68
- +
69
- + def self.action_update_hardware
70
- + Vagrant::Action::Builder.new.tap do |b|
71
- + b.use InitializeAPIClient
72
- + b.use FetchEnvironment
73
- b.use Call, IsStopped do |env, b1|
74
- if env[:result]
75
- b1.use UpdateHardware
76
- @@ -226,28 +241,25 @@
77
- end
78
- end
79
-
80
- - # This action is called by our modified "up" command after
81
- - # all the VMs have been created. The action is called once
82
- - # for each machine, but by default, the RunEnvironment
83
- - # middleware will run all the machines in parallel; after
84
- - # the first invocation, RunEnvironment is a no-op.
85
- def self.action_run_vm
86
- Vagrant::Action::Builder.new.tap do |b|
87
- b.use InitializeAPIClient
88
- b.use FetchEnvironment
89
- +
90
- b.use Call, InitialState do |env, b1|
91
- case env[:result]
92
- when :running
93
- b1.use MessageAlreadyRunning
94
- next
95
- when :suspended
96
- - b1.use Message, "The machine will be resumed"
97
- - when :stopped
98
- + b1.use MessageResuming
99
- + else
100
- b1.use action_prepare_boot
101
- end
102
- -
103
- b1.use Call, IsParallelized do |env2, b2|
104
- if env2[:result]
105
- + # Note: RunEnvironment is a no-op after
106
- + # the first invocation.
107
- b2.use RunEnvironment
108
- else
109
- b2.use RunVm
110
- @@ -263,13 +275,17 @@
111
- b.use ConfigValidate
112
- b.use InitializeAPIClient
113
- b.use FetchEnvironment
114
- - b.use Call, ExistenceCheck do |env, b2|
115
- + b.use Call, ExistenceCheck do |env, b1|
116
- case env[:result]
117
- when :missing_environment, :missing_vm, :no_vms
118
- - b2.use MessageNotCreated
119
- + b1.use MessageNotCreated
120
- else
121
- - b2.use action_halt
122
- - b2.use action_up
123
- + b1.use action_halt
124
- + b1.use action_update_hardware
125
- + # We don't need to store the initial states
126
- + # before calling run_vm, because the default
127
- + # behavior is to treat the VMs as powered off.
128
- + b1.use action_run_vm
129
- end
130
- end
131
- end
132
- @@ -294,6 +310,7 @@
133
- autoload :MessageAlreadyRunning, action_root.join("message_already_running")
134
- autoload :MessageNotCreated, action_root.join("message_not_created")
135
- autoload :MessageEnvironmentUrl, action_root.join("message_environment_url")
136
- + autoload :MessageResuming, action_root.join("message_resuming")
137
- autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
138
- autoload :PrepareNFSSettings, action_root.join("prepare_nfs_settings")
139
- autoload :PrepareNFSValidIds, action_root.join("prepare_nfs_valid_ids")
140
- diff -r 315fe5d07c64 lib/vagrant-skytap/action/initial_state.rb
141
- --- a/lib/vagrant-skytap/action/initial_state.rb Fri Nov 20 12:31:47 2015 -0800
142
- +++ b/lib/vagrant-skytap/action/initial_state.rb Fri Nov 20 19:19:54 2015 -0800
143
- @@ -1,9 +1,8 @@
144
- module VagrantPlugins
145
- module Skytap
146
- module Action
147
- - # This is specifically for the "up" action. When we run in parallel, we have
148
- - # to know which machines were initially powered off so we can set up operations
149
- - # which will happen after the machine is ready
150
- + # Our modified "up" command captures the VM states in the initial_states hash
151
- + # before running them, potentially in parallel.
152
- class InitialState
153
- def initialize(app, env)
154
- @app = app
155
- @@ -11,7 +10,8 @@
156
- end
157
-
158
- def call(env)
159
- - env[:result] = env[:initial_states][env[:machine].id]
160
- + # if initial_states is absent, result is nil
161
- + env[:result] = env[:initial_states].try(:[], env[:machine].id)
162
- @app.call(env)
163
- end
164
- end
165
- diff -r 315fe5d07c64 lib/vagrant-skytap/action/message_resuming.rb
166
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
167
- +++ b/lib/vagrant-skytap/action/message_resuming.rb Fri Nov 20 19:19:54 2015 -0800
168
- @@ -0,0 +1,16 @@
169
- +module VagrantPlugins
170
- + module Skytap
171
- + module Action
172
- + class MessageResuming
173
- + def initialize(app, env)
174
- + @app = app
175
- + end
176
- +
177
- + def call(env)
178
- + env[:ui].info(I18n.t("vagrant_skytap.resuming"))
179
- + @app.call(env)
180
- + end
181
- + end
182
- + end
183
- + end
184
- +end
185
- diff -r 315fe5d07c64 lib/vagrant-skytap/action/run_environment.rb
186
- --- a/lib/vagrant-skytap/action/run_environment.rb Fri Nov 20 12:31:47 2015 -0800
187
- +++ b/lib/vagrant-skytap/action/run_environment.rb Fri Nov 20 19:19:54 2015 -0800
188
- @@ -3,8 +3,9 @@
189
- module VagrantPlugins
190
- module Skytap
191
- module Action
192
- - # Runs multiple VMs in parallel. The :first_machine flag is used to prevent
193
- - # redundant REST calls on subsequent invocations.
194
- + # Runs multiple VMs in parallel. This middleware will be invoked for
195
- + # each machine, so we set the :first_machine flag to prevent redundant
196
- + # REST calls.
197
- class RunEnvironment
198
- include Vagrant::Util::Retryable
199
-
200
- diff -r 315fe5d07c64 lib/vagrant-skytap/command/up.rb
201
- --- a/lib/vagrant-skytap/command/up.rb Fri Nov 20 12:31:47 2015 -0800
202
- +++ b/lib/vagrant-skytap/command/up.rb Fri Nov 20 19:19:54 2015 -0800
203
- @@ -60,7 +60,6 @@
204
- # Go over each VM and bring it up
205
- @logger.debug("'Up' each target VM...")
206
-
207
- - # Create the VMs, then pass all the machines to the run action
208
- machines = []
209
- names = argv
210
- if names.empty?
211
- @@ -85,15 +84,9 @@
212
-
213
- machines << machine
214
- machine.action(:create, options)
215
- + machine.action(:update_hardware, options)
216
- end
217
-
218
- - # Capture states before the parallel runstate operation.
219
- - # Checking state is relatively expensive. we should be smarter
220
- - # about what information to capture. For example, we can
221
- - # determine which machines were newly created, and put them in
222
- - # the :stopped collection. Or call them :created? No, that
223
- - # would likely be confusing
224
- - #require_boot = machines.select{|m| m.state.id == :stopped}
225
- initial_states = machines.inject({}) do |acc, m|
226
- acc[m.id] = m.state.id
227
- acc
228
- @@ -103,7 +96,6 @@
229
- machine.action(:run_vm, options.merge(
230
- first_machine: i == 0,
231
- machines: machines,
232
- - #require_boot: require_boot,
233
- initial_states: initial_states
234
- ))
235
- end
236
- diff -r 315fe5d07c64 locales/en.yml
237
- --- a/locales/en.yml Fri Nov 20 12:31:47 2015 -0800
238
- +++ b/locales/en.yml Fri Nov 20 19:19:54 2015 -0800
239
- @@ -22,6 +22,8 @@
240
- Stopping the instance...
241
- terminating: |-
242
- Terminating the instance...
243
- + resuming: |-
244
- + Resuming the suspended instance ...
245
- waiting_for_ready: |-
246
- Waiting for instance to become "ready"...
247
- waiting_for_ssh: |-