vagrantup 1.1.2 → 1.1.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 +27 -0
- data/lib/vagrant.rb +4 -3
- data/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +6 -1
- data/lib/vagrant/box_collection.rb +53 -53
- data/lib/vagrant/errors.rb +4 -0
- data/lib/vagrant/version.rb +1 -1
- data/plugins/commands/plugin/action/install_gem.rb +14 -3
- data/plugins/commands/plugin/command/install.rb +19 -0
- data/plugins/communicators/ssh/communicator.rb +3 -0
- data/plugins/communicators/ssh/plugin.rb +1 -1
- data/plugins/guests/linux/guest.rb +1 -0
- data/plugins/guests/pld/guest.rb +13 -0
- data/plugins/guests/pld/plugin.rb +15 -0
- data/plugins/providers/virtualbox/action.rb +1 -1
- data/plugins/providers/virtualbox/action/forward_ports.rb +8 -0
- data/plugins/providers/virtualbox/action/network.rb +43 -3
- data/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb +1 -1
- data/plugins/providers/virtualbox/model/forwarded_port.rb +1 -1
- data/plugins/provisioners/chef/config/chef_solo.rb +5 -2
- data/plugins/provisioners/puppet/provisioner/puppet.rb +8 -1
- data/templates/locales/en.yml +8 -0
- metadata +3 -3
- data/lib/vagrant/ssh.rb +0 -132
- data/lib/vagrant/test_helpers.rb +0 -154
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7476c603dd1783b53bf128e82fa45dd9f89951f
|
4
|
+
data.tar.gz: f246bcd4a9c768fad367044777a26aaa980624d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0fe862521f6430f0fd288a52d6a43bf44b3331c2634d3b573ca657f4a3070f1147b69dc277faa2d414c43583dd7b3086b065c4d1fbace30b17b3eb63f15081f
|
7
|
+
data.tar.gz: 1e96967e663421624d2fbe718adbc32ac48d124fd87547a2abd863010d8affc77ba8c020a2b17c556f61a902741f70e906b26d678d854e201787f2ee00897aa3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
## 1.1.3 (March 25, 2013)
|
2
|
+
|
3
|
+
IMPROVEMENTS:
|
4
|
+
|
5
|
+
- Puppet apply provisioner now retains the default module path
|
6
|
+
even while specifying custom module paths. [GH-1207]
|
7
|
+
- Re-added DHCP support for host-only networks. [GH-1466]
|
8
|
+
- Ability to specify a plugin version, plugin sources, and
|
9
|
+
pre-release versions using `--plugin-version`, `--plugin-source`,
|
10
|
+
and `--plugin-prerelease`. [GH-1461]
|
11
|
+
- Move VirtualBox guest addition checks to after the machine
|
12
|
+
boots. [GH-1179]
|
13
|
+
- Removed `Vagrant::TestHelpers` because it doesn't really work anymore.
|
14
|
+
- Add PLX linux guest support. [GH-1490]
|
15
|
+
|
16
|
+
BUG FIXES:
|
17
|
+
|
18
|
+
- Attempt to re-establish SSH connection on `Net::SSH::Disconnect`
|
19
|
+
- Allow any value that can convert to a string for `Vagrant.plugin`
|
20
|
+
- Chef solo `recipe_url` works properly again. [GH-1467]
|
21
|
+
- Port collision detection works properly in VirtualBox with
|
22
|
+
auto-corrected ports. [GH-1472]
|
23
|
+
- Fix obscure error when temp directory is world writable when
|
24
|
+
adding boxes.
|
25
|
+
- Improved error handling around network interface detection for
|
26
|
+
VirtualBox [GH-1480]
|
27
|
+
|
1
28
|
## 1.1.2 (March 18, 2013)
|
2
29
|
|
3
30
|
BUG FIXES:
|
data/lib/vagrant.rb
CHANGED
@@ -78,7 +78,6 @@ module Vagrant
|
|
78
78
|
autoload :Machine, 'vagrant/machine'
|
79
79
|
autoload :MachineState, 'vagrant/machine_state'
|
80
80
|
autoload :Plugin, 'vagrant/plugin'
|
81
|
-
autoload :TestHelpers, 'vagrant/test_helpers'
|
82
81
|
autoload :UI, 'vagrant/ui'
|
83
82
|
autoload :Util, 'vagrant/util'
|
84
83
|
|
@@ -144,11 +143,13 @@ module Vagrant
|
|
144
143
|
# Vagrant may move it to "Vagrant::Plugins::V1" and plugins will not be
|
145
144
|
# affected.
|
146
145
|
#
|
146
|
+
# @param [String] version
|
147
|
+
# @param [String] component
|
147
148
|
# @return [Class]
|
148
149
|
def self.plugin(version, component=nil)
|
149
150
|
# Build up the key and return a result
|
150
|
-
key = version.to_sym
|
151
|
-
key = [key, component.to_sym] if component
|
151
|
+
key = version.to_s.to_sym
|
152
|
+
key = [key, component.to_s.to_sym] if component
|
152
153
|
result = PLUGIN_COMPONENTS.get(key)
|
153
154
|
|
154
155
|
# If we found our component then we return that
|
@@ -32,7 +32,7 @@ module Vagrant
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def call(env)
|
35
|
-
@logger.
|
35
|
+
@logger.info("Detecting any forwarded port collisions...")
|
36
36
|
|
37
37
|
# Get the extra ports we consider in use
|
38
38
|
extra_in_use = env[:port_collision_extra_in_use] || []
|
@@ -43,6 +43,11 @@ module Vagrant
|
|
43
43
|
# Determine the handler we'll use if we have any port collisions
|
44
44
|
repair = !!env[:port_collision_repair]
|
45
45
|
|
46
|
+
# Log out some of our parameters
|
47
|
+
@logger.debug("Extra in use: #{extra_in_use.inspect}")
|
48
|
+
@logger.debug("Remap: #{remap.inspect}")
|
49
|
+
@logger.debug("Repair: #{repair.inspect}")
|
50
|
+
|
46
51
|
# Determine a list of usable ports for repair
|
47
52
|
usable_ports = Set.new(env[:machine].config.vm.usable_port_range)
|
48
53
|
usable_ports.subtract(extra_in_use)
|
@@ -96,69 +96,69 @@ module Vagrant
|
|
96
96
|
|
97
97
|
# Create a temporary directory since we're not sure at this point if
|
98
98
|
# the box we're unpackaging already exists (if no provider was given)
|
99
|
-
Dir.mktmpdir(TEMP_PREFIX)
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
temp_dir = v1_upgrade(temp_dir)
|
113
|
-
end
|
99
|
+
temp_dir = Pathname.new(Dir.mktmpdir(TEMP_PREFIX))
|
100
|
+
|
101
|
+
# Extract the box into a temporary directory.
|
102
|
+
@logger.debug("Unpacking box into temporary directory: #{temp_dir}")
|
103
|
+
result = Util::Subprocess.execute(
|
104
|
+
"bsdtar", "-v", "-x", "-C", temp_dir.to_s, "-f", path.to_s)
|
105
|
+
raise Errors::BoxUnpackageFailure, :output => result.stderr.to_s if result.exit_code != 0
|
106
|
+
|
107
|
+
# If we get a V1 box, we want to update it in place
|
108
|
+
if v1_box?(temp_dir)
|
109
|
+
@logger.debug("Added box is a V1 box. Upgrading in place.")
|
110
|
+
temp_dir = v1_upgrade(temp_dir)
|
111
|
+
end
|
114
112
|
|
115
|
-
|
116
|
-
|
117
|
-
|
113
|
+
# Get an instance of the box we just added before it is finalized
|
114
|
+
# in the system so we can inspect and use its metadata.
|
115
|
+
box = Box.new(name, provider, temp_dir)
|
118
116
|
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
# Get the provider, since we'll need that to at the least add it
|
118
|
+
# to the system or check that it matches what is given to us.
|
119
|
+
box_provider = box.metadata["provider"]
|
122
120
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
129
|
-
else
|
130
|
-
# We weren't given a provider, so store this one.
|
131
|
-
provider = box_provider.to_sym
|
132
|
-
|
133
|
-
# Verify the box doesn't already exist
|
134
|
-
check_box_exists.call(provider)
|
121
|
+
if provider
|
122
|
+
# Verify that the given provider matches what the box has.
|
123
|
+
if box_provider.to_sym != provider
|
124
|
+
@logger.error("Added box provider doesnt match expected: #{box_provider}")
|
125
|
+
raise Errors::BoxProviderDoesntMatch, :expected => provider, :actual => box_provider
|
135
126
|
end
|
127
|
+
else
|
128
|
+
# We weren't given a provider, so store this one.
|
129
|
+
provider = box_provider.to_sym
|
136
130
|
|
137
|
-
#
|
138
|
-
|
139
|
-
|
140
|
-
@logger.debug("Box directory: #{box_dir}")
|
131
|
+
# Verify the box doesn't already exist
|
132
|
+
check_box_exists.call(provider)
|
133
|
+
end
|
141
134
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
135
|
+
# Create the directory for this box, not including the provider
|
136
|
+
box_dir = @directory.join(name)
|
137
|
+
box_dir.mkpath
|
138
|
+
@logger.debug("Box directory: #{box_dir}")
|
139
|
+
|
140
|
+
# This is the final directory we'll move it to
|
141
|
+
final_dir = box_dir.join(provider.to_s)
|
142
|
+
if final_dir.exist?
|
143
|
+
@logger.debug("Removing existing provider directory...")
|
144
|
+
final_dir.rmtree
|
145
|
+
end
|
148
146
|
|
149
|
-
|
150
|
-
|
147
|
+
# Move to final destination
|
148
|
+
final_dir.mkpath
|
151
149
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
end
|
150
|
+
# Go through each child and copy them one-by-one. This avoids
|
151
|
+
# an issue where on Windows cross-device directory copies are
|
152
|
+
# failing for some reason. [GH-1424]
|
153
|
+
temp_dir.children(true).each do |f|
|
154
|
+
destination = final_dir.join(f.basename)
|
155
|
+
@logger.debug("Moving: #{f} => #{destination}")
|
156
|
+
FileUtils.mv(f, destination)
|
160
157
|
end
|
161
158
|
|
159
|
+
# Remove the temporary directory
|
160
|
+
temp_dir.rmtree
|
161
|
+
|
162
162
|
# Return the box
|
163
163
|
find(name, provider)
|
164
164
|
end
|
data/lib/vagrant/errors.rb
CHANGED
@@ -203,6 +203,10 @@ module Vagrant
|
|
203
203
|
error_key(:home_dir_not_accessible)
|
204
204
|
end
|
205
205
|
|
206
|
+
class ForwardPortAdapterNotFound < VagrantError
|
207
|
+
error_key(:forward_port_adapter_not_found)
|
208
|
+
end
|
209
|
+
|
206
210
|
class ForwardPortAutolistEmpty < VagrantError
|
207
211
|
error_key(:auto_empty, "vagrant.actions.vm.forward_ports")
|
208
212
|
end
|
data/lib/vagrant/version.rb
CHANGED
@@ -16,15 +16,26 @@ module VagrantPlugins
|
|
16
16
|
|
17
17
|
def call(env)
|
18
18
|
plugin_name = env[:plugin_name]
|
19
|
+
prerelease = env[:plugin_prerelease]
|
20
|
+
version = env[:plugin_version]
|
19
21
|
|
20
22
|
# Install the gem
|
23
|
+
plugin_name_label = plugin_name
|
24
|
+
plugin_name_label += ' --prerelease' if prerelease
|
25
|
+
plugin_name_label += " --version '#{version}'" if version
|
21
26
|
env[:ui].info(I18n.t("vagrant.commands.plugin.installing",
|
22
|
-
:name =>
|
27
|
+
:name => plugin_name_label))
|
23
28
|
installed_gems = env[:gem_helper].with_environment do
|
24
|
-
|
29
|
+
# Override the list of sources by the ones set as a parameter if given
|
30
|
+
if env[:plugin_sources]
|
31
|
+
@logger.info("Custom plugin sources: #{env[:plugin_sources]}")
|
32
|
+
Gem.sources = env[:plugin_sources]
|
33
|
+
end
|
34
|
+
|
35
|
+
installer = Gem::DependencyInstaller.new(:document => [], :prerelease => prerelease)
|
25
36
|
|
26
37
|
begin
|
27
|
-
installer.install(plugin_name)
|
38
|
+
installer.install(plugin_name, version)
|
28
39
|
rescue Gem::GemNotFoundException
|
29
40
|
raise Vagrant::Errors::PluginInstallNotFound,
|
30
41
|
:name => plugin_name
|
@@ -17,6 +17,22 @@ module VagrantPlugins
|
|
17
17
|
"The name of the entry point file for loading the plugin.") do |entry_point|
|
18
18
|
options[:entry_point] = entry_point
|
19
19
|
end
|
20
|
+
|
21
|
+
o.on("--plugin-prerelease",
|
22
|
+
"Allow prerelease versions of this plugin.") do |plugin_prerelease|
|
23
|
+
options[:plugin_prerelease] = plugin_prerelease
|
24
|
+
end
|
25
|
+
|
26
|
+
o.on("--plugin-source PLUGIN_SOURCE", String,
|
27
|
+
"Add a RubyGems repository source") do |plugin_source|
|
28
|
+
options[:plugin_sources] ||= []
|
29
|
+
options[:plugin_sources] << plugin_source
|
30
|
+
end
|
31
|
+
|
32
|
+
o.on("--plugin-version PLUGIN_VERSION", String,
|
33
|
+
"Install a specific version of the plugin") do |plugin_version|
|
34
|
+
options[:plugin_version] = plugin_version
|
35
|
+
end
|
20
36
|
end
|
21
37
|
|
22
38
|
# Parse the options
|
@@ -27,6 +43,9 @@ module VagrantPlugins
|
|
27
43
|
# Install the gem
|
28
44
|
action(Action.action_install, {
|
29
45
|
:plugin_entry_point => options[:entry_point],
|
46
|
+
:plugin_prerelease => options[:plugin_prerelease],
|
47
|
+
:plugin_version => options[:plugin_version],
|
48
|
+
:plugin_sources => options[:plugin_sources],
|
30
49
|
:plugin_name => argv[0]
|
31
50
|
})
|
32
51
|
|
@@ -129,6 +129,9 @@ module VagrantPlugins
|
|
129
129
|
rescue Errno::EHOSTUNREACH
|
130
130
|
@logger.info("No route to host for connection. Not re-using.")
|
131
131
|
@connection = nil
|
132
|
+
rescue Net::SSH::Disconnect
|
133
|
+
@logger.info("SSH disconnected. Not-reusing connection.")
|
134
|
+
@connection = nil
|
132
135
|
rescue IOError
|
133
136
|
@logger.info("Connection has been closed. Not re-using.")
|
134
137
|
@connection = nil
|
@@ -3,7 +3,7 @@ require "vagrant"
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module CommunicatorSSH
|
5
5
|
class Plugin < Vagrant.plugin("2")
|
6
|
-
name "ssh
|
6
|
+
name "ssh communicator"
|
7
7
|
description <<-DESC
|
8
8
|
This plugin allows Vagrant to communicate with remote machines using
|
9
9
|
SSH as the underlying protocol, powered internally by Ruby's
|
@@ -29,6 +29,7 @@ module VagrantPlugins
|
|
29
29
|
return :fedora if comm.test("grep 'Fedora release 1[678]' /etc/redhat-release")
|
30
30
|
return :redhat if comm.test("cat /etc/redhat-release")
|
31
31
|
return :suse if comm.test("cat /etc/SuSE-release")
|
32
|
+
return :pld if comm.test("cat /etc/pld-release")
|
32
33
|
return :arch if comm.test("cat /etc/arch-release")
|
33
34
|
return :solaris if comm.test("grep 'Solaris' /etc/release")
|
34
35
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
require Vagrant.source_root.join("plugins/guests/redhat/guest")
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module GuestPld
|
7
|
+
class Guest < VagrantPlugins::GuestRedHat::Guest
|
8
|
+
def network_scripts_dir
|
9
|
+
'/etc/sysconfig/interfaces/'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestPld
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
name "PLD Linux guest"
|
7
|
+
description "PLD Linux guest support."
|
8
|
+
|
9
|
+
guest("pld") do
|
10
|
+
require File.expand_path("../guest", __FILE__)
|
11
|
+
Guest
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -71,6 +71,7 @@ module VagrantPlugins
|
|
71
71
|
b.use SaneDefaults
|
72
72
|
b.use Customize
|
73
73
|
b.use Boot
|
74
|
+
b.use CheckGuestAdditions
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|
@@ -296,7 +297,6 @@ module VagrantPlugins
|
|
296
297
|
b2.use CheckAccessible
|
297
298
|
b2.use HandleBoxUrl
|
298
299
|
b2.use Import
|
299
|
-
b2.use CheckGuestAdditions
|
300
300
|
b2.use MatchMACAddress
|
301
301
|
end
|
302
302
|
end
|
@@ -50,6 +50,14 @@ module VagrantPlugins
|
|
50
50
|
@env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry",
|
51
51
|
message_attributes))
|
52
52
|
|
53
|
+
# Verify we have the network interface to attach to
|
54
|
+
if !interfaces[fp.adapter]
|
55
|
+
raise Vagrant::Errors::ForwardPortAdapterNotFound,
|
56
|
+
:adapter => fp.adapter.to_s,
|
57
|
+
:guest => fp.guest_port.to_s,
|
58
|
+
:host => fp.host_port.to_s
|
59
|
+
end
|
60
|
+
|
53
61
|
# Port forwarding requires the network interface to be a NAT interface,
|
54
62
|
# so verify that that is the case.
|
55
63
|
if interfaces[fp.adapter][:type] != :nat
|
@@ -209,9 +209,13 @@ module VagrantPlugins
|
|
209
209
|
def hostonly_config(options)
|
210
210
|
options = {
|
211
211
|
:auto_config => true,
|
212
|
-
:netmask => "255.255.255.0"
|
212
|
+
:netmask => "255.255.255.0",
|
213
|
+
:type => :static
|
213
214
|
}.merge(options)
|
214
215
|
|
216
|
+
# Default IP is in the 20-bit private network block for DHCP based networks
|
217
|
+
options[:ip] = "172.28.128.1" if options[:type] == :dhcp
|
218
|
+
|
215
219
|
# Calculate our network address for the given IP/netmask
|
216
220
|
netaddr = network_address(options[:ip], options[:netmask])
|
217
221
|
|
@@ -237,6 +241,24 @@ module VagrantPlugins
|
|
237
241
|
adapter_ip[3] += 1
|
238
242
|
options[:adapter_ip] ||= adapter_ip.join(".")
|
239
243
|
|
244
|
+
dhcp_options = {}
|
245
|
+
if options[:type] == :dhcp
|
246
|
+
# Calculate the DHCP server IP, which is the network address
|
247
|
+
# with the final octet + 2. So "172.28.0.0" turns into "172.28.0.2"
|
248
|
+
dhcp_ip = ip_parts.dup
|
249
|
+
dhcp_ip[3] += 2
|
250
|
+
dhcp_options[:dhcp_ip] ||= dhcp_ip.join(".")
|
251
|
+
|
252
|
+
# Calculate the lower and upper bound for the DHCP server
|
253
|
+
dhcp_lower = ip_parts.dup
|
254
|
+
dhcp_lower[3] += 3
|
255
|
+
dhcp_options[:dhcp_lower] ||= dhcp_lower.join(".")
|
256
|
+
|
257
|
+
dhcp_upper = ip_parts.dup
|
258
|
+
dhcp_upper[3] = 254
|
259
|
+
dhcp_options[:dhcp_upper] ||= dhcp_upper.join(".")
|
260
|
+
end
|
261
|
+
|
240
262
|
return {
|
241
263
|
:adapter_ip => options[:adapter_ip],
|
242
264
|
:auto_config => options[:auto_config],
|
@@ -244,8 +266,8 @@ module VagrantPlugins
|
|
244
266
|
:mac => nil,
|
245
267
|
:netmask => options[:netmask],
|
246
268
|
:nic_type => nil,
|
247
|
-
:type => :
|
248
|
-
}
|
269
|
+
:type => options[:type]
|
270
|
+
}.merge(dhcp_options)
|
249
271
|
end
|
250
272
|
|
251
273
|
def hostonly_adapter(config)
|
@@ -266,6 +288,24 @@ module VagrantPlugins
|
|
266
288
|
@logger.info("Created network: #{interface[:name]}")
|
267
289
|
end
|
268
290
|
|
291
|
+
if config[:type] == :dhcp
|
292
|
+
# Check that if there is a DHCP server attached on our interface,
|
293
|
+
# then it is identical. Otherwise, we can't set it.
|
294
|
+
if interface[:dhcp]
|
295
|
+
valid = interface[:dhcp][:ip] == config[:dhcp_ip] &&
|
296
|
+
interface[:dhcp][:lower] == config[:dhcp_lower] &&
|
297
|
+
interface[:dhcp][:upper] == config[:dhcp_upper]
|
298
|
+
|
299
|
+
raise Errors::NetworkDHCPAlreadyAttached if !valid
|
300
|
+
|
301
|
+
@logger.debug("DHCP server already properly configured")
|
302
|
+
else
|
303
|
+
# Configure the DHCP server for the network.
|
304
|
+
@logger.debug("Creating a DHCP server...")
|
305
|
+
@env[:machine].provider.driver.create_dhcp_server(interface[:name], config)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
269
309
|
return {
|
270
310
|
:adapter => config[:adapter],
|
271
311
|
:hostonly => interface[:name],
|
@@ -42,7 +42,7 @@ module VagrantPlugins
|
|
42
42
|
options ||= {}
|
43
43
|
@auto_correct = true
|
44
44
|
@auto_correct = options[:auto_correct] if options.has_key?(:auto_correct)
|
45
|
-
@adapter = options[:adapter] || 1
|
45
|
+
@adapter = options[:adapter].to_i || 1
|
46
46
|
@protocol = options[:protocol] || "tcp"
|
47
47
|
end
|
48
48
|
|
@@ -27,8 +27,12 @@ module VagrantPlugins
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def finalize!
|
30
|
+
@recipe_url = nil if @recipe_url == UNSET_VALUE
|
31
|
+
|
30
32
|
if @cookbooks_path == UNSET_VALUE
|
31
|
-
@cookbooks_path = [
|
33
|
+
@cookbooks_path = []
|
34
|
+
@cookbooks_path << [:host, "cookbooks"] if !@recipe_url
|
35
|
+
@cookbooks_path << [:vm, "cookbooks"]
|
32
36
|
@__defaulted_cookbooks_path = true
|
33
37
|
end
|
34
38
|
|
@@ -45,7 +49,6 @@ module VagrantPlugins
|
|
45
49
|
@encrypted_data_bag_secret_key_path = nil if \
|
46
50
|
@encrypted_data_bag_secret_key_path == UNSET_VALUE
|
47
51
|
@nfs = false if @nfs == UNSET_VALUE
|
48
|
-
@recipe_url = nil if @recipe_url == UNSET_VALUE
|
49
52
|
end
|
50
53
|
|
51
54
|
def validate(machine)
|
@@ -70,7 +70,14 @@ module VagrantPlugins
|
|
70
70
|
def run_puppet_apply
|
71
71
|
options = [config.options].flatten
|
72
72
|
module_paths = @module_paths.map { |_, to| to }
|
73
|
-
|
73
|
+
if !@module_paths.empty?
|
74
|
+
# Prepend the default module path
|
75
|
+
module_paths.unshift("/etc/puppet/modules")
|
76
|
+
|
77
|
+
# Add the command line switch to add the module path
|
78
|
+
options << "--modulepath '#{module_paths.join(':')}'"
|
79
|
+
end
|
80
|
+
|
74
81
|
options << @manifest_file
|
75
82
|
options = options.join(" ")
|
76
83
|
|
data/templates/locales/en.yml
CHANGED
@@ -130,6 +130,14 @@ en:
|
|
130
130
|
may run at any given time to avoid problems with VirtualBox inconsistencies
|
131
131
|
occurring. Please wait for the other instance of Vagrant to end and then
|
132
132
|
try again.
|
133
|
+
forward_port_adapter_not_found: |-
|
134
|
+
The adapter to attach a forwarded port to was not found. Please
|
135
|
+
verify that the given adapter is setup on the machine as a NAT
|
136
|
+
interface.
|
137
|
+
|
138
|
+
Host port: %{host}
|
139
|
+
Guest port: %{guest}
|
140
|
+
Adapter: %{adapter}
|
133
141
|
gem_command_in_bundler: |-
|
134
142
|
You cannot run the `vagrant plugin` command while in a bundler environment.
|
135
143
|
This should generally never happen unless Vagrant is installed outside
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrantup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchell Hashimoto
|
@@ -304,8 +304,6 @@ files:
|
|
304
304
|
- lib/vagrant/plugin/v2.rb
|
305
305
|
- lib/vagrant/plugin.rb
|
306
306
|
- lib/vagrant/registry.rb
|
307
|
-
- lib/vagrant/ssh.rb
|
308
|
-
- lib/vagrant/test_helpers.rb
|
309
307
|
- lib/vagrant/ui.rb
|
310
308
|
- lib/vagrant/util/ansi_escape_code_remover.rb
|
311
309
|
- lib/vagrant/util/busy.rb
|
@@ -396,6 +394,8 @@ files:
|
|
396
394
|
- plugins/guests/linux/plugin.rb
|
397
395
|
- plugins/guests/openbsd/guest.rb
|
398
396
|
- plugins/guests/openbsd/plugin.rb
|
397
|
+
- plugins/guests/pld/guest.rb
|
398
|
+
- plugins/guests/pld/plugin.rb
|
399
399
|
- plugins/guests/redhat/guest.rb
|
400
400
|
- plugins/guests/redhat/plugin.rb
|
401
401
|
- plugins/guests/solaris/config.rb
|
data/lib/vagrant/ssh.rb
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'log4r'
|
2
|
-
|
3
|
-
require 'vagrant/util/file_util'
|
4
|
-
require 'vagrant/util/file_mode'
|
5
|
-
require 'vagrant/util/platform'
|
6
|
-
require 'vagrant/util/safe_exec'
|
7
|
-
|
8
|
-
module Vagrant
|
9
|
-
# Manages SSH connection information as well as allows opening an
|
10
|
-
# SSH connection.
|
11
|
-
class SSH
|
12
|
-
include Util::SafeExec
|
13
|
-
|
14
|
-
def initialize(vm)
|
15
|
-
@vm = vm
|
16
|
-
@logger = Log4r::Logger.new("vagrant::ssh")
|
17
|
-
end
|
18
|
-
|
19
|
-
# Returns a hash of information necessary for accessing this
|
20
|
-
# virtual machine via SSH.
|
21
|
-
#
|
22
|
-
# @return [Hash]
|
23
|
-
def info
|
24
|
-
results = {
|
25
|
-
:host => @vm.config.ssh.host,
|
26
|
-
:port => @vm.config.ssh.port || @vm.driver.ssh_port(@vm.config.ssh.guest_port),
|
27
|
-
:username => @vm.config.ssh.username,
|
28
|
-
:forward_agent => @vm.config.ssh.forward_agent,
|
29
|
-
:forward_x11 => @vm.config.ssh.forward_x11
|
30
|
-
}
|
31
|
-
|
32
|
-
# This can happen if no port is set and for some reason Vagrant
|
33
|
-
# can't detect an SSH port.
|
34
|
-
raise Errors::SSHPortNotDetected if !results[:port]
|
35
|
-
|
36
|
-
# Determine the private key path, which is either set by the
|
37
|
-
# configuration or uses just the built-in insecure key.
|
38
|
-
pk_path = @vm.config.ssh.private_key_path || @vm.env.default_private_key_path
|
39
|
-
results[:private_key_path] = File.expand_path(pk_path, @vm.env.root_path)
|
40
|
-
|
41
|
-
# We need to check and fix the private key permissions
|
42
|
-
# to make sure that SSH gets a key with 0600 perms.
|
43
|
-
check_key_permissions(results[:private_key_path])
|
44
|
-
|
45
|
-
# Return the results
|
46
|
-
return results
|
47
|
-
end
|
48
|
-
|
49
|
-
# Connects to the environment's virtual machine, replacing the ruby
|
50
|
-
# process with an SSH process.
|
51
|
-
#
|
52
|
-
# @param [Hash] opts Options hash
|
53
|
-
# @options opts [Boolean] :plain_mode If True, doesn't authenticate with
|
54
|
-
# the machine, only connects, allowing the user to connect.
|
55
|
-
def exec(opts={})
|
56
|
-
# Get the SSH information and cache it here
|
57
|
-
ssh_info = info
|
58
|
-
|
59
|
-
# Ensure the platform supports ssh. On Windows there are several programs which
|
60
|
-
# include ssh, notably git, mingw and cygwin, but make sure ssh is in the path!
|
61
|
-
if !Util::FileUtil.which("ssh")
|
62
|
-
if Util::Platform.windows?
|
63
|
-
raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
|
64
|
-
:port => ssh_info[:port],
|
65
|
-
:username => ssh_info[:username],
|
66
|
-
:key_path => ssh_info[:private_key_path]
|
67
|
-
end
|
68
|
-
raise Errors::SSHUnavailable
|
69
|
-
end
|
70
|
-
|
71
|
-
# If plain mode is enabled then we don't do any authentication (we don't
|
72
|
-
# set a user or an identity file)
|
73
|
-
plain_mode = opts[:plain_mode]
|
74
|
-
|
75
|
-
options = {}
|
76
|
-
options[:host] = ssh_info[:host]
|
77
|
-
options[:port] = ssh_info[:port]
|
78
|
-
options[:username] = ssh_info[:username]
|
79
|
-
options[:private_key_path] = ssh_info[:private_key_path]
|
80
|
-
|
81
|
-
# Command line options
|
82
|
-
command_options = ["-p", options[:port].to_s, "-o", "UserKnownHostsFile=/dev/null",
|
83
|
-
"-o", "StrictHostKeyChecking=no", "-o", "LogLevel=QUIET"]
|
84
|
-
|
85
|
-
# Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option
|
86
|
-
# (Also don't use it in plain mode, it'll skip user agents.)
|
87
|
-
command_options += ["-o", "IdentitiesOnly=yes"] if !(Util::Platform.solaris? || plain_mode)
|
88
|
-
|
89
|
-
command_options += ["-i", options[:private_key_path]] if !plain_mode
|
90
|
-
command_options += ["-o", "ForwardAgent=yes"] if ssh_info[:forward_agent]
|
91
|
-
|
92
|
-
# If there are extra options, then we append those
|
93
|
-
command_options.concat(opts[:extra_args]) if opts[:extra_args]
|
94
|
-
|
95
|
-
if ssh_info[:forward_x11]
|
96
|
-
# Both are required so that no warnings are shown regarding X11
|
97
|
-
command_options += ["-o", "ForwardX11=yes"]
|
98
|
-
command_options += ["-o", "ForwardX11Trusted=yes"]
|
99
|
-
end
|
100
|
-
|
101
|
-
host_string = options[:host]
|
102
|
-
host_string = "#{options[:username]}@#{host_string}" if !plain_mode
|
103
|
-
command_options << host_string
|
104
|
-
@logger.info("Invoking SSH: #{command_options.inspect}")
|
105
|
-
safe_exec("ssh", *command_options)
|
106
|
-
end
|
107
|
-
|
108
|
-
# Checks the file permissions for a private key, resetting them
|
109
|
-
# if needed.
|
110
|
-
def check_key_permissions(key_path)
|
111
|
-
# Windows systems don't have this issue
|
112
|
-
return if Util::Platform.windows?
|
113
|
-
|
114
|
-
@logger.debug("Checking key permissions: #{key_path}")
|
115
|
-
stat = File.stat(key_path)
|
116
|
-
|
117
|
-
if stat.owned? && Util::FileMode.from_octal(stat.mode) != "600"
|
118
|
-
@logger.info("Attempting to correct key permissions to 0600")
|
119
|
-
File.chmod(0600, key_path)
|
120
|
-
|
121
|
-
stat = File.stat(key_path)
|
122
|
-
if Util::FileMode.from_octal(stat.mode) != "600"
|
123
|
-
raise Errors::SSHKeyBadPermissions, :key_path => key_path
|
124
|
-
end
|
125
|
-
end
|
126
|
-
rescue Errno::EPERM
|
127
|
-
# This shouldn't happen since we verified we own the file, but
|
128
|
-
# it is possible in theory, so we raise an error.
|
129
|
-
raise Errors::SSHKeyBadPermissions, :key_path => key_path
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
data/lib/vagrant/test_helpers.rb
DELETED
@@ -1,154 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
# Test helpers provided by Vagrant to allow for plugin developers
|
3
|
-
# to write automated tests for their code. This module simply provides
|
4
|
-
# methods which can be included into any test framework (`test/unit`,
|
5
|
-
# RSpec, Shoulda, etc.)
|
6
|
-
module TestHelpers
|
7
|
-
#------------------------------------------------------------
|
8
|
-
# Environment creation helpers
|
9
|
-
#------------------------------------------------------------
|
10
|
-
# Creates a "vagrant_app" directory in the test tmp folder
|
11
|
-
# which can be used for creating test Vagrant environments.
|
12
|
-
# Returns the root directory of the app. This typically doesn't need
|
13
|
-
# to be called directly unless you're setting up a custom application.
|
14
|
-
# See the examples for common use cases.
|
15
|
-
def vagrant_app(*path)
|
16
|
-
root = tmp_path.join("vagrant_app")
|
17
|
-
FileUtils.rm_rf(root)
|
18
|
-
FileUtils.mkdir_p(root)
|
19
|
-
root.join(*path)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Creates a Vagrantfile with the given contents in the given
|
23
|
-
# app directory. If no app directory is specified, then a default
|
24
|
-
# Vagrant app is used.
|
25
|
-
def vagrantfile(*args)
|
26
|
-
path = args.shift.join("Vagrantfile") if Pathname === args.first
|
27
|
-
path ||= vagrant_app("Vagrantfile")
|
28
|
-
|
29
|
-
# Create this box so that it exists
|
30
|
-
vagrant_box("base")
|
31
|
-
|
32
|
-
str = args.shift || ""
|
33
|
-
File.open(path.to_s, "w") do |f|
|
34
|
-
f.puts "ENV['VAGRANT_HOME'] = '#{home_path}'"
|
35
|
-
f.puts "Vagrant::Config.run do |config|"
|
36
|
-
f.puts "config.vm.base_mac = 'foo' if !config.vm.base_mac"
|
37
|
-
f.puts "config.vm.box = 'base'"
|
38
|
-
f.puts str
|
39
|
-
f.puts "end"
|
40
|
-
end
|
41
|
-
|
42
|
-
path.parent
|
43
|
-
end
|
44
|
-
|
45
|
-
# Creates and _loads_ a Vagrant environment at the given path.
|
46
|
-
# If no path is given, then a default {#vagrantfile} is used.
|
47
|
-
def vagrant_env(*args)
|
48
|
-
path = args.shift if Pathname === args.first
|
49
|
-
path ||= vagrantfile
|
50
|
-
Vagrant::Environment.new(:cwd => path).load!
|
51
|
-
end
|
52
|
-
|
53
|
-
# Creates the folder to contain a vagrant box. This allows for
|
54
|
-
# "fake" boxes to be made with the specified name.
|
55
|
-
#
|
56
|
-
# @param [String] name
|
57
|
-
# @return [Pathname]
|
58
|
-
def vagrant_box(name)
|
59
|
-
result = boxes_path.join(name)
|
60
|
-
FileUtils.mkdir_p(result)
|
61
|
-
result
|
62
|
-
end
|
63
|
-
|
64
|
-
# Returns an instantiated downloader with a mocked tempfile
|
65
|
-
# which can be passed into it.
|
66
|
-
#
|
67
|
-
# @param [Class] klass The downloader class
|
68
|
-
# @return [Array] Returns an array of `downloader` `tempfile`
|
69
|
-
def vagrant_mock_downloader(klass)
|
70
|
-
tempfile = mock("tempfile")
|
71
|
-
tempfile.stubs(:write)
|
72
|
-
|
73
|
-
_, env = action_env
|
74
|
-
[klass.new(env), tempfile]
|
75
|
-
end
|
76
|
-
|
77
|
-
# Returns a blank app (callable) and action environment with the
|
78
|
-
# given vagrant environment. This allows for testing of middlewares.
|
79
|
-
def action_env(v_env = nil)
|
80
|
-
v_env ||= vagrant_env
|
81
|
-
# duplicate the Vagrant::Environment ui and get the default vm object
|
82
|
-
# for the new action environment from the first pair in the vms list
|
83
|
-
opts = {:ui => v_env.ui.dup, :vm => v_env.vms.first.last}
|
84
|
-
app = lambda { |env| }
|
85
|
-
env = Vagrant::Action::Environment.new(opts)
|
86
|
-
env["vagrant.test"] = true
|
87
|
-
[app, env]
|
88
|
-
end
|
89
|
-
|
90
|
-
# Utility method for capturing output streams.
|
91
|
-
# @example Evaluate the output
|
92
|
-
# output = capture(:stdout){ env.cli("foo") }
|
93
|
-
# assert_equal "bar", output
|
94
|
-
# @example Silence the output
|
95
|
-
# silence(:stdout){ env.cli("init") }
|
96
|
-
# @param [:stdout, :stderr] stream The stream to capture
|
97
|
-
# @yieldreturn String
|
98
|
-
# @see https://github.com/wycats/thor/blob/master/spec/spec_helper.rb
|
99
|
-
def capture(stream)
|
100
|
-
begin
|
101
|
-
stream = stream.to_s
|
102
|
-
eval "$#{stream} = StringIO.new"
|
103
|
-
yield
|
104
|
-
result = eval("$#{stream}").string
|
105
|
-
ensure
|
106
|
-
eval("$#{stream} = #{stream.upcase}")
|
107
|
-
end
|
108
|
-
|
109
|
-
result
|
110
|
-
end
|
111
|
-
alias :silence :capture
|
112
|
-
|
113
|
-
#------------------------------------------------------------
|
114
|
-
# Path helpers
|
115
|
-
#------------------------------------------------------------
|
116
|
-
# Path to the tmp directory for the tests.
|
117
|
-
#
|
118
|
-
# @return [Pathname]
|
119
|
-
def tmp_path
|
120
|
-
result = Vagrant.source_root.join("test", "tmp")
|
121
|
-
FileUtils.mkdir_p(result)
|
122
|
-
result
|
123
|
-
end
|
124
|
-
|
125
|
-
# Path to the "home" directory for the tests
|
126
|
-
#
|
127
|
-
# @return [Pathname]
|
128
|
-
def home_path
|
129
|
-
result = tmp_path.join("home")
|
130
|
-
FileUtils.mkdir_p(result)
|
131
|
-
result
|
132
|
-
end
|
133
|
-
|
134
|
-
# Path to the boxes directory in the home directory
|
135
|
-
#
|
136
|
-
# @return [Pathname]
|
137
|
-
def boxes_path
|
138
|
-
result = home_path.join("boxes")
|
139
|
-
FileUtils.mkdir_p(result)
|
140
|
-
result
|
141
|
-
end
|
142
|
-
|
143
|
-
# Cleans all the test temp paths, which includes the boxes path,
|
144
|
-
# home path, etc. This allows for cleaning between tests.
|
145
|
-
def clean_paths
|
146
|
-
FileUtils.rm_rf(tmp_path)
|
147
|
-
|
148
|
-
# Call these methods only to rebuild the directories
|
149
|
-
tmp_path
|
150
|
-
home_path
|
151
|
-
boxes_path
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|