Merge pull request #3885 from kalmanh/symbols_syntax_19
Change symbols inside hashes to 1.9 JSON-like syntax
This commit is contained in:
commit
73fd9aa84e
2
Rakefile
2
Rakefile
|
@ -15,4 +15,4 @@ Dir["#{task_dir}/**/*.rake"].each do |task_file|
|
|||
load task_file
|
||||
end
|
||||
|
||||
task :default => "test:unit"
|
||||
task default: "test:unit"
|
||||
|
|
|
@ -185,7 +185,7 @@ rescue Exception => e
|
|||
logger.error(e.backtrace.join("\n"))
|
||||
|
||||
if env
|
||||
opts = { :prefix => false }
|
||||
opts = { prefix: false }
|
||||
env.ui.error e.message, opts if e.message
|
||||
env.ui.machine("error-exit", e.class.to_s, e.message.to_s)
|
||||
else
|
||||
|
|
|
@ -102,9 +102,9 @@ module Vagrant
|
|||
end
|
||||
|
||||
env[:ui].info(I18n.t("vagrant.commands.box.removing",
|
||||
:name => box.name,
|
||||
:provider => box.provider,
|
||||
:version => box.version))
|
||||
name: box.name,
|
||||
provider: box.provider,
|
||||
version: box.version))
|
||||
box.destroy!
|
||||
|
||||
# Passes on the removed box to the rest of the middleware chain
|
||||
|
|
|
@ -16,9 +16,9 @@ module Vagrant
|
|||
|
||||
if errors && !errors.empty?
|
||||
raise Errors::ConfigInvalid,
|
||||
:errors => Util::TemplateRenderer.render(
|
||||
errors: Util::TemplateRenderer.render(
|
||||
"config/validation_failed",
|
||||
:errors => errors)
|
||||
errors: errors)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Vagrant
|
|||
def initialize(app, env)
|
||||
force_key = :force_confirm_destroy
|
||||
message = I18n.t("vagrant.commands.destroy.confirmation",
|
||||
:name => env[:machine].name)
|
||||
name: env[:machine].name)
|
||||
|
||||
super(app, env, message, force_key, allowed: ["y", "n", "Y", "N"])
|
||||
end
|
||||
|
|
|
@ -111,8 +111,8 @@ module Vagrant
|
|||
if in_use
|
||||
if !repair || !options[:auto_correct]
|
||||
raise Errors::ForwardPortCollision,
|
||||
:guest_port => guest_port.to_s,
|
||||
:host_port => host_port.to_s
|
||||
guest_port: guest_port.to_s,
|
||||
host_port: host_port.to_s
|
||||
end
|
||||
|
||||
@logger.info("Attempting to repair FP collision: #{host_port}")
|
||||
|
@ -139,9 +139,9 @@ module Vagrant
|
|||
# If we have no usable ports then we can't repair
|
||||
if !repaired_port && usable_ports.empty?
|
||||
raise Errors::ForwardPortAutolistEmpty,
|
||||
:vm_name => env[:machine].name,
|
||||
:guest_port => guest_port.to_s,
|
||||
:host_port => host_port.to_s
|
||||
vm_name: env[:machine].name,
|
||||
guest_port: guest_port.to_s,
|
||||
host_port: host_port.to_s
|
||||
end
|
||||
|
||||
# Modify the args in place
|
||||
|
@ -151,9 +151,9 @@ module Vagrant
|
|||
|
||||
# Notify the user
|
||||
env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.fixed_collision",
|
||||
:host_port => host_port.to_s,
|
||||
:guest_port => guest_port.to_s,
|
||||
:new_port => repaired_port.to_s))
|
||||
host_port: host_port.to_s,
|
||||
guest_port: guest_port.to_s,
|
||||
new_port: repaired_port.to_s))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -62,14 +62,14 @@ module Vagrant
|
|||
# We place the file in the include directory
|
||||
to = include_directory.join(dest)
|
||||
|
||||
@env[:ui].info I18n.t("vagrant.actions.general.package.packaging", :file => from)
|
||||
@env[:ui].info I18n.t("vagrant.actions.general.package.packaging", file: from)
|
||||
FileUtils.mkdir_p(to.parent)
|
||||
|
||||
# Copy direcotry contents recursively.
|
||||
if File.directory?(from)
|
||||
FileUtils.cp_r(Dir.glob(from), to.parent, :preserve => true)
|
||||
FileUtils.cp_r(Dir.glob(from), to.parent, preserve: true)
|
||||
else
|
||||
FileUtils.cp(from, to, :preserve => true)
|
||||
FileUtils.cp(from, to, preserve: true)
|
||||
end
|
||||
end
|
||||
rescue Errno::EEXIST => e
|
||||
|
@ -81,7 +81,7 @@ module Vagrant
|
|||
|
||||
# Compress the exported file into a package
|
||||
def compress
|
||||
@env[:ui].info I18n.t("vagrant.actions.general.package.compressing", :tar_path => tar_path)
|
||||
@env[:ui].info I18n.t("vagrant.actions.general.package.compressing", tar_path: tar_path)
|
||||
|
||||
# Copy over the included files
|
||||
copy_include_files
|
||||
|
|
|
@ -145,18 +145,18 @@ module Vagrant
|
|||
message += "\n#{e.backtrace.join("\n")}"
|
||||
|
||||
errors << I18n.t("vagrant.general.batch_unexpected_error",
|
||||
:machine => thread[:machine].name,
|
||||
:message => message)
|
||||
machine: thread[:machine].name,
|
||||
message: message)
|
||||
else
|
||||
errors << I18n.t("vagrant.general.batch_vagrant_error",
|
||||
:machine => thread[:machine].name,
|
||||
:message => thread[:error].message)
|
||||
machine: thread[:machine].name,
|
||||
message: thread[:error].message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if !errors.empty?
|
||||
raise Errors::BatchMultiError, :message => errors.join("\n\n")
|
||||
raise Errors::BatchMultiError, message: errors.join("\n\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ module Vagrant
|
|||
@metadata_url = opts[:metadata_url]
|
||||
|
||||
metadata_file = directory.join("metadata.json")
|
||||
raise Errors::BoxMetadataFileNotFound, :name => @name if !metadata_file.file?
|
||||
raise Errors::BoxMetadataFileNotFound, name: @name if !metadata_file.file?
|
||||
|
||||
begin
|
||||
@metadata = JSON.parse(directory.join("metadata.json").read)
|
||||
|
|
|
@ -141,7 +141,7 @@ module Vagrant
|
|||
if !found
|
||||
@logger.error("Added box provider doesnt match expected: #{log_provider}")
|
||||
raise Errors::BoxProviderDoesntMatch,
|
||||
:expected => log_provider, :actual => box_provider
|
||||
expected: log_provider, actual: box_provider
|
||||
end
|
||||
else
|
||||
# Verify the box doesn't already exist
|
||||
|
@ -400,7 +400,7 @@ module Vagrant
|
|||
if !metadata_file.file?
|
||||
metadata_file.open("w") do |f|
|
||||
f.write(JSON.generate({
|
||||
:provider => "virtualbox"
|
||||
provider: "virtualbox"
|
||||
}))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -113,7 +113,7 @@ module Vagrant
|
|||
# Bundler shouldn't attempt to get it remotely.
|
||||
with_isolated_gem do
|
||||
installer = Gem::DependencyInstaller.new(
|
||||
:document => [], :prerelease => false)
|
||||
document: [], prerelease: false)
|
||||
installer.install(path, "= #{pkg.spec.version}")
|
||||
end
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ module Vagrant
|
|||
cap_mod = capability_module(cap_name.to_sym)
|
||||
if !cap_mod
|
||||
raise Errors::CapabilityNotFound,
|
||||
:cap => cap_name.to_s,
|
||||
:host => @cap_host_chain[0][0].to_s
|
||||
cap: cap_name.to_s,
|
||||
host: @cap_host_chain[0][0].to_s
|
||||
end
|
||||
|
||||
cap_method = nil
|
||||
|
@ -101,8 +101,8 @@ module Vagrant
|
|||
cap_method = cap_mod.method(cap_name)
|
||||
rescue NameError
|
||||
raise Errors::CapabilityInvalid,
|
||||
:cap => cap_name.to_s,
|
||||
:host => @cap_host_chain[0][0].to_s
|
||||
cap: cap_name.to_s,
|
||||
host: @cap_host_chain[0][0].to_s
|
||||
end
|
||||
|
||||
args = @cap_args + args
|
||||
|
|
|
@ -90,7 +90,7 @@ module Vagrant
|
|||
o.separator "`vagrant list-commands`."
|
||||
end
|
||||
|
||||
@env.ui.info(opts.help, :prefix => false)
|
||||
@env.ui.info(opts.help, prefix: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -197,7 +197,7 @@ module Vagrant
|
|||
Kernel.load path
|
||||
rescue SyntaxError => e
|
||||
# Report syntax errors in a nice way.
|
||||
raise Errors::VagrantfileSyntaxError, :file => e.message
|
||||
raise Errors::VagrantfileSyntaxError, file: e.message
|
||||
rescue SystemExit
|
||||
# Continue raising that exception...
|
||||
raise
|
||||
|
@ -211,8 +211,8 @@ module Vagrant
|
|||
|
||||
# Report the generic exception
|
||||
raise Errors::VagrantfileLoadError,
|
||||
:path => path,
|
||||
:message => e.message
|
||||
path: path,
|
||||
message: e.message
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -130,7 +130,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
old.__internal_state["missing_key_calls"].to_a.sort.each do |key|
|
||||
warnings << I18n.t("vagrant.config.loader.bad_v1_key", :key => key)
|
||||
warnings << I18n.t("vagrant.config.loader.bad_v1_key", key: key)
|
||||
end
|
||||
|
||||
[root, warnings, errors]
|
||||
|
|
|
@ -80,7 +80,7 @@ module Vagrant
|
|||
# If we have missing keys, record those as errors
|
||||
if !@missing_key_calls.empty?
|
||||
errors["Vagrant"] = @missing_key_calls.to_a.sort.map do |key|
|
||||
I18n.t("vagrant.config.root.bad_key", :key => key)
|
||||
I18n.t("vagrant.config.root.bad_key", key: key)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -70,11 +70,11 @@ module Vagrant
|
|||
# to the `Dir.pwd` (which is the cwd of the executing process).
|
||||
def initialize(opts=nil)
|
||||
opts = {
|
||||
:cwd => nil,
|
||||
:home_path => nil,
|
||||
:local_data_path => nil,
|
||||
:ui_class => nil,
|
||||
:vagrantfile_name => nil,
|
||||
cwd: nil,
|
||||
home_path: nil,
|
||||
local_data_path: nil,
|
||||
ui_class: nil,
|
||||
vagrantfile_name: nil,
|
||||
}.merge(opts || {})
|
||||
|
||||
# Set the default working directory to look for the vagrantfile
|
||||
|
@ -162,16 +162,16 @@ module Vagrant
|
|||
def action_runner
|
||||
@action_runner ||= Action::Runner.new do
|
||||
{
|
||||
:action_runner => action_runner,
|
||||
:box_collection => boxes,
|
||||
:hook => method(:hook),
|
||||
:host => host,
|
||||
:machine_index => machine_index,
|
||||
:gems_path => gems_path,
|
||||
:home_path => home_path,
|
||||
:root_path => root_path,
|
||||
:tmp_path => tmp_path,
|
||||
:ui => @ui
|
||||
action_runner: action_runner,
|
||||
box_collection: boxes,
|
||||
hook: method(:hook),
|
||||
host: host,
|
||||
machine_index: machine_index,
|
||||
gems_path: gems_path,
|
||||
home_path: home_path,
|
||||
root_path: root_path,
|
||||
tmp_path: tmp_path,
|
||||
ui: @ui
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -604,7 +604,7 @@ module Vagrant
|
|||
@logger.info("Creating: #{dir}")
|
||||
FileUtils.mkdir_p(dir)
|
||||
rescue Errno::EACCES
|
||||
raise Errors::HomeDirectoryNotAccessible, :home_path => @home_path.to_s
|
||||
raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -686,7 +686,7 @@ module Vagrant
|
|||
FileUtils.mkdir_p(@local_data_path)
|
||||
rescue Errno::EACCES
|
||||
raise Errors::LocalDataDirectoryNotAccessible,
|
||||
:local_data_path => @local_data_path.to_s
|
||||
local_data_path: @local_data_path.to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -710,8 +710,8 @@ module Vagrant
|
|||
FileUtils.cp(source, destination)
|
||||
rescue Errno::EACCES
|
||||
raise Errors::CopyPrivateKeyFailed,
|
||||
:source => source,
|
||||
:destination => destination
|
||||
source: source,
|
||||
destination: destination
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -779,7 +779,7 @@ module Vagrant
|
|||
# The file could've been tampered with since Vagrant 1.0.x is
|
||||
# supposed to ensure that the contents are valid JSON. Show an error.
|
||||
raise Errors::DotfileUpgradeJSONError,
|
||||
:state_file => path.to_s
|
||||
state_file: path.to_s
|
||||
end
|
||||
|
||||
# Alright, let's upgrade this guy to the new structure. Start by
|
||||
|
@ -810,7 +810,7 @@ module Vagrant
|
|||
|
||||
# Upgrade complete! Let the user know
|
||||
@ui.info(I18n.t("vagrant.general.upgraded_v1_dotfile",
|
||||
:backup_path => backup_file.to_s))
|
||||
backup_path: backup_file.to_s))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -166,8 +166,8 @@ module Vagrant
|
|||
# must be raised.
|
||||
if callable.nil?
|
||||
raise Errors::UnimplementedProviderAction,
|
||||
:action => name,
|
||||
:provider => @provider.to_s
|
||||
action: name,
|
||||
provider: @provider.to_s
|
||||
end
|
||||
|
||||
action_raw(name, callable, extra_env)
|
||||
|
@ -347,10 +347,10 @@ module Vagrant
|
|||
# not documented here:
|
||||
#
|
||||
# {
|
||||
# :host => "1.2.3.4",
|
||||
# :port => "22",
|
||||
# :username => "mitchellh",
|
||||
# :private_key_path => "/path/to/my/key"
|
||||
# host: "1.2.3.4",
|
||||
# port: "22",
|
||||
# username: "mitchellh",
|
||||
# private_key_path: "/path/to/my/key"
|
||||
# }
|
||||
#
|
||||
# Note that Vagrant makes no guarantee that this info works or is
|
||||
|
|
|
@ -14,7 +14,7 @@ module Vagrant
|
|||
@data = JSON.parse(@path.read)
|
||||
rescue JSON::ParserError => e
|
||||
raise Vagrant::Errors::PluginStateFileParseError,
|
||||
:path => path, :message => e.message
|
||||
path: path, message: e.message
|
||||
end
|
||||
|
||||
upgrade_v0! if !@data["version"]
|
||||
|
|
|
@ -51,7 +51,7 @@ module Vagrant
|
|||
opts.parse!(argv)
|
||||
return argv
|
||||
rescue OptionParser::InvalidOption
|
||||
raise Errors::CLIInvalidOptions, :help => opts.help.chomp
|
||||
raise Errors::CLIInvalidOptions, help: opts.help.chomp
|
||||
end
|
||||
|
||||
# Yields a VM for each target VM for the command.
|
||||
|
@ -91,7 +91,7 @@ module Vagrant
|
|||
else
|
||||
# String name, just look for a specific VM
|
||||
vms << @env.vms[name.to_sym]
|
||||
raise Errors::VMNotFoundError, :name => name if !vms[0]
|
||||
raise Errors::VMNotFoundError, name: name if !vms[0]
|
||||
end
|
||||
end
|
||||
else
|
||||
|
|
|
@ -40,7 +40,7 @@ module Vagrant
|
|||
# If when this method returns, the machine's state isn't "powered_off,"
|
||||
# Vagrant will proceed to forcefully shut the machine down.
|
||||
def halt
|
||||
raise BaseError, :_key => :unsupported_halt
|
||||
raise BaseError, _key: :unsupported_halt
|
||||
end
|
||||
|
||||
# Mounts a shared folder.
|
||||
|
@ -56,13 +56,13 @@ module Vagrant
|
|||
# @param [Hash] options Additional options for the shared folder
|
||||
# which can be honored.
|
||||
def mount_shared_folder(name, guestpath, options)
|
||||
raise BaseError, :_key => :unsupported_shared_folder
|
||||
raise BaseError, _key: :unsupported_shared_folder
|
||||
end
|
||||
|
||||
# Mounts a shared folder via NFS. This assumes that the exports
|
||||
# via the host are already done.
|
||||
def mount_nfs(ip, folders)
|
||||
raise BaseError, :_key => :unsupported_nfs
|
||||
raise BaseError, _key: :unsupported_nfs
|
||||
end
|
||||
|
||||
# Configures the given list of networks on the virtual machine.
|
||||
|
@ -72,19 +72,19 @@ module Vagrant
|
|||
# of the hash will be roughly the following:
|
||||
#
|
||||
# {
|
||||
# :type => :static,
|
||||
# :ip => "192.168.33.10",
|
||||
# :netmask => "255.255.255.0",
|
||||
# :interface => 1
|
||||
# type: :static,
|
||||
# ip: "192.168.33.10",
|
||||
# netmask: "255.255.255.0",
|
||||
# interface: 1
|
||||
# }
|
||||
#
|
||||
def configure_networks(networks)
|
||||
raise BaseError, :_key => :unsupported_configure_networks
|
||||
raise BaseError, _key: :unsupported_configure_networks
|
||||
end
|
||||
|
||||
# Called to change the hostname of the virtual machine.
|
||||
def change_host_name(name)
|
||||
raise BaseError, :_key => :unsupported_host_name
|
||||
raise BaseError, _key: :unsupported_host_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,10 +38,10 @@ module Vagrant
|
|||
# following:
|
||||
#
|
||||
# {
|
||||
# :host => "1.2.3.4",
|
||||
# :port => "22",
|
||||
# :username => "mitchellh",
|
||||
# :private_key_path => "/path/to/my/key"
|
||||
# host: "1.2.3.4",
|
||||
# port: "22",
|
||||
# username: "mitchellh",
|
||||
# private_key_path: "/path/to/my/key"
|
||||
# }
|
||||
#
|
||||
# **Note:** Vagrant only supports private key based authentication,
|
||||
|
|
|
@ -59,7 +59,7 @@ module Vagrant
|
|||
opts.parse!(argv)
|
||||
return argv
|
||||
rescue OptionParser::InvalidOption
|
||||
raise Errors::CLIInvalidOptions, :help => opts.help.chomp
|
||||
raise Errors::CLIInvalidOptions, help: opts.help.chomp
|
||||
end
|
||||
|
||||
# Yields a VM for each target VM for the command.
|
||||
|
@ -146,9 +146,9 @@ module Vagrant
|
|||
# We found an active machine with a provider that doesn't
|
||||
# match the requested provider. Show an error.
|
||||
raise Errors::ActiveMachineWithDifferentProvider,
|
||||
:name => active_name.to_s,
|
||||
:active_provider => active_provider.to_s,
|
||||
:requested_provider => provider_to_use.to_s
|
||||
name: active_name.to_s,
|
||||
active_provider: active_provider.to_s,
|
||||
requested_provider: provider_to_use.to_s
|
||||
else
|
||||
# Use this provider and exit out of the loop. One of the
|
||||
# invariants [for now] is that there shouldn't be machines
|
||||
|
@ -190,7 +190,7 @@ module Vagrant
|
|||
# String name, just look for a specific VM
|
||||
@logger.debug("Finding machine that match name: #{name}")
|
||||
machines << get_machine.call(name.to_sym)
|
||||
raise Errors::VMNotFoundError, :name => name if !machines[0]
|
||||
raise Errors::VMNotFoundError, name: name if !machines[0]
|
||||
end
|
||||
end
|
||||
else
|
||||
|
|
|
@ -130,7 +130,7 @@ module Vagrant
|
|||
def _detected_errors
|
||||
return [] if !@__invalid_methods || @__invalid_methods.empty?
|
||||
return [I18n.t("vagrant.config.common.bad_field",
|
||||
:fields => @__invalid_methods.to_a.sort.join(", "))]
|
||||
fields: @__invalid_methods.to_a.sort.join(", "))]
|
||||
end
|
||||
|
||||
# An internal finalize call that no subclass should override.
|
||||
|
|
|
@ -57,10 +57,10 @@ module Vagrant
|
|||
# following:
|
||||
#
|
||||
# {
|
||||
# :host => "1.2.3.4",
|
||||
# :port => "22",
|
||||
# :username => "mitchellh",
|
||||
# :private_key_path => "/path/to/my/key"
|
||||
# host: "1.2.3.4",
|
||||
# port: "22",
|
||||
# username: "mitchellh",
|
||||
# private_key_path: "/path/to/my/key"
|
||||
# }
|
||||
#
|
||||
# **Note:** Vagrant only supports private key based authentication,
|
||||
|
|
|
@ -77,8 +77,8 @@ module Vagrant
|
|||
|
||||
def __internal_state
|
||||
{
|
||||
:items => @items,
|
||||
:results_cache => @results_cache
|
||||
items: @items,
|
||||
results_cache: @results_cache
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -181,20 +181,20 @@ module Vagrant
|
|||
line = "Progress: #{progress}"
|
||||
end
|
||||
|
||||
info(line, :new_line => false)
|
||||
info(line, new_line: false)
|
||||
end
|
||||
|
||||
def clear_line
|
||||
# See: http://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
reset = "\r\033[K"
|
||||
|
||||
info(reset, :new_line => false)
|
||||
info(reset, new_line: false)
|
||||
end
|
||||
|
||||
# This method handles actually outputting a message of a given type
|
||||
# to the console.
|
||||
def say(type, message, **opts)
|
||||
defaults = { :new_line => true, :prefix => true }
|
||||
defaults = { new_line: true, prefix: true }
|
||||
opts = defaults.merge(@opts).merge(opts)
|
||||
|
||||
# Don't output if we're hiding details
|
||||
|
@ -215,7 +215,7 @@ module Vagrant
|
|||
Thread.new do
|
||||
@lock.synchronize do
|
||||
safe_puts(format_message(type, message, **opts),
|
||||
:io => channel, :printer => printer)
|
||||
io: channel, printer: printer)
|
||||
end
|
||||
end.join
|
||||
end
|
||||
|
|
|
@ -112,7 +112,7 @@ module Vagrant
|
|||
|
||||
output = "Progress: #{columns[0]}% (Rate: #{columns[11]}/s, Estimated time remaining: #{columns[10]})"
|
||||
@ui.clear_line
|
||||
@ui.detail(output, :new_line => false)
|
||||
@ui.detail(output, new_line: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -177,7 +177,7 @@ module Vagrant
|
|||
@logger.warn("Downloader exit code: #{result.exit_code}")
|
||||
parts = result.stderr.split(/\n*curl:\s+\(\d+\)\s*/, 2)
|
||||
parts[1] ||= ""
|
||||
raise Errors::DownloaderError, :message => parts[1].chomp
|
||||
raise Errors::DownloaderError, message: parts[1].chomp
|
||||
end
|
||||
|
||||
result
|
||||
|
|
|
@ -11,7 +11,7 @@ module Vagrant
|
|||
# http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/
|
||||
def retryable(opts=nil)
|
||||
logger = nil
|
||||
opts = { :tries => 1, :on => Exception }.merge(opts || {})
|
||||
opts = { tries: 1, on: Exception }.merge(opts || {})
|
||||
|
||||
begin
|
||||
return yield
|
||||
|
|
|
@ -14,8 +14,8 @@ module Vagrant
|
|||
def safe_puts(message=nil, opts=nil)
|
||||
message ||= ""
|
||||
opts = {
|
||||
:io => $stdout,
|
||||
:printer => :puts
|
||||
io: $stdout,
|
||||
printer: :puts
|
||||
}.merge(opts || {})
|
||||
|
||||
begin
|
||||
|
|
|
@ -4,16 +4,16 @@ module Vagrant
|
|||
# prefix. An example speaks best here. Imagine the following hash:
|
||||
#
|
||||
# original = {
|
||||
# :id => "foo",
|
||||
# :mitchellh__id => "bar",
|
||||
# :mitchellh__other => "foo"
|
||||
# id: "foo",
|
||||
# mitchellh__id: "bar",
|
||||
# mitchellh__other: "foo"
|
||||
# }
|
||||
#
|
||||
# scoped = scoped_hash_override(original, "mitchellh")
|
||||
#
|
||||
# scoped == {
|
||||
# :id => "bar",
|
||||
# :other => "foo"
|
||||
# id: "bar",
|
||||
# other: "foo"
|
||||
# }
|
||||
#
|
||||
module ScopedHashOverride
|
||||
|
|
|
@ -35,7 +35,7 @@ module Vagrant
|
|||
|
||||
if !stat.owned?
|
||||
# The SSH key must be owned by ourselves
|
||||
raise Errors::SSHKeyBadOwner, :key_path => key_path
|
||||
raise Errors::SSHKeyBadOwner, key_path: key_path
|
||||
end
|
||||
|
||||
if FileMode.from_octal(stat.mode) != "600"
|
||||
|
@ -45,13 +45,13 @@ module Vagrant
|
|||
# Re-stat the file to get the new mode, and verify it worked
|
||||
stat = key_path.stat
|
||||
if FileMode.from_octal(stat.mode) != "600"
|
||||
raise Errors::SSHKeyBadPermissions, :key_path => key_path
|
||||
raise Errors::SSHKeyBadPermissions, key_path: key_path
|
||||
end
|
||||
end
|
||||
rescue Errno::EPERM
|
||||
# This shouldn't happen since we verify we own the file, but
|
||||
# it is possible in theory, so we raise an error.
|
||||
raise Errors::SSHKeyBadPermissions, :key_path => key_path
|
||||
raise Errors::SSHKeyBadPermissions, key_path: key_path
|
||||
end
|
||||
|
||||
# Halts the running of this process and replaces it with a full-fledged
|
||||
|
@ -70,10 +70,10 @@ module Vagrant
|
|||
if !ssh_path
|
||||
if Platform.windows?
|
||||
raise Errors::SSHUnavailableWindows,
|
||||
:host => ssh_info[:host],
|
||||
:port => ssh_info[:port],
|
||||
:username => ssh_info[:username],
|
||||
:key_path => ssh_info[:private_key_path].join(", ")
|
||||
host: ssh_info[:host],
|
||||
port: ssh_info[:port],
|
||||
username: ssh_info[:username],
|
||||
key_path: ssh_info[:private_key_path].join(", ")
|
||||
end
|
||||
|
||||
raise Errors::SSHUnavailable
|
||||
|
@ -85,10 +85,10 @@ module Vagrant
|
|||
r = Subprocess.execute(ssh_path)
|
||||
if r.stdout.include?("PuTTY Link")
|
||||
raise Errors::SSHIsPuttyLink,
|
||||
:host => ssh_info[:host],
|
||||
:port => ssh_info[:port],
|
||||
:username => ssh_info[:username],
|
||||
:key_path => ssh_info[:private_key_path].join(", ")
|
||||
host: ssh_info[:host],
|
||||
port: ssh_info[:port],
|
||||
username: ssh_info[:username],
|
||||
key_path: ssh_info[:private_key_path].join(", ")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
# Create a dictionary to store all the output we see.
|
||||
io_data = { :stdout => "", :stderr => "" }
|
||||
io_data = { stdout: "", stderr: "" }
|
||||
|
||||
# Record the start time for timeout purposes
|
||||
start_time = Time.now.to_i
|
||||
|
|
|
@ -73,7 +73,7 @@ module Vagrant
|
|||
#
|
||||
# @return [String]
|
||||
def render_string
|
||||
Erubis::Eruby.new(template, :trim => true).result(binding)
|
||||
Erubis::Eruby.new(template, trim: true).result(binding)
|
||||
end
|
||||
|
||||
# Returns the full path to the template, taking into accoun the gem directory
|
||||
|
|
|
@ -57,8 +57,8 @@ module Vagrant
|
|||
level = config_errors.empty? ? :warn : :error
|
||||
output = Util::TemplateRenderer.render(
|
||||
"config/messages",
|
||||
:warnings => config_warnings,
|
||||
:errors => config_errors).chomp
|
||||
warnings: config_warnings,
|
||||
errors: config_errors).chomp
|
||||
env.ui.send(level, I18n.t("vagrant.general.config_upgrade_messages",
|
||||
name: name,
|
||||
output: output))
|
||||
|
@ -111,13 +111,13 @@ module Vagrant
|
|||
sub_machine = @config.vm.defined_vms[name]
|
||||
if !sub_machine
|
||||
raise Errors::MachineNotFound,
|
||||
:name => name, :provider => provider
|
||||
name: name, provider: provider
|
||||
end
|
||||
|
||||
provider_plugin = Vagrant.plugin("2").manager.providers[provider]
|
||||
if !provider_plugin
|
||||
raise Errors::ProviderNotFound,
|
||||
:machine => name, :provider => provider
|
||||
machine: name, provider: provider
|
||||
end
|
||||
|
||||
provider_cls = provider_plugin[0]
|
||||
|
|
|
@ -24,7 +24,7 @@ module VagrantPlugins
|
|||
|
||||
boxes = @env.boxes.all.sort
|
||||
if boxes.empty?
|
||||
return @env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), :prefix => false)
|
||||
return @env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), prefix: false)
|
||||
end
|
||||
|
||||
list_boxes(boxes, options[:info])
|
||||
|
|
|
@ -46,10 +46,10 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
@env.action_runner.run(Vagrant::Action.action_box_remove, {
|
||||
:box_name => argv[0],
|
||||
:box_provider => options[:provider],
|
||||
:box_version => options[:version],
|
||||
:force_confirm_box_remove => options[:force],
|
||||
box_name: argv[0],
|
||||
box_provider: options[:provider],
|
||||
box_version: options[:version],
|
||||
force_confirm_box_remove: options[:force],
|
||||
})
|
||||
|
||||
# Success, exit status 0
|
||||
|
|
|
@ -14,7 +14,7 @@ module VagrantPlugins
|
|||
# Parse the options
|
||||
argv = parse_options(opts)
|
||||
return if !argv
|
||||
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length != 3
|
||||
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length != 3
|
||||
|
||||
box_name = argv[0]
|
||||
box_provider = argv[1].to_sym
|
||||
|
|
|
@ -81,7 +81,7 @@ module VagrantPlugins
|
|||
opts.separator "For help on any individual subcommand run `vagrant box <subcommand> -h`"
|
||||
end
|
||||
|
||||
@env.ui.info(opts.help, :prefix => false)
|
||||
@env.ui.info(opts.help, prefix: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,9 +27,9 @@ module VagrantPlugins
|
|||
@logger.debug("'Destroy' each target VM...")
|
||||
declined = 0
|
||||
total = 0
|
||||
with_target_vms(argv, :reverse => true) do |vm|
|
||||
with_target_vms(argv, reverse: true) do |vm|
|
||||
action_env = vm.action(
|
||||
:destroy, :force_confirm_destroy => options[:force])
|
||||
:destroy, force_confirm_destroy: options[:force])
|
||||
|
||||
total += 1
|
||||
declined += 1 if action_env.has_key?(:force_confirm_destroy_result) &&
|
||||
|
|
|
@ -28,7 +28,7 @@ module VagrantPlugins
|
|||
|
||||
@logger.debug("Halt command: #{argv.inspect} #{options.inspect}")
|
||||
with_target_vms(argv, reverse: true) do |vm|
|
||||
vm.action(:halt, :force_halt => options[:force])
|
||||
vm.action(:halt, force_halt: options[:force])
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
|
|
|
@ -54,8 +54,8 @@ module VagrantPlugins
|
|||
|
||||
template_path = ::Vagrant.source_root.join(template)
|
||||
contents = Vagrant::Util::TemplateRenderer.render(template_path,
|
||||
:box_name => argv[0] || "base",
|
||||
:box_url => argv[1])
|
||||
box_name: argv[0] || "base",
|
||||
box_url: argv[1])
|
||||
|
||||
if save_path
|
||||
# Write out the contents
|
||||
|
|
|
@ -67,7 +67,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def package_target(name, options)
|
||||
with_target_vms(name, :single_target => true) do |vm|
|
||||
with_target_vms(name, single_target: true) do |vm|
|
||||
@logger.debug("Packaging VM: #{vm.name}")
|
||||
package_vm(vm, options)
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module VagrantPlugins
|
|||
plugin_name_label = plugin_name
|
||||
plugin_name_label += " --version '#{version}'" if version
|
||||
env[:ui].info(I18n.t("vagrant.commands.plugin.installing",
|
||||
:name => plugin_name_label))
|
||||
name: plugin_name_label))
|
||||
|
||||
manager = Vagrant::Plugin::Manager.instance
|
||||
plugin_spec = manager.install_plugin(
|
||||
|
@ -38,8 +38,8 @@ module VagrantPlugins
|
|||
|
||||
# Tell the user
|
||||
env[:ui].success(I18n.t("vagrant.commands.plugin.installed",
|
||||
:name => plugin_spec.name,
|
||||
:version => plugin_spec.version.to_s))
|
||||
name: plugin_spec.name,
|
||||
version: plugin_spec.version.to_s))
|
||||
|
||||
# If the plugin's spec includes a post-install message display it
|
||||
post_install_message = plugin_spec.post_install_message
|
||||
|
@ -49,8 +49,8 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
env[:ui].info(I18n.t("vagrant.commands.plugin.post_install",
|
||||
:name => plugin_spec.name,
|
||||
:message => post_install_message.to_s))
|
||||
name: plugin_spec.name,
|
||||
message: post_install_message.to_s))
|
||||
end
|
||||
|
||||
# Continue
|
||||
|
|
|
@ -21,8 +21,8 @@ module VagrantPlugins
|
|||
license_file = Pathname.new(env[:plugin_license_path])
|
||||
if !license_file.file?
|
||||
raise Vagrant::Errors::PluginInstallLicenseNotFound,
|
||||
:name => env[:plugin_name],
|
||||
:path => license_file.to_s
|
||||
name: env[:plugin_name],
|
||||
path: license_file.to_s
|
||||
end
|
||||
|
||||
# Copy it in.
|
||||
|
@ -30,12 +30,12 @@ module VagrantPlugins
|
|||
@logger.info("Copying license from: #{license_file}")
|
||||
@logger.info("Copying license to: #{final_path}")
|
||||
env[:ui].info(I18n.t("vagrant.commands.plugin.installing_license",
|
||||
:name => env[:plugin_name]))
|
||||
name: env[:plugin_name]))
|
||||
FileUtils.cp(license_file, final_path)
|
||||
|
||||
# Installed!
|
||||
env[:ui].success(I18n.t("vagrant.commands.plugin.installed_license",
|
||||
:name => env[:plugin_name]))
|
||||
name: env[:plugin_name]))
|
||||
|
||||
@app.call(env)
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ module VagrantPlugins
|
|||
def call(env)
|
||||
# Remove it!
|
||||
env[:ui].info(I18n.t("vagrant.commands.plugin.uninstalling",
|
||||
:name => env[:plugin_name]))
|
||||
name: env[:plugin_name]))
|
||||
|
||||
manager = Vagrant::Plugin::Manager.instance
|
||||
manager.uninstall_plugin(env[:plugin_name])
|
||||
|
|
|
@ -25,16 +25,16 @@ module VagrantPlugins
|
|||
# Parse the options
|
||||
argv = parse_options(opts)
|
||||
return if !argv
|
||||
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
|
||||
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length < 1
|
||||
|
||||
# Install the gem
|
||||
argv.each do |name|
|
||||
action(Action.action_install, {
|
||||
:plugin_entry_point => options[:entry_point],
|
||||
:plugin_version => options[:plugin_version],
|
||||
:plugin_sources => options[:plugin_sources],
|
||||
:plugin_name => name,
|
||||
:plugin_verbose => options[:verbose]
|
||||
plugin_entry_point: options[:entry_point],
|
||||
plugin_version: options[:plugin_version],
|
||||
plugin_sources: options[:plugin_sources],
|
||||
plugin_name: name,
|
||||
plugin_verbose: options[:verbose]
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ module VagrantPlugins
|
|||
# Parse the options
|
||||
argv = parse_options(opts)
|
||||
return if !argv
|
||||
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 2
|
||||
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length < 2
|
||||
|
||||
# License the plugin
|
||||
action(Action.action_license, {
|
||||
:plugin_license_path => argv[1],
|
||||
:plugin_name => argv[0]
|
||||
plugin_license_path: argv[1],
|
||||
plugin_name: argv[0]
|
||||
})
|
||||
|
||||
# Success, exit status 0
|
||||
|
|
|
@ -14,7 +14,7 @@ module VagrantPlugins
|
|||
# Parse the options
|
||||
argv = parse_options(opts)
|
||||
return if !argv
|
||||
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length > 0
|
||||
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length > 0
|
||||
|
||||
# List the installed plugins
|
||||
action(Action.action_list)
|
||||
|
|
|
@ -76,7 +76,7 @@ module VagrantPlugins
|
|||
o.separator "For help on any individual command run `vagrant plugin COMMAND -h`"
|
||||
end
|
||||
|
||||
@env.ui.info(opts.help, :prefix => false)
|
||||
@env.ui.info(opts.help, prefix: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,11 +14,11 @@ module VagrantPlugins
|
|||
# Parse the options
|
||||
argv = parse_options(opts)
|
||||
return if !argv
|
||||
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
|
||||
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length < 1
|
||||
|
||||
# Uninstall the gems
|
||||
argv.each do |gem|
|
||||
action(Action.action_uninstall, :plugin_name => gem)
|
||||
action(Action.action_uninstall, plugin_name: gem)
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
|
|
|
@ -21,7 +21,7 @@ module VagrantPlugins
|
|||
|
||||
# Update the gem
|
||||
action(Action.action_update, {
|
||||
:plugin_name => argv,
|
||||
plugin_name: argv,
|
||||
})
|
||||
|
||||
# Success, exit status 0
|
||||
|
|
|
@ -38,10 +38,10 @@ module VagrantPlugins
|
|||
return if !argv
|
||||
|
||||
# Execute the actual SSH
|
||||
with_target_vms(argv, :single_target => true) do |vm|
|
||||
with_target_vms(argv, single_target: true) do |vm|
|
||||
ssh_opts = {
|
||||
:plain_mode => options[:plain_mode],
|
||||
:extra_args => options[:ssh_args]
|
||||
plain_mode: options[:plain_mode],
|
||||
extra_args: options[:ssh_args]
|
||||
}
|
||||
|
||||
if options[:command]
|
||||
|
@ -56,7 +56,7 @@ module VagrantPlugins
|
|||
return exit_status
|
||||
else
|
||||
@logger.debug("Invoking `ssh` action on machine")
|
||||
vm.action(:ssh, :ssh_opts => ssh_opts)
|
||||
vm.action(:ssh, ssh_opts: ssh_opts)
|
||||
|
||||
# We should never reach this point, since the point of `ssh`
|
||||
# is to exec into the proper SSH shell, but we'll just return
|
||||
|
|
|
@ -33,14 +33,14 @@ module VagrantPlugins
|
|||
raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
|
||||
|
||||
variables = {
|
||||
:host_key => options[:host] || machine.name || "vagrant",
|
||||
:ssh_host => ssh_info[:host],
|
||||
:ssh_port => ssh_info[:port],
|
||||
:ssh_user => ssh_info[:username],
|
||||
:private_key_path => ssh_info[:private_key_path],
|
||||
:forward_agent => ssh_info[:forward_agent],
|
||||
:forward_x11 => ssh_info[:forward_x11],
|
||||
:proxy_command => ssh_info[:proxy_command]
|
||||
host_key: options[:host] || machine.name || "vagrant",
|
||||
ssh_host: ssh_info[:host],
|
||||
ssh_port: ssh_info[:port],
|
||||
ssh_user: ssh_info[:username],
|
||||
private_key_path: ssh_info[:private_key_path],
|
||||
forward_agent: ssh_info[:forward_agent],
|
||||
forward_x11: ssh_info[:forward_x11],
|
||||
proxy_command: ssh_info[:proxy_command]
|
||||
}
|
||||
|
||||
# Render the template and output directly to STDOUT
|
||||
|
|
|
@ -44,9 +44,9 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
@env.ui.info(I18n.t("vagrant.commands.status.output",
|
||||
:states => results.join("\n"),
|
||||
:message => message),
|
||||
:prefix => false)
|
||||
states: results.join("\n"),
|
||||
message: message),
|
||||
prefix: false)
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
|
|
|
@ -64,11 +64,11 @@ module VagrantPlugins
|
|||
end
|
||||
end
|
||||
|
||||
with_target_vms(names, :provider => options[:provider]) do |machine|
|
||||
with_target_vms(names, provider: options[:provider]) do |machine|
|
||||
@env.ui.info(I18n.t(
|
||||
"vagrant.commands.up.upping",
|
||||
:name => machine.name,
|
||||
:provider => machine.provider_name))
|
||||
name: machine.name,
|
||||
provider: machine.provider_name))
|
||||
|
||||
machines << machine
|
||||
|
||||
|
|
|
@ -162,13 +162,13 @@ module VagrantPlugins
|
|||
|
||||
def execute(command, opts=nil, &block)
|
||||
opts = {
|
||||
:error_check => true,
|
||||
:error_class => Vagrant::Errors::VagrantError,
|
||||
:error_key => :ssh_bad_exit_status,
|
||||
:good_exit => 0,
|
||||
:command => command,
|
||||
:shell => nil,
|
||||
:sudo => false,
|
||||
error_check: true,
|
||||
error_class: Vagrant::Errors::VagrantError,
|
||||
error_key: :ssh_bad_exit_status,
|
||||
good_exit: 0,
|
||||
command: command,
|
||||
shell: nil,
|
||||
sudo: false,
|
||||
}.merge(opts || {})
|
||||
|
||||
opts[:good_exit] = Array(opts[:good_exit])
|
||||
|
@ -199,9 +199,9 @@ module VagrantPlugins
|
|||
# but that makes for an ugly configuration parameter, so we
|
||||
# set it here from `error_key`
|
||||
error_opts = opts.merge(
|
||||
:_key => opts[:error_key],
|
||||
:stdout => stdout,
|
||||
:stderr => stderr
|
||||
_key: opts[:error_key],
|
||||
stdout: stdout,
|
||||
stderr: stderr
|
||||
)
|
||||
raise opts[:error_class], error_opts
|
||||
end
|
||||
|
@ -212,7 +212,7 @@ module VagrantPlugins
|
|||
|
||||
def sudo(command, opts=nil, &block)
|
||||
# Run `execute` but with the `sudo` option.
|
||||
opts = { :sudo => true }.merge(opts || {})
|
||||
opts = { sudo: true }.merge(opts || {})
|
||||
execute(command, opts, &block)
|
||||
end
|
||||
|
||||
|
@ -225,7 +225,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def test(command, opts=nil)
|
||||
opts = { :error_check => false }.merge(opts || {})
|
||||
opts = { error_check: false }.merge(opts || {})
|
||||
execute(command, opts) == 0
|
||||
end
|
||||
|
||||
|
@ -235,7 +235,7 @@ module VagrantPlugins
|
|||
scp_connect do |scp|
|
||||
if File.directory?(from)
|
||||
# Recurisvely upload directories
|
||||
scp.upload!(from, to, :recursive => true)
|
||||
scp.upload!(from, to, recursive: true)
|
||||
else
|
||||
# Open file read only to fix issue [GH-1036]
|
||||
scp.upload!(File.open(from, "r"), to)
|
||||
|
@ -289,17 +289,17 @@ module VagrantPlugins
|
|||
|
||||
# Build the options we'll use to initiate the connection via Net::SSH
|
||||
common_connect_opts = {
|
||||
:auth_methods => ["none", "publickey", "hostbased", "password"],
|
||||
:config => false,
|
||||
:forward_agent => ssh_info[:forward_agent],
|
||||
:keys => ssh_info[:private_key_path],
|
||||
:keys_only => true,
|
||||
:paranoid => false,
|
||||
:password => ssh_info[:password],
|
||||
:port => ssh_info[:port],
|
||||
:timeout => 15,
|
||||
:user_known_hosts_file => [],
|
||||
:verbose => :debug,
|
||||
auth_methods: ["none", "publickey", "hostbased", "password"],
|
||||
config: false,
|
||||
forward_agent: ssh_info[:forward_agent],
|
||||
keys: ssh_info[:private_key_path],
|
||||
keys_only: true,
|
||||
paranoid: false,
|
||||
password: ssh_info[:password],
|
||||
port: ssh_info[:port],
|
||||
timeout: 15,
|
||||
user_known_hosts_file: [],
|
||||
verbose: :debug,
|
||||
}
|
||||
|
||||
# Check that the private key permissions are valid
|
||||
|
@ -327,7 +327,7 @@ module VagrantPlugins
|
|||
timeout = 60
|
||||
|
||||
@logger.info("Attempting SSH connnection...")
|
||||
connection = retryable(:tries => opts[:retries], :on => exceptions) do
|
||||
connection = retryable(tries: opts[:retries], on: exceptions) do
|
||||
Timeout.timeout(timeout) do
|
||||
begin
|
||||
# This logger will get the Net-SSH log data for us.
|
||||
|
|
|
@ -83,7 +83,7 @@ module VagrantPlugins
|
|||
command = @cmd_filter.filter(command)
|
||||
return false if command.empty?
|
||||
|
||||
opts = { :error_check => false }.merge(opts || {})
|
||||
opts = { error_check: false }.merge(opts || {})
|
||||
execute(command, opts) == 0
|
||||
end
|
||||
|
||||
|
|
|
@ -153,9 +153,9 @@ module VagrantPlugins
|
|||
|
||||
def raise_upload_error_if_failed(out, from, to)
|
||||
raise Errors::WinRMFileTransferError,
|
||||
:from => from,
|
||||
:to => to,
|
||||
:message => out.inspect if out[:exitcode] != 0
|
||||
from: from,
|
||||
to: to,
|
||||
message: out.inspect if out[:exitcode] != 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,7 +77,7 @@ module VagrantPlugins
|
|||
protected
|
||||
|
||||
def execute_shell(command, shell=:powershell, &block)
|
||||
raise Errors::WinRMInvalidShell, :shell => shell unless [:powershell, :cmd, :wql].include?(shell)
|
||||
raise Errors::WinRMInvalidShell, shell: shell unless [:powershell, :cmd, :wql].include?(shell)
|
||||
|
||||
begin
|
||||
execute_shell_with_retry(command, shell, &block)
|
||||
|
@ -87,7 +87,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def execute_shell_with_retry(command, shell, &block)
|
||||
retryable(:tries => @max_tries, :on => @@exceptions_to_retry_on, :sleep => 10) do
|
||||
retryable(tries: @max_tries, on: @@exceptions_to_retry_on, sleep: 10) do
|
||||
@logger.debug("#{shell} executing:\n#{command}")
|
||||
output = session.send(shell, command) do |out, err|
|
||||
block.call(:stdout, out) if block_given? && out
|
||||
|
@ -102,16 +102,16 @@ module VagrantPlugins
|
|||
# If the error is a 401, we can return a more specific error message
|
||||
if winrm_exception.message.include?("401")
|
||||
raise Errors::AuthError,
|
||||
:user => @username,
|
||||
:password => @password,
|
||||
:endpoint => endpoint,
|
||||
:message => winrm_exception.message
|
||||
user: @username,
|
||||
password: @password,
|
||||
endpoint: endpoint,
|
||||
message: winrm_exception.message
|
||||
end
|
||||
|
||||
raise Errors::ExecutionError,
|
||||
:shell => shell,
|
||||
:command => command,
|
||||
:message => winrm_exception.message
|
||||
shell: shell,
|
||||
command: command,
|
||||
message: winrm_exception.message
|
||||
end
|
||||
|
||||
def new_session
|
||||
|
@ -135,12 +135,12 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def endpoint_options
|
||||
{ :user => @username,
|
||||
:pass => @password,
|
||||
:host => @host,
|
||||
:port => @port,
|
||||
:operation_timeout => @timeout_in_seconds,
|
||||
:basic_auth_only => true }
|
||||
{ user: @username,
|
||||
pass: @password,
|
||||
host: @host,
|
||||
port: @port,
|
||||
operation_timeout: @timeout_in_seconds,
|
||||
basic_auth_only: true }
|
||||
end
|
||||
end #WinShell class
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ module VagrantPlugins
|
|||
def self.configure_networks(machine, networks)
|
||||
networks.each do |network|
|
||||
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
temp = Tempfile.new("vagrant")
|
||||
temp.binmode
|
||||
|
|
|
@ -43,14 +43,14 @@ module VagrantPlugins
|
|||
primary_machine_ip = get_ip.(primary_machine)
|
||||
current_ip = get_ip.(machine)
|
||||
if current_ip == primary_machine_ip
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service", :options => {
|
||||
:my_ip => current_ip
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service", options: {
|
||||
my_ip: current_ip
|
||||
})
|
||||
else
|
||||
connection_string = "#{primary_machine_ip}:7001"
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service", :options => {
|
||||
:connection_string => connection_string,
|
||||
:my_ip => current_ip
|
||||
entry = TemplateRenderer.render("guests/coreos/etcd.service", options: {
|
||||
connection_string: connection_string,
|
||||
my_ip: current_ip
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ module VagrantPlugins
|
|||
mount_command = "mount -t nfs " +
|
||||
"-o '#{mount_opts.join(",")}' " +
|
||||
"'#{ip}:#{opts[:hostpath]}' '#{expanded_guest_path}'"
|
||||
retryable(:on => Vagrant::Errors::DarwinNFSMountFailed, :tries => 10, :sleep => 5) do
|
||||
retryable(on: Vagrant::Errors::DarwinNFSMountFailed, tries: 10, sleep: 5) do
|
||||
machine.communicate.sudo(
|
||||
mount_command,
|
||||
error_class: Vagrant::Errors::DarwinNFSMountFailed)
|
||||
|
|
|
@ -11,18 +11,18 @@ module VagrantPlugins
|
|||
def self.mount_vmware_shared_folder(machine, name, guestpath, options)
|
||||
machine.communicate.tap do |comm|
|
||||
# clear prior symlink
|
||||
if comm.test("test -L \"#{guestpath}\"", :sudo => true)
|
||||
if comm.test("test -L \"#{guestpath}\"", sudo: true)
|
||||
comm.sudo("rm \"#{guestpath}\"")
|
||||
end
|
||||
|
||||
# clear prior directory if exists
|
||||
if comm.test("test -d \"#{guestpath}\"", :sudo => true)
|
||||
if comm.test("test -d \"#{guestpath}\"", sudo: true)
|
||||
comm.sudo("rm -Rf \"#{guestpath}\"")
|
||||
end
|
||||
|
||||
# create intermediate directories if needed
|
||||
intermediate_dir = File.dirname(guestpath)
|
||||
if !comm.test("test -d \"#{intermediate_dir}\"", :sudo => true)
|
||||
if !comm.test("test -d \"#{intermediate_dir}\"", sudo: true)
|
||||
comm.sudo("mkdir -p \"#{intermediate_dir}\"")
|
||||
end
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ module VagrantPlugins
|
|||
networks.each do |network|
|
||||
interfaces.add(network[:interface])
|
||||
entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
entries << entry
|
||||
end
|
||||
|
|
|
@ -13,9 +13,9 @@ module VagrantPlugins
|
|||
comm.execute("localcli storage nfs remove -v #{volume}")
|
||||
end
|
||||
mount_command = "localcli storage nfs add -H #{ip} -s '#{opts[:hostpath]}' -v '#{volume}'"
|
||||
retryable(:on => Vagrant::Errors::LinuxNFSMountFailed, :tries => 5, :sleep => 2) do
|
||||
retryable(on: Vagrant::Errors::LinuxNFSMountFailed, tries: 5, sleep: 2) do
|
||||
comm.execute(mount_command,
|
||||
:error_class => Vagrant::Errors::LinuxNFSMountFailed)
|
||||
error_class: Vagrant::Errors::LinuxNFSMountFailed)
|
||||
end
|
||||
|
||||
# symlink vmfs volume to :guestpath
|
||||
|
|
|
@ -54,7 +54,7 @@ module VagrantPlugins
|
|||
# Render and upload the network entry file to a deterministic
|
||||
# temporary location.
|
||||
entry = TemplateRenderer.render("guests/fedora/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
temp = Tempfile.new("vagrant")
|
||||
temp.binmode
|
||||
|
@ -68,9 +68,9 @@ module VagrantPlugins
|
|||
# each specifically, we avoid reconfiguring p7p (the NAT interface) so
|
||||
# SSH never dies.
|
||||
interfaces.each do |interface|
|
||||
retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do
|
||||
retryable(on: Vagrant::Errors::VagrantError, tries: 3, sleep: 2) do
|
||||
machine.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-#{interface}")
|
||||
machine.communicate.sudo("/sbin/ifdown #{interface}", :error_check => true)
|
||||
machine.communicate.sudo("/sbin/ifdown #{interface}", error_check: true)
|
||||
machine.communicate.sudo("/sbin/ifup #{interface}")
|
||||
end
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ module VagrantPlugins
|
|||
module Cap
|
||||
class ChangeHostName
|
||||
def self.change_host_name(machine, name)
|
||||
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'", {:shell => "sh"})
|
||||
machine.communicate.sudo("sed -i '' 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf", {:shell => "sh"})
|
||||
machine.communicate.sudo("hostname #{name}", {:shell => "sh"})
|
||||
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'", {shell: "sh"})
|
||||
machine.communicate.sudo("sed -i '' 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf", {shell: "sh"})
|
||||
machine.communicate.sudo("hostname #{name}", {shell: "sh"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module VagrantPlugins
|
|||
|
||||
def self.configure_networks(machine, networks)
|
||||
# Remove any previous network additions to the configuration file.
|
||||
machine.communicate.sudo("sed -i '' -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf", {:shell => "sh"})
|
||||
machine.communicate.sudo("sed -i '' -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf", {shell: "sh"})
|
||||
|
||||
networks.each do |network|
|
||||
# Determine the interface prefix...
|
||||
|
@ -27,7 +27,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
# Write the entry to a temporary location
|
||||
temp = Tempfile.new("vagrant")
|
||||
|
@ -36,13 +36,13 @@ module VagrantPlugins
|
|||
temp.close
|
||||
|
||||
machine.communicate.upload(temp.path, "/tmp/vagrant-network-entry")
|
||||
machine.communicate.sudo("su -m root -c 'cat /tmp/vagrant-network-entry >> /etc/rc.conf'", {:shell => "sh"})
|
||||
machine.communicate.sudo("rm /tmp/vagrant-network-entry", {:shell => "sh"})
|
||||
machine.communicate.sudo("su -m root -c 'cat /tmp/vagrant-network-entry >> /etc/rc.conf'", {shell: "sh"})
|
||||
machine.communicate.sudo("rm /tmp/vagrant-network-entry", {shell: "sh"})
|
||||
|
||||
if network[:type].to_sym == :static
|
||||
machine.communicate.sudo("ifconfig #{ifname} inet #{network[:ip]} netmask #{network[:netmask]}", {:shell => "sh"})
|
||||
machine.communicate.sudo("ifconfig #{ifname} inet #{network[:ip]} netmask #{network[:netmask]}", {shell: "sh"})
|
||||
elsif network[:type].to_sym == :dhcp
|
||||
machine.communicate.sudo("dhclient #{ifname}", {:shell => "sh"})
|
||||
machine.communicate.sudo("dhclient #{ifname}", {shell: "sh"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module VagrantPlugins
|
|||
class Halt
|
||||
def self.halt(machine)
|
||||
begin
|
||||
machine.communicate.sudo("shutdown -p now", {:shell => "sh"})
|
||||
machine.communicate.sudo("shutdown -p now", {shell: "sh"})
|
||||
rescue IOError
|
||||
# Do nothing because SSH connection closed and it probably
|
||||
# means the VM just shut down really fast.
|
||||
|
|
|
@ -4,8 +4,8 @@ module VagrantPlugins
|
|||
class MountNFSFolder
|
||||
def self.mount_nfs_folder(machine, ip, folders)
|
||||
folders.each do |name, opts|
|
||||
machine.communicate.sudo("mkdir -p #{opts[:guestpath]}", {:shell => "sh"})
|
||||
machine.communicate.sudo("mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'", {:shell => "sh"})
|
||||
machine.communicate.sudo("mkdir -p #{opts[:guestpath]}", {shell: "sh"})
|
||||
machine.communicate.sudo("mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'", {shell: "sh"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
|||
# Contributed by Kenneth Vestergaard <kvs@binarysolutions.dk>
|
||||
class Guest < Vagrant.plugin("2", :guest)
|
||||
def detect?(machine)
|
||||
machine.communicate.test("uname -s | grep 'FreeBSD'", {:shell => "sh"})
|
||||
machine.communicate.test("uname -s | grep 'FreeBSD'", {shell: "sh"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module VagrantPlugins
|
|||
comm.sudo(cmd)
|
||||
ifFile = "netif.eth#{network[:interface]}"
|
||||
entry = TemplateRenderer.render("guests/funtoo/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
# Upload the entry to a temporary location
|
||||
temp = Tempfile.new("vagrant")
|
||||
temp.binmode
|
||||
|
|
|
@ -18,7 +18,7 @@ module VagrantPlugins
|
|||
# Configure each network interface
|
||||
networks.each do |network|
|
||||
entry = TemplateRenderer.render("guests/gentoo/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
# Upload the entry to a temporary location
|
||||
temp = Tempfile.new("vagrant")
|
||||
|
|
|
@ -27,9 +27,9 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
mount_command = "mount -o '#{mount_opts.join(",")}' #{ip}:'#{hostpath}' #{expanded_guest_path}"
|
||||
retryable(:on => Vagrant::Errors::LinuxNFSMountFailed, :tries => 8, :sleep => 3) do
|
||||
retryable(on: Vagrant::Errors::LinuxNFSMountFailed, tries: 8, sleep: 3) do
|
||||
machine.communicate.sudo(mount_command,
|
||||
:error_class => Vagrant::Errors::LinuxNFSMountFailed)
|
||||
error_class: Vagrant::Errors::LinuxNFSMountFailed)
|
||||
end
|
||||
|
||||
# Emit an upstart event if we can
|
||||
|
|
|
@ -4,7 +4,7 @@ module VagrantPlugins
|
|||
class ChangeHostName
|
||||
def self.change_host_name(machine, name)
|
||||
if !machine.communicate.test("hostname -s | grep '^#{name}$'")
|
||||
machine.communicate.sudo(<<CMDS, {:shell => "sh"})
|
||||
machine.communicate.sudo(<<CMDS, {shell: "sh"})
|
||||
set -e
|
||||
sed -e 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf > /tmp/rc.conf.vagrant_changehostname_#{name}
|
||||
mv /tmp/rc.conf.vagrant_changehostname_#{name} /etc/rc.conf
|
||||
|
|
|
@ -18,7 +18,7 @@ module VagrantPlugins
|
|||
|
||||
# create an interface configuration file fragment
|
||||
entry = TemplateRenderer.render("guests/netbsd/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
temp = Tempfile.new("vagrant")
|
||||
temp.binmode
|
||||
|
@ -32,8 +32,8 @@ module VagrantPlugins
|
|||
|
||||
ifname = "wm#{network[:interface]}"
|
||||
# remove old configuration
|
||||
machine.communicate.sudo("/sbin/dhcpcd -x #{ifname}", { :error_check => false })
|
||||
machine.communicate.sudo("/sbin/ifconfig #{ifname} inet delete", { :error_check => false })
|
||||
machine.communicate.sudo("/sbin/dhcpcd -x #{ifname}", { error_check: false })
|
||||
machine.communicate.sudo("/sbin/ifconfig #{ifname} inet delete", { error_check: false })
|
||||
|
||||
# live new configuration
|
||||
if network[:type].to_sym == :static
|
||||
|
|
|
@ -4,7 +4,7 @@ module VagrantPlugins
|
|||
class MountNFSFolder
|
||||
def self.mount_nfs_folder(machine, ip, folders)
|
||||
folders.each do |name, opts|
|
||||
machine.communicate.sudo(<<CMDS, {:shell => "sh"})
|
||||
machine.communicate.sudo(<<CMDS, {shell: "sh"})
|
||||
set -e
|
||||
mkdir -p #{opts[:guestpath]}
|
||||
/sbin/mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'
|
||||
|
|
|
@ -10,7 +10,7 @@ module VagrantPlugins
|
|||
|
||||
def self.change_host_name(machine, name)
|
||||
# upload the config file
|
||||
hostname_module = TemplateRenderer.render("guests/nixos/hostname", :name => name)
|
||||
hostname_module = TemplateRenderer.render("guests/nixos/hostname", name: name)
|
||||
upload(machine, hostname_module, "/etc/nixos/vagrant-hostname.nix")
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ module VagrantPlugins
|
|||
assign_device_names(machine, networks)
|
||||
|
||||
# upload the config file
|
||||
network_module = TemplateRenderer.render("guests/nixos/network", :networks => networks)
|
||||
network_module = TemplateRenderer.render("guests/nixos/network", networks: networks)
|
||||
upload(machine, network_module, "/etc/nixos/vagrant-network.nix")
|
||||
end
|
||||
|
||||
|
@ -111,9 +111,9 @@ module VagrantPlugins
|
|||
# populate the interface list
|
||||
kernel_if_names.each_index do |i|
|
||||
interfaces << {
|
||||
:kernel => kernel_if_names[i],
|
||||
:ethn => ethns[i],
|
||||
:mac_address => mac_addresses[i]
|
||||
kernel: kernel_if_names[i],
|
||||
ethn: ethns[i],
|
||||
mac_address: mac_addresses[i]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module VagrantPlugins
|
|||
def self.configure_networks(machine, networks)
|
||||
networks.each do |network|
|
||||
entry = TemplateRenderer.render("guests/openbsd/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
temp = Tempfile.new("vagrant")
|
||||
temp.binmode
|
||||
|
@ -35,8 +35,8 @@ module VagrantPlugins
|
|||
machine.communicate.sudo("mv /tmp/vagrant-network-entry /etc/hostname.#{ifname}")
|
||||
|
||||
# remove old configurations
|
||||
machine.communicate.sudo("sudo ifconfig #{ifname} inet delete", { :error_check => false })
|
||||
machine.communicate.sudo("pkill -f 'dhclient: #{ifname}'", { :error_check => false })
|
||||
machine.communicate.sudo("sudo ifconfig #{ifname} inet delete", { error_check: false })
|
||||
machine.communicate.sudo("pkill -f 'dhclient: #{ifname}'", { error_check: false })
|
||||
|
||||
if network[:type].to_sym == :static
|
||||
machine.communicate.sudo("ifconfig #{ifname} inet #{network[:ip]} netmask #{network[:netmask]}")
|
||||
|
|
|
@ -36,7 +36,7 @@ module VagrantPlugins
|
|||
# Render and upload the network entry file to a deterministic
|
||||
# temporary location.
|
||||
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
temp = Tempfile.new("vagrant")
|
||||
temp.binmode
|
||||
|
@ -50,7 +50,7 @@ module VagrantPlugins
|
|||
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
|
||||
# SSH never dies.
|
||||
interfaces.each do |interface|
|
||||
retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do
|
||||
retryable(on: Vagrant::Errors::VagrantError, tries: 3, sleep: 2) do
|
||||
# The interface should already be down so this probably
|
||||
# won't do anything, so we run it with error_check false.
|
||||
machine.communicate.sudo(
|
||||
|
|
|
@ -7,8 +7,8 @@ module VagrantPlugins
|
|||
|
||||
folders.each do |name, opts|
|
||||
machine.communicate.tap do |comm|
|
||||
comm.execute("#{sudo} mkdir -p #{opts[:guestpath]}", {:shell => "sh"})
|
||||
comm.execute("#{sudo} /usr/sbin/mount -F nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'", {:shell => "sh"})
|
||||
comm.execute("#{sudo} mkdir -p #{opts[:guestpath]}", {shell: "sh"})
|
||||
comm.execute("#{sudo} /usr/sbin/mount -F nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'", {shell: "sh"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ module VagrantPlugins
|
|||
# Render and upload the network entry file to a deterministic
|
||||
# temporary location.
|
||||
entry = TemplateRenderer.render("guests/suse/network_#{network[:type]}",
|
||||
:options => network)
|
||||
options: network)
|
||||
|
||||
temp = Tempfile.new("vagrant")
|
||||
temp.binmode
|
||||
|
@ -45,8 +45,8 @@ module VagrantPlugins
|
|||
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
|
||||
# SSH never dies.
|
||||
interfaces.each do |interface|
|
||||
retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do
|
||||
machine.communicate.sudo("/sbin/ifdown eth#{interface} 2> /dev/null", :error_check => false)
|
||||
retryable(on: Vagrant::Errors::VagrantError, tries: 3, sleep: 2) do
|
||||
machine.communicate.sudo("/sbin/ifdown eth#{interface} 2> /dev/null", error_check: false)
|
||||
machine.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-eth#{interface}")
|
||||
machine.communicate.sudo("/sbin/ifup eth#{interface} 2> /dev/null")
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ module VagrantPlugins
|
|||
# On windows, renaming a computer seems to require a reboot
|
||||
machine.communicate.execute(
|
||||
"wmic computersystem where name=\"%COMPUTERNAME%\" call rename name=\"#{name}\"",
|
||||
:shell => :cmd)
|
||||
shell: :cmd)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -66,10 +66,10 @@ module VagrantPlugins
|
|||
naked_mac = nic[:mac_address].gsub(':','')
|
||||
if driver_mac_address[naked_mac]
|
||||
vm_interface_map[driver_mac_address[naked_mac]] = {
|
||||
:net_connection_id => nic[:net_connection_id],
|
||||
:mac_address => naked_mac,
|
||||
:interface_index => nic[:interface_index],
|
||||
:index => nic[:index] }
|
||||
net_connection_id: nic[:net_connection_id],
|
||||
mac_address: naked_mac,
|
||||
interface_index: nic[:interface_index],
|
||||
index: nic[:index] }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ module VagrantPlugins
|
|||
|
||||
# Get all NICs that have a MAC address
|
||||
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394216(v=vs.85).aspx
|
||||
adapters = @communicator.execute(WQL_NET_ADAPTERS_V2, { :shell => :wql } )[:win32_network_adapter]
|
||||
adapters = @communicator.execute(WQL_NET_ADAPTERS_V2, { shell: :wql } )[:win32_network_adapter]
|
||||
@logger.debug("#{adapters.inspect}")
|
||||
return adapters
|
||||
end
|
||||
|
|
|
@ -89,10 +89,10 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
output = Vagrant::Util::TemplateRenderer.render(nfs_exports_template,
|
||||
:uuid => id,
|
||||
:ips => ips,
|
||||
:folders => dirmap,
|
||||
:user => Process.uid)
|
||||
uuid: id,
|
||||
ips: ips,
|
||||
folders: dirmap,
|
||||
user: Process.uid)
|
||||
|
||||
# The sleep ensures that the output is truly flushed before any `sudo`
|
||||
# commands are issued.
|
||||
|
|
|
@ -28,10 +28,10 @@ module VagrantPlugins
|
|||
|
||||
nfs_opts_setup(folders)
|
||||
output = Vagrant::Util::TemplateRenderer.render('nfs/exports_linux',
|
||||
:uuid => id,
|
||||
:ips => ips,
|
||||
:folders => folders,
|
||||
:user => Process.uid)
|
||||
uuid: id,
|
||||
ips: ips,
|
||||
folders: folders,
|
||||
user: Process.uid)
|
||||
|
||||
ui.info I18n.t("vagrant.hosts.linux.nfs_export")
|
||||
sleep 0.5
|
||||
|
@ -51,7 +51,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def self.nfs_installed(environment)
|
||||
retryable(:tries => 10, :on => TypeError) do
|
||||
retryable(tries: 10, on: TypeError) do
|
||||
# Check procfs to see if NFSd is a supported filesystem
|
||||
system("cat /proc/filesystems | grep nfsd > /dev/null 2>&1")
|
||||
end
|
||||
|
|
|
@ -41,14 +41,14 @@ module VagrantPlugins
|
|||
|
||||
def share_folder(name, guestpath, hostpath, opts=nil)
|
||||
@shared_folders[name] = {
|
||||
:guestpath => guestpath.to_s,
|
||||
:hostpath => hostpath.to_s,
|
||||
:create => false,
|
||||
:owner => nil,
|
||||
:group => nil,
|
||||
:nfs => false,
|
||||
:transient => false,
|
||||
:extra => nil
|
||||
guestpath: guestpath.to_s,
|
||||
hostpath: hostpath.to_s,
|
||||
create: false,
|
||||
owner: nil,
|
||||
group: nil,
|
||||
nfs: false,
|
||||
transient: false,
|
||||
extra: nil
|
||||
}.merge(opts || {})
|
||||
end
|
||||
|
||||
|
|
|
@ -551,11 +551,11 @@ module VagrantPlugins
|
|||
|
||||
if guestpath.relative? && guestpath.to_s !~ /^\w+:/
|
||||
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative",
|
||||
:path => options[:guestpath])
|
||||
path: options[:guestpath])
|
||||
else
|
||||
if used_guest_paths.include?(options[:guestpath])
|
||||
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_duplicate",
|
||||
:path => options[:guestpath])
|
||||
path: options[:guestpath])
|
||||
end
|
||||
|
||||
used_guest_paths.add(options[:guestpath])
|
||||
|
@ -563,14 +563,14 @@ module VagrantPlugins
|
|||
|
||||
if !hostpath.directory? && !options[:create]
|
||||
errors << I18n.t("vagrant.config.vm.shared_folder_hostpath_missing",
|
||||
:path => options[:hostpath])
|
||||
path: options[:hostpath])
|
||||
end
|
||||
|
||||
if options[:type] == :nfs
|
||||
if options[:owner] || options[:group]
|
||||
# Owner/group don't work with NFS
|
||||
errors << I18n.t("vagrant.config.vm.shared_folder_nfs_owner_group",
|
||||
:path => options[:hostpath])
|
||||
path: options[:hostpath])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -593,7 +593,7 @@ module VagrantPlugins
|
|||
networks.each do |type, options|
|
||||
if !valid_network_types.include?(type)
|
||||
errors << I18n.t("vagrant.config.vm.network_type_invalid",
|
||||
:type => type.to_s)
|
||||
type: type.to_s)
|
||||
end
|
||||
|
||||
if type == :forwarded_port
|
||||
|
@ -606,8 +606,8 @@ module VagrantPlugins
|
|||
key = "#{options[:protocol]}#{options[:host]}"
|
||||
if fp_used.include?(key)
|
||||
errors << I18n.t("vagrant.config.vm.network_fp_host_not_unique",
|
||||
:host => options[:host].to_s,
|
||||
:protocol => options[:protocol].to_s)
|
||||
host: options[:host].to_s,
|
||||
protocol: options[:protocol].to_s)
|
||||
end
|
||||
|
||||
fp_used.add(key)
|
||||
|
@ -647,7 +647,7 @@ module VagrantPlugins
|
|||
@provisioners.each do |vm_provisioner|
|
||||
if vm_provisioner.invalid?
|
||||
errors["vm"] << I18n.t("vagrant.config.vm.provisioner_not_found",
|
||||
:name => vm_provisioner.name)
|
||||
name: vm_provisioner.name)
|
||||
next
|
||||
end
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ module VagrantPlugins
|
|||
b3.use Call, DestroyConfirm do |env3, b4|
|
||||
if env3[:result]
|
||||
b4.use ConfigValidate
|
||||
b4.use EnvSet, :force_halt => true
|
||||
b4.use EnvSet, force_halt: true
|
||||
b4.use action_halt
|
||||
b4.use HostMachineSyncFoldersDisable
|
||||
b4.use Destroy
|
||||
|
|
|
@ -9,7 +9,7 @@ module VagrantPlugins
|
|||
class Local
|
||||
def execute(*cmd, **opts, &block)
|
||||
# Append in the options for subprocess
|
||||
cmd << { :notify => [:stdout, :stderr] }
|
||||
cmd << { notify: [:stdout, :stderr] }
|
||||
|
||||
interrupted = false
|
||||
int_callback = ->{ interrupted = true }
|
||||
|
|
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
|||
|
||||
def call(env)
|
||||
env[:ui].info I18n.t("vagrant.commands.destroy.will_not_destroy",
|
||||
:name => env[:machine].name)
|
||||
name: env[:machine].name)
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ module VagrantPlugins
|
|||
b.use SetName
|
||||
b.use ClearForwardedPorts
|
||||
b.use Provision
|
||||
b.use EnvSet, :port_collision_repair => true
|
||||
b.use EnvSet, port_collision_repair: true
|
||||
b.use PrepareForwardedPortCollisionParams
|
||||
b.use HandleForwardedPortCollisions
|
||||
b.use PrepareNFSValidIds
|
||||
|
@ -89,7 +89,7 @@ module VagrantPlugins
|
|||
b2.use Call, DestroyConfirm do |env2, b3|
|
||||
if env2[:result]
|
||||
b3.use CheckAccessible
|
||||
b3.use EnvSet, :force_halt => true
|
||||
b3.use EnvSet, force_halt: true
|
||||
b3.use action_halt
|
||||
b3.use Destroy
|
||||
b3.use CleanMachineFolder
|
||||
|
@ -206,7 +206,7 @@ module VagrantPlugins
|
|||
b.use Call, Created do |env, b2|
|
||||
if env[:result]
|
||||
b2.use CheckAccessible
|
||||
b2.use EnvSet, :port_collision_repair => false
|
||||
b2.use EnvSet, port_collision_repair: false
|
||||
b2.use PrepareForwardedPortCollisionParams
|
||||
b2.use HandleForwardedPortCollisions
|
||||
b2.use Resume
|
||||
|
|
|
@ -40,8 +40,8 @@ module VagrantPlugins
|
|||
|
||||
if guest_version != vb_version
|
||||
env[:ui].detail(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
|
||||
:guest_version => version,
|
||||
:virtualbox_version => vb_version))
|
||||
guest_version: version,
|
||||
virtualbox_version: vb_version))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ module VagrantPlugins
|
|||
adapters = []
|
||||
2.upto(env[:machine].provider.driver.max_network_adapters).each do |i|
|
||||
adapters << {
|
||||
:adapter => i,
|
||||
:type => :none
|
||||
adapter: i,
|
||||
type: :none
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ module VagrantPlugins
|
|||
processed_command + [retryable: true])
|
||||
rescue Vagrant::Errors::VBoxManageError => e
|
||||
raise Vagrant::Errors::VMCustomizationFailed, {
|
||||
:command => command,
|
||||
:error => e.inspect
|
||||
command: command,
|
||||
error: e.inspect
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,9 +38,9 @@ module VagrantPlugins
|
|||
|
||||
@env[:forwarded_ports].each do |fp|
|
||||
message_attributes = {
|
||||
:adapter => fp.adapter,
|
||||
:guest_port => fp.guest_port,
|
||||
:host_port => fp.host_port
|
||||
adapter: fp.adapter,
|
||||
guest_port: fp.guest_port,
|
||||
host_port: fp.host_port
|
||||
}
|
||||
|
||||
# Assuming the only reason to establish port forwarding is
|
||||
|
@ -53,9 +53,9 @@ module VagrantPlugins
|
|||
# Verify we have the network interface to attach to
|
||||
if !interfaces[fp.adapter]
|
||||
raise Vagrant::Errors::ForwardPortAdapterNotFound,
|
||||
:adapter => fp.adapter.to_s,
|
||||
:guest => fp.guest_port.to_s,
|
||||
:host => fp.host_port.to_s
|
||||
adapter: fp.adapter.to_s,
|
||||
guest: fp.guest_port.to_s,
|
||||
host: fp.host_port.to_s
|
||||
end
|
||||
|
||||
# Port forwarding requires the network interface to be a NAT interface,
|
||||
|
@ -68,13 +68,13 @@ module VagrantPlugins
|
|||
|
||||
# Add the options to the ports array to send to the driver later
|
||||
ports << {
|
||||
:adapter => fp.adapter,
|
||||
:guestip => fp.guest_ip,
|
||||
:guestport => fp.guest_port,
|
||||
:hostip => fp.host_ip,
|
||||
:hostport => fp.host_port,
|
||||
:name => fp.id,
|
||||
:protocol => fp.protocol
|
||||
adapter: fp.adapter,
|
||||
guestip: fp.guest_ip,
|
||||
guestport: fp.guest_port,
|
||||
hostip: fp.host_ip,
|
||||
hostport: fp.host_port,
|
||||
name: fp.id,
|
||||
protocol: fp.protocol
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
|||
|
||||
def call(env)
|
||||
env[:ui].info I18n.t("vagrant.actions.vm.import.importing",
|
||||
:name => env[:machine].box.name)
|
||||
name: env[:machine].box.name)
|
||||
|
||||
# Import the virtual machine
|
||||
ovf_file = env[:machine].box.directory.join("box.ovf").to_s
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue