vagrant-skytap 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -3
- data/lib/vagrant-skytap/action/compose_environment.rb +0 -3
- data/lib/vagrant-skytap/action/prepare_forwarded_port_collision_params.rb +0 -1
- data/lib/vagrant-skytap/action/prepare_nfs_valid_ids.rb +3 -2
- data/lib/vagrant-skytap/action/wait_for_communicator.rb +0 -1
- data/lib/vagrant-skytap/action.rb +0 -1
- data/lib/vagrant-skytap/api/busyable.rb +1 -1
- data/lib/vagrant-skytap/api/client.rb +0 -1
- data/lib/vagrant-skytap/api/interface.rb +0 -1
- data/lib/vagrant-skytap/api/public_ip.rb +1 -2
- data/lib/vagrant-skytap/api/published_service.rb +2 -3
- data/lib/vagrant-skytap/api/vpn.rb +1 -2
- data/lib/vagrant-skytap/command/publish_url/root.rb +1 -1
- data/lib/vagrant-skytap/command/up.rb +10 -4
- data/lib/vagrant-skytap/core_ext/object/blank.rb +0 -22
- data/lib/vagrant-skytap/core_ext/try.rb +0 -22
- data/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb +0 -1
- data/lib/vagrant-skytap/plugin.rb +1 -1
- data/lib/vagrant-skytap/util/compile_forwarded_ports.rb +1 -1
- data/lib/vagrant-skytap/version.rb +1 -1
- data/lib/vagrant-skytap.rb +0 -2
- data/spec/unit/actions/compose_environment_spec.rb +0 -3
- data/spec/unit/actions/update_hardware_spec.rb +0 -1
- data/spec/unit/base.rb +1 -8
- data/spec/unit/config_spec.rb +0 -4
- data/spec/unit/environment_spec.rb +14 -23
- data/spec/unit/forwarded_port_spec.rb +0 -2
- data/spec/unit/prepare_collision_params_spec.rb +0 -14
- data/spec/unit/publish_set_spec.rb +7 -15
- data/spec/unit/setup_helper_spec.rb +28 -48
- data/spec/unit/support/api_responses/empty_environment.json +1 -1
- data/spec/unit/support/shared/rest_api_context.rb +3 -0
- data/spec/unit/support/shared/skytap_context.rb +14 -0
- data/spec/unit/vm_spec.rb +8 -15
- data/vagrant-skytap.gemspec +4 -4
- metadata +7 -20
- data/.hgignore +0 -22
- data/.project +0 -11
- data/.rspec +0 -1
- data/spec/acceptance/base.rb +0 -24
- data/spec/acceptance/provider/halt_spec.rb +0 -25
- data/spec/acceptance/provider/up_spec.rb +0 -62
- data/spec/acceptance/shared/context_skytap.rb +0 -25
- data/spec/support/isolated_environment.rb +0 -67
- data/spec/unit/support/dummy_communicator.rb +0 -105
- data/spec/unit/support/dummy_provider.rb +0 -63
- data/spec/unit/support/isolated_environment.rb +0 -239
- data/spec/unit/support/shared/action_synced_folders_context.rb +0 -37
- data/spec/unit/support/shared/base_context.rb +0 -138
- data/spec/unit/support/shared/capability_helpers_context.rb +0 -51
- data/spec/unit/support/shared/plugin_command_context.rb +0 -34
- data/vagrant-spec.config.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24c83e15798abd9dd2e7df78bd984c2768dae164
|
4
|
+
data.tar.gz: 0198f2146818c63d8ef7fc0bf9808a20fdea288e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 533b0663bcd1ceee2c749db4cc4bc95a77bb2a1a940d90422fdb118ae182b72dcf10dfc84ccde3510590193511eec4d24ae9421dbbeb4cd2c601db6a5d402804
|
7
|
+
data.tar.gz: 231290cdc514f59aa84187f951a47b13742447a7a5fcfa78af9c1675c1e1efd02a4a2522c5e1f74817b39090ad10cc408b2c8c8fca031766b7ec6bbf30c8abb1
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -9,11 +9,8 @@ group :development do
|
|
9
9
|
if File.exist?(File.expand_path("../../vagrant", __FILE__))
|
10
10
|
gem 'vagrant', path: "../vagrant"
|
11
11
|
else
|
12
|
-
# TODO test against tip
|
13
12
|
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => 'v1.7.2'
|
14
13
|
end
|
15
|
-
gem "byebug"
|
16
|
-
|
17
14
|
|
18
15
|
if File.exist?(File.expand_path("../../vagrant-spec", __FILE__))
|
19
16
|
gem 'vagrant-spec', path: "../vagrant-spec"
|
@@ -93,9 +93,6 @@ module VagrantPlugins
|
|
93
93
|
end
|
94
94
|
|
95
95
|
# Fetch the source VMs for the given machines.
|
96
|
-
# TODO Optimize by downloading unique parent objects, and pick
|
97
|
-
# the VM child objects; Set the VMs' parent object so Vm#region
|
98
|
-
# doesn't require another GET.
|
99
96
|
#
|
100
97
|
# @param [Array] machines Set of [Vagrant::Machine] objects
|
101
98
|
# @return [Hash] mapping of machine names to [API::Vm] objects
|
@@ -29,8 +29,9 @@ module VagrantPlugins
|
|
29
29
|
# Creates a list of vm ids from all Skytap VMs in Vagrant's global machine
|
30
30
|
# index. Any Vagrant machine not on this list will have its NFS entry
|
31
31
|
# pruned by the SyncedFolderCleanup action.
|
32
|
-
# NOTE: Unfortunately
|
33
|
-
# other's machines
|
32
|
+
# NOTE: Unfortunately Vagrant providers have no way to know about each
|
33
|
+
# other's machines, so there's an impact on NFS mounts for machines
|
34
|
+
# from other providers. https://github.com/mitchellh/vagrant/issues/6439
|
34
35
|
class PrepareNFSValidIds
|
35
36
|
include MixinMachineIndex
|
36
37
|
|
@@ -52,7 +52,6 @@ module VagrantPlugins
|
|
52
52
|
Timeout.timeout(env[:machine].config.vm.boot_timeout) do
|
53
53
|
while true do
|
54
54
|
begin
|
55
|
-
# TODO Is there a clean way to just invoke the built-in action?
|
56
55
|
break builtin_action_call(env)
|
57
56
|
rescue Errno::ENETUNREACH
|
58
57
|
@logger.info("Rescued Errno::ENETUNREACH and retrying original WaitForCommunicator action.")
|
@@ -38,7 +38,6 @@ module VagrantPlugins
|
|
38
38
|
uri = URI.parse(config.base_url)
|
39
39
|
@http = Net::HTTP.new(uri.host, uri.port)
|
40
40
|
|
41
|
-
#TODO:NLA Turn this on conditionally based on configuration value.
|
42
41
|
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
43
42
|
|
44
43
|
@http.use_ssl = uri.port == 443 || uri.scheme == 'https'
|
@@ -121,7 +121,6 @@ module VagrantPlugins
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def create_published_service(internal_port)
|
124
|
-
#TODO:NLA Move this into PublishedService::create! Same with other places.
|
125
124
|
begin
|
126
125
|
resp = api_client.post("#{url}/services", JSON.dump(internal_port: internal_port))
|
127
126
|
rescue Errors::OperationFailed => ex
|
@@ -22,7 +22,6 @@
|
|
22
22
|
|
23
23
|
require 'vagrant-skytap/api/resource'
|
24
24
|
|
25
|
-
#TODO:NLA Move this to another class, properly namespaced.
|
26
25
|
class PublicIpChoice
|
27
26
|
attr_reader :env, :ip, :iface, :execution
|
28
27
|
|
@@ -47,7 +46,7 @@ class PublicIpChoice
|
|
47
46
|
execution.execute
|
48
47
|
|
49
48
|
host = ip.address
|
50
|
-
port = 22
|
49
|
+
port = 22
|
51
50
|
[host, port]
|
52
51
|
end
|
53
52
|
|
@@ -22,7 +22,6 @@
|
|
22
22
|
|
23
23
|
require 'vagrant-skytap/api/resource'
|
24
24
|
|
25
|
-
#TODO:NLA Move this to another class, properly namespaced.
|
26
25
|
class PublishedServiceChoice
|
27
26
|
attr_reader :env, :iface, :service, :execution
|
28
27
|
|
@@ -48,7 +47,7 @@ class PublishedServiceChoice
|
|
48
47
|
end
|
49
48
|
|
50
49
|
def valid?
|
51
|
-
service.nil? || service.internal_port == 22
|
50
|
+
service.nil? || service.internal_port == 22
|
52
51
|
end
|
53
52
|
|
54
53
|
class ServiceExecution
|
@@ -85,7 +84,7 @@ class PublishedServiceChoice
|
|
85
84
|
end
|
86
85
|
|
87
86
|
def execute
|
88
|
-
@service = iface.create_published_service(22)
|
87
|
+
@service = iface.create_published_service(22)
|
89
88
|
end
|
90
89
|
end
|
91
90
|
end
|
@@ -24,7 +24,6 @@ require 'vagrant-skytap/util/subnet'
|
|
24
24
|
require 'vagrant-skytap/api/resource'
|
25
25
|
require 'vagrant-skytap/api/vpn_attachment'
|
26
26
|
|
27
|
-
#TODO:NLA Move this to another class, properly namespaced.
|
28
27
|
class VpnChoice
|
29
28
|
attr_reader :env, :vpn, :vm, :iface, :attachment, :execution
|
30
29
|
|
@@ -55,7 +54,7 @@ class VpnChoice
|
|
55
54
|
|
56
55
|
@iface = vm.reload.interfaces.detect{|i| i.id == iface.id }
|
57
56
|
host = iface.address_for(vpn)
|
58
|
-
port = 22
|
57
|
+
port = 22
|
59
58
|
|
60
59
|
[host, port]
|
61
60
|
end
|
@@ -20,10 +20,13 @@
|
|
20
20
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21
21
|
# DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
|
-
# We've subclassed the
|
24
|
-
# parallelization
|
25
|
-
#
|
26
|
-
#
|
23
|
+
# We've subclassed the "up" command that ships with Vagrant core to
|
24
|
+
# implement parallelization with REST calls that operate on multiple
|
25
|
+
# VMs simultaneously -- since the entire environment is locked while
|
26
|
+
# VMs are created or run, the multithreaded approach does not work.
|
27
|
+
# Unfortunately the #execute method contains a lot of duplicate code,
|
28
|
+
# when all we need to modify is the #batch block which invokes
|
29
|
+
# action_up. (See #bring_up_machines below.)
|
27
30
|
|
28
31
|
require Vagrant.source_root.join("plugins/commands/up/command")
|
29
32
|
|
@@ -93,6 +96,9 @@ module VagrantPlugins
|
|
93
96
|
names = nil if autostart && names.empty?
|
94
97
|
end
|
95
98
|
|
99
|
+
# Collect the machines first so we know what their provider
|
100
|
+
# is, and decide whether to call the Vagrant core implementation
|
101
|
+
# of this command.
|
96
102
|
with_target_vms(names, provider: options[:provider]) {|machine| machines << machine}
|
97
103
|
unless machines.first.provider_name == :skytap
|
98
104
|
@logger.debug("Calling default 'Up' implementation.")
|
@@ -1,25 +1,3 @@
|
|
1
|
-
# Copyright (c) 2014-2016 Skytap, Inc.
|
2
|
-
#
|
3
|
-
# The MIT License (MIT)
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21
|
-
# DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
# Copied from Rails ActiveSupport 2.3.18:
|
24
2
|
# activesupport-2.3.18/lib/active_support/core_ext/object/blank.rb
|
25
3
|
#
|
@@ -1,25 +1,3 @@
|
|
1
|
-
# Copyright (c) 2014-2016 Skytap, Inc.
|
2
|
-
#
|
3
|
-
# The MIT License (MIT)
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21
|
-
# DEALINGS IN THE SOFTWARE.
|
22
|
-
|
23
1
|
# Copied from Rails ActiveSupport 2.3.18:
|
24
2
|
# activesupport-2.3.18/lib/active_support/core_ext/try.rb
|
25
3
|
#
|
@@ -29,7 +29,7 @@ module VagrantPlugins
|
|
29
29
|
module CompileForwardedPorts
|
30
30
|
include Vagrant::Util::ScopedHashOverride
|
31
31
|
|
32
|
-
# This method compiles the forwarded ports into
|
32
|
+
# This method compiles the forwarded ports into [ForwardedPort]
|
33
33
|
# models.
|
34
34
|
def compile_forwarded_ports(config)
|
35
35
|
mappings = {}
|
data/lib/vagrant-skytap.rb
CHANGED
@@ -20,8 +20,6 @@
|
|
20
20
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21
21
|
# DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
|
-
# TODO:NLA To add the box initially:
|
24
|
-
# $ bundle exec vagrant box add skytap-dummy.box --provider=skytap --name=skytap-dummy
|
25
23
|
require "pathname"
|
26
24
|
|
27
25
|
require "vagrant-skytap/core_ext/object/blank"
|
@@ -23,16 +23,13 @@
|
|
23
23
|
require File.expand_path("../../base", __FILE__)
|
24
24
|
|
25
25
|
describe VagrantPlugins::Skytap::Action::ComposeEnvironment do
|
26
|
-
include_context "unit"
|
27
26
|
include_context "rest_api"
|
28
27
|
|
29
28
|
let(:app) { lambda { |env| } }
|
30
29
|
let(:env) { { machine: machine, machines: [machine], environment: environment, ui: ui, api_client: api_client } }
|
31
|
-
let(:base_url) {"http://example.com/"}
|
32
30
|
let(:provider_config) do
|
33
31
|
double(:provider_config, vm_url: "/vms/1", username: "jsmith", api_token: "123123", base_url: base_url)
|
34
32
|
end
|
35
|
-
let(:ui) { double(:ui, info: nil) }
|
36
33
|
let(:api_client) { API::Client.new(provider_config) }
|
37
34
|
|
38
35
|
let(:machine) { double(:machine, name: "vm1", id: nil, :id= => nil, provider_config: provider_config) }
|
data/spec/unit/base.rb
CHANGED
@@ -39,12 +39,6 @@ require "vagrant-skytap"
|
|
39
39
|
$:.unshift File.expand_path("../../", __FILE__)
|
40
40
|
|
41
41
|
# Load in helpers
|
42
|
-
require "unit/support/dummy_communicator"
|
43
|
-
require "unit/support/dummy_provider"
|
44
|
-
require "unit/support/shared/base_context"
|
45
|
-
require "unit/support/shared/action_synced_folders_context"
|
46
|
-
require "unit/support/shared/capability_helpers_context"
|
47
|
-
require "unit/support/shared/plugin_command_context"
|
48
42
|
require "unit/support/shared/skytap_context"
|
49
43
|
require "unit/support/shared/rest_api_context"
|
50
44
|
|
@@ -67,8 +61,7 @@ end
|
|
67
61
|
# Vagrantfile anywhere, or at least this minimizes those chances.
|
68
62
|
ENV["VAGRANT_CWD"] = Dir.mktmpdir("vagrant")
|
69
63
|
|
70
|
-
|
71
|
-
ENV["VAGRANT_DEFAULT_PROVIDER"] = "dummy"
|
64
|
+
ENV["VAGRANT_DEFAULT_PROVIDER"] = "skytap"
|
72
65
|
|
73
66
|
# Unset all host plugins so that we aren't executing subprocess things
|
74
67
|
# to detect a host for every test.
|
data/spec/unit/config_spec.rb
CHANGED
@@ -50,10 +50,6 @@ describe VagrantPlugins::Skytap::Config do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "overriding defaults" do
|
53
|
-
# I typically don't meta-program in tests, but this is a very
|
54
|
-
# simple boilerplate test, so I cut corners here. It just sets
|
55
|
-
# each of these attributes to "foo" in isolation, and reads the value
|
56
|
-
# and asserts the proper result comes back out.
|
57
53
|
[:username, :api_token, :base_url, :vm_url,
|
58
54
|
:vpn_url, :instance_ready_timeout,
|
59
55
|
:cpus, :cpuspersocket, :ram, :guestos].each do |attribute|
|
@@ -23,7 +23,6 @@
|
|
23
23
|
require_relative 'base'
|
24
24
|
|
25
25
|
describe VagrantPlugins::Skytap::API::Environment do
|
26
|
-
include_context "unit"
|
27
26
|
include_context "rest_api"
|
28
27
|
|
29
28
|
let(:json_path) { File.join(File.expand_path('..', __FILE__), 'support', 'api_responses') }
|
@@ -57,27 +56,19 @@ describe VagrantPlugins::Skytap::API::Environment do
|
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
60
|
-
let(:
|
61
|
-
|
62
|
-
env = isolated_environment
|
63
|
-
env.vagrantfile("")
|
64
|
-
env.create_vagrant_env
|
65
|
-
end
|
66
|
-
|
67
|
-
let(:machine) { iso_env.machine(iso_env.machine_names[0], :dummy) }
|
68
|
-
let(:env) {{ machine: machine }}
|
69
|
-
let(:instance) { described_class.new(attrs, env) }
|
70
|
-
|
71
|
-
let(:api_client) do
|
72
|
-
# By default, all GET requests will return an environment with VM1, VM2, and 1 network
|
73
|
-
double('api_client',
|
74
|
-
get: double('resp', body: JSON.dump(attrs))
|
75
|
-
)
|
59
|
+
let(:provider_config) do
|
60
|
+
double(:provider_config, vm_url: "/vms/1", username: "jsmith", api_token: "123123", base_url: base_url)
|
76
61
|
end
|
62
|
+
let(:api_client) { API::Client.new(provider_config) }
|
63
|
+
let(:machine) { double(:machine, name: "vm1", id: nil, :id= => nil, provider_config: provider_config) }
|
64
|
+
let(:env) { { machine: machine, api_client: api_client } }
|
65
|
+
let(:instance) { described_class.new(attrs, env) }
|
77
66
|
|
78
67
|
# Ensure tests are not affected by Skytap credential environment variables
|
79
68
|
before :each do
|
80
69
|
ENV.stub(:[] => nil)
|
70
|
+
stub_request(:get, /.*/).to_return(body: '{}', status: 200)
|
71
|
+
stub_request(:get, %r{/configurations/\d+}).to_return(body: JSON.dump(attrs), status: 200)
|
81
72
|
end
|
82
73
|
|
83
74
|
describe "check_vm_before_adding class method" do
|
@@ -176,14 +167,14 @@ describe VagrantPlugins::Skytap::API::Environment do
|
|
176
167
|
end
|
177
168
|
|
178
169
|
describe "reload" do
|
170
|
+
before do
|
171
|
+
new_attrs = attrs.merge('name' => 'Environment with 2 vms')
|
172
|
+
stub_request(:get, %r{/configurations/\d+}).to_return(body: JSON.dump(new_attrs), status: 200)
|
173
|
+
end
|
174
|
+
|
179
175
|
subject do
|
180
176
|
old_attrs = attrs_one_vm.merge('networks' => [], 'publish_sets' => [])
|
181
|
-
|
182
|
-
client = double('api_client',
|
183
|
-
get: double('resp', body: JSON.dump(new_attrs))
|
184
|
-
)
|
185
|
-
myenv = env.merge(api_client: client)
|
186
|
-
described_class.new(old_attrs, myenv)
|
177
|
+
described_class.new(old_attrs, env)
|
187
178
|
end
|
188
179
|
|
189
180
|
it "reloads the child objects" do
|