Merge pull request #3885 from kalmanh/symbols_syntax_19

Change symbols inside hashes to 1.9 JSON-like syntax
This commit is contained in:
Mitchell Hashimoto 2014-05-22 10:15:26 -07:00
commit 73fd9aa84e
173 changed files with 761 additions and 761 deletions

View File

@ -15,4 +15,4 @@ Dir["#{task_dir}/**/*.rake"].each do |task_file|
load task_file load task_file
end end
task :default => "test:unit" task default: "test:unit"

View File

@ -185,7 +185,7 @@ rescue Exception => e
logger.error(e.backtrace.join("\n")) logger.error(e.backtrace.join("\n"))
if env if env
opts = { :prefix => false } opts = { prefix: false }
env.ui.error e.message, opts if e.message env.ui.error e.message, opts if e.message
env.ui.machine("error-exit", e.class.to_s, e.message.to_s) env.ui.machine("error-exit", e.class.to_s, e.message.to_s)
else else

View File

@ -102,9 +102,9 @@ module Vagrant
end end
env[:ui].info(I18n.t("vagrant.commands.box.removing", env[:ui].info(I18n.t("vagrant.commands.box.removing",
:name => box.name, name: box.name,
:provider => box.provider, provider: box.provider,
:version => box.version)) version: box.version))
box.destroy! box.destroy!
# Passes on the removed box to the rest of the middleware chain # Passes on the removed box to the rest of the middleware chain

View File

@ -16,9 +16,9 @@ module Vagrant
if errors && !errors.empty? if errors && !errors.empty?
raise Errors::ConfigInvalid, raise Errors::ConfigInvalid,
:errors => Util::TemplateRenderer.render( errors: Util::TemplateRenderer.render(
"config/validation_failed", "config/validation_failed",
:errors => errors) errors: errors)
end end
end end

View File

@ -11,7 +11,7 @@ module Vagrant
def initialize(app, env) def initialize(app, env)
force_key = :force_confirm_destroy force_key = :force_confirm_destroy
message = I18n.t("vagrant.commands.destroy.confirmation", 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"]) super(app, env, message, force_key, allowed: ["y", "n", "Y", "N"])
end end

View File

@ -111,8 +111,8 @@ module Vagrant
if in_use if in_use
if !repair || !options[:auto_correct] if !repair || !options[:auto_correct]
raise Errors::ForwardPortCollision, raise Errors::ForwardPortCollision,
:guest_port => guest_port.to_s, guest_port: guest_port.to_s,
:host_port => host_port.to_s host_port: host_port.to_s
end end
@logger.info("Attempting to repair FP collision: #{host_port}") @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 we have no usable ports then we can't repair
if !repaired_port && usable_ports.empty? if !repaired_port && usable_ports.empty?
raise Errors::ForwardPortAutolistEmpty, raise Errors::ForwardPortAutolistEmpty,
:vm_name => env[:machine].name, vm_name: env[:machine].name,
:guest_port => guest_port.to_s, guest_port: guest_port.to_s,
:host_port => host_port.to_s host_port: host_port.to_s
end end
# Modify the args in place # Modify the args in place
@ -151,9 +151,9 @@ module Vagrant
# Notify the user # Notify the user
env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.fixed_collision", env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.fixed_collision",
:host_port => host_port.to_s, host_port: host_port.to_s,
:guest_port => guest_port.to_s, guest_port: guest_port.to_s,
:new_port => repaired_port.to_s)) new_port: repaired_port.to_s))
end end
end end

View File

@ -62,14 +62,14 @@ module Vagrant
# We place the file in the include directory # We place the file in the include directory
to = include_directory.join(dest) 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) FileUtils.mkdir_p(to.parent)
# Copy direcotry contents recursively. # Copy direcotry contents recursively.
if File.directory?(from) 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 else
FileUtils.cp(from, to, :preserve => true) FileUtils.cp(from, to, preserve: true)
end end
end end
rescue Errno::EEXIST => e rescue Errno::EEXIST => e
@ -81,7 +81,7 @@ module Vagrant
# Compress the exported file into a package # Compress the exported file into a package
def compress 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 over the included files
copy_include_files copy_include_files

View File

@ -145,18 +145,18 @@ module Vagrant
message += "\n#{e.backtrace.join("\n")}" message += "\n#{e.backtrace.join("\n")}"
errors << I18n.t("vagrant.general.batch_unexpected_error", errors << I18n.t("vagrant.general.batch_unexpected_error",
:machine => thread[:machine].name, machine: thread[:machine].name,
:message => message) message: message)
else else
errors << I18n.t("vagrant.general.batch_vagrant_error", errors << I18n.t("vagrant.general.batch_vagrant_error",
:machine => thread[:machine].name, machine: thread[:machine].name,
:message => thread[:error].message) message: thread[:error].message)
end end
end end
end end
if !errors.empty? if !errors.empty?
raise Errors::BatchMultiError, :message => errors.join("\n\n") raise Errors::BatchMultiError, message: errors.join("\n\n")
end end
end end
end end

View File

@ -62,7 +62,7 @@ module Vagrant
@metadata_url = opts[:metadata_url] @metadata_url = opts[:metadata_url]
metadata_file = directory.join("metadata.json") 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 begin
@metadata = JSON.parse(directory.join("metadata.json").read) @metadata = JSON.parse(directory.join("metadata.json").read)

View File

@ -141,7 +141,7 @@ module Vagrant
if !found if !found
@logger.error("Added box provider doesnt match expected: #{log_provider}") @logger.error("Added box provider doesnt match expected: #{log_provider}")
raise Errors::BoxProviderDoesntMatch, raise Errors::BoxProviderDoesntMatch,
:expected => log_provider, :actual => box_provider expected: log_provider, actual: box_provider
end end
else else
# Verify the box doesn't already exist # Verify the box doesn't already exist
@ -400,7 +400,7 @@ module Vagrant
if !metadata_file.file? if !metadata_file.file?
metadata_file.open("w") do |f| metadata_file.open("w") do |f|
f.write(JSON.generate({ f.write(JSON.generate({
:provider => "virtualbox" provider: "virtualbox"
})) }))
end end
end end

View File

@ -113,7 +113,7 @@ module Vagrant
# Bundler shouldn't attempt to get it remotely. # Bundler shouldn't attempt to get it remotely.
with_isolated_gem do with_isolated_gem do
installer = Gem::DependencyInstaller.new( installer = Gem::DependencyInstaller.new(
:document => [], :prerelease => false) document: [], prerelease: false)
installer.install(path, "= #{pkg.spec.version}") installer.install(path, "= #{pkg.spec.version}")
end end

View File

@ -92,8 +92,8 @@ module Vagrant
cap_mod = capability_module(cap_name.to_sym) cap_mod = capability_module(cap_name.to_sym)
if !cap_mod if !cap_mod
raise Errors::CapabilityNotFound, raise Errors::CapabilityNotFound,
:cap => cap_name.to_s, cap: cap_name.to_s,
:host => @cap_host_chain[0][0].to_s host: @cap_host_chain[0][0].to_s
end end
cap_method = nil cap_method = nil
@ -101,8 +101,8 @@ module Vagrant
cap_method = cap_mod.method(cap_name) cap_method = cap_mod.method(cap_name)
rescue NameError rescue NameError
raise Errors::CapabilityInvalid, raise Errors::CapabilityInvalid,
:cap => cap_name.to_s, cap: cap_name.to_s,
:host => @cap_host_chain[0][0].to_s host: @cap_host_chain[0][0].to_s
end end
args = @cap_args + args args = @cap_args + args

View File

@ -90,7 +90,7 @@ module Vagrant
o.separator "`vagrant list-commands`." o.separator "`vagrant list-commands`."
end end
@env.ui.info(opts.help, :prefix => false) @env.ui.info(opts.help, prefix: false)
end end
end end
end end

View File

@ -197,7 +197,7 @@ module Vagrant
Kernel.load path Kernel.load path
rescue SyntaxError => e rescue SyntaxError => e
# Report syntax errors in a nice way. # Report syntax errors in a nice way.
raise Errors::VagrantfileSyntaxError, :file => e.message raise Errors::VagrantfileSyntaxError, file: e.message
rescue SystemExit rescue SystemExit
# Continue raising that exception... # Continue raising that exception...
raise raise
@ -211,8 +211,8 @@ module Vagrant
# Report the generic exception # Report the generic exception
raise Errors::VagrantfileLoadError, raise Errors::VagrantfileLoadError,
:path => path, path: path,
:message => e.message message: e.message
end end
end end
end end

View File

@ -130,7 +130,7 @@ module Vagrant
end end
old.__internal_state["missing_key_calls"].to_a.sort.each do |key| 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 end
[root, warnings, errors] [root, warnings, errors]

View File

@ -80,7 +80,7 @@ module Vagrant
# If we have missing keys, record those as errors # If we have missing keys, record those as errors
if !@missing_key_calls.empty? if !@missing_key_calls.empty?
errors["Vagrant"] = @missing_key_calls.to_a.sort.map do |key| 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
end end

View File

@ -70,11 +70,11 @@ module Vagrant
# to the `Dir.pwd` (which is the cwd of the executing process). # to the `Dir.pwd` (which is the cwd of the executing process).
def initialize(opts=nil) def initialize(opts=nil)
opts = { opts = {
:cwd => nil, cwd: nil,
:home_path => nil, home_path: nil,
:local_data_path => nil, local_data_path: nil,
:ui_class => nil, ui_class: nil,
:vagrantfile_name => nil, vagrantfile_name: nil,
}.merge(opts || {}) }.merge(opts || {})
# Set the default working directory to look for the vagrantfile # Set the default working directory to look for the vagrantfile
@ -162,16 +162,16 @@ module Vagrant
def action_runner def action_runner
@action_runner ||= Action::Runner.new do @action_runner ||= Action::Runner.new do
{ {
:action_runner => action_runner, action_runner: action_runner,
:box_collection => boxes, box_collection: boxes,
:hook => method(:hook), hook: method(:hook),
:host => host, host: host,
:machine_index => machine_index, machine_index: machine_index,
:gems_path => gems_path, gems_path: gems_path,
:home_path => home_path, home_path: home_path,
:root_path => root_path, root_path: root_path,
:tmp_path => tmp_path, tmp_path: tmp_path,
:ui => @ui ui: @ui
} }
end end
end end
@ -604,7 +604,7 @@ module Vagrant
@logger.info("Creating: #{dir}") @logger.info("Creating: #{dir}")
FileUtils.mkdir_p(dir) FileUtils.mkdir_p(dir)
rescue Errno::EACCES rescue Errno::EACCES
raise Errors::HomeDirectoryNotAccessible, :home_path => @home_path.to_s raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s
end end
end end
@ -686,7 +686,7 @@ module Vagrant
FileUtils.mkdir_p(@local_data_path) FileUtils.mkdir_p(@local_data_path)
rescue Errno::EACCES rescue Errno::EACCES
raise Errors::LocalDataDirectoryNotAccessible, raise Errors::LocalDataDirectoryNotAccessible,
:local_data_path => @local_data_path.to_s local_data_path: @local_data_path.to_s
end end
end end
@ -710,8 +710,8 @@ module Vagrant
FileUtils.cp(source, destination) FileUtils.cp(source, destination)
rescue Errno::EACCES rescue Errno::EACCES
raise Errors::CopyPrivateKeyFailed, raise Errors::CopyPrivateKeyFailed,
:source => source, source: source,
:destination => destination destination: destination
end end
end end
@ -779,7 +779,7 @@ module Vagrant
# The file could've been tampered with since Vagrant 1.0.x is # 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. # supposed to ensure that the contents are valid JSON. Show an error.
raise Errors::DotfileUpgradeJSONError, raise Errors::DotfileUpgradeJSONError,
:state_file => path.to_s state_file: path.to_s
end end
# Alright, let's upgrade this guy to the new structure. Start by # Alright, let's upgrade this guy to the new structure. Start by
@ -810,7 +810,7 @@ module Vagrant
# Upgrade complete! Let the user know # Upgrade complete! Let the user know
@ui.info(I18n.t("vagrant.general.upgraded_v1_dotfile", @ui.info(I18n.t("vagrant.general.upgraded_v1_dotfile",
:backup_path => backup_file.to_s)) backup_path: backup_file.to_s))
end end
end end
end end

View File

@ -166,8 +166,8 @@ module Vagrant
# must be raised. # must be raised.
if callable.nil? if callable.nil?
raise Errors::UnimplementedProviderAction, raise Errors::UnimplementedProviderAction,
:action => name, action: name,
:provider => @provider.to_s provider: @provider.to_s
end end
action_raw(name, callable, extra_env) action_raw(name, callable, extra_env)
@ -347,10 +347,10 @@ module Vagrant
# not documented here: # not documented here:
# #
# { # {
# :host => "1.2.3.4", # host: "1.2.3.4",
# :port => "22", # port: "22",
# :username => "mitchellh", # username: "mitchellh",
# :private_key_path => "/path/to/my/key" # private_key_path: "/path/to/my/key"
# } # }
# #
# Note that Vagrant makes no guarantee that this info works or is # Note that Vagrant makes no guarantee that this info works or is

View File

@ -14,7 +14,7 @@ module Vagrant
@data = JSON.parse(@path.read) @data = JSON.parse(@path.read)
rescue JSON::ParserError => e rescue JSON::ParserError => e
raise Vagrant::Errors::PluginStateFileParseError, raise Vagrant::Errors::PluginStateFileParseError,
:path => path, :message => e.message path: path, message: e.message
end end
upgrade_v0! if !@data["version"] upgrade_v0! if !@data["version"]

View File

@ -51,7 +51,7 @@ module Vagrant
opts.parse!(argv) opts.parse!(argv)
return argv return argv
rescue OptionParser::InvalidOption rescue OptionParser::InvalidOption
raise Errors::CLIInvalidOptions, :help => opts.help.chomp raise Errors::CLIInvalidOptions, help: opts.help.chomp
end end
# Yields a VM for each target VM for the command. # Yields a VM for each target VM for the command.
@ -91,7 +91,7 @@ module Vagrant
else else
# String name, just look for a specific VM # String name, just look for a specific VM
vms << @env.vms[name.to_sym] vms << @env.vms[name.to_sym]
raise Errors::VMNotFoundError, :name => name if !vms[0] raise Errors::VMNotFoundError, name: name if !vms[0]
end end
end end
else else

View File

@ -40,7 +40,7 @@ module Vagrant
# If when this method returns, the machine's state isn't "powered_off," # If when this method returns, the machine's state isn't "powered_off,"
# Vagrant will proceed to forcefully shut the machine down. # Vagrant will proceed to forcefully shut the machine down.
def halt def halt
raise BaseError, :_key => :unsupported_halt raise BaseError, _key: :unsupported_halt
end end
# Mounts a shared folder. # Mounts a shared folder.
@ -56,13 +56,13 @@ module Vagrant
# @param [Hash] options Additional options for the shared folder # @param [Hash] options Additional options for the shared folder
# which can be honored. # which can be honored.
def mount_shared_folder(name, guestpath, options) def mount_shared_folder(name, guestpath, options)
raise BaseError, :_key => :unsupported_shared_folder raise BaseError, _key: :unsupported_shared_folder
end end
# Mounts a shared folder via NFS. This assumes that the exports # Mounts a shared folder via NFS. This assumes that the exports
# via the host are already done. # via the host are already done.
def mount_nfs(ip, folders) def mount_nfs(ip, folders)
raise BaseError, :_key => :unsupported_nfs raise BaseError, _key: :unsupported_nfs
end end
# Configures the given list of networks on the virtual machine. # Configures the given list of networks on the virtual machine.
@ -72,19 +72,19 @@ module Vagrant
# of the hash will be roughly the following: # of the hash will be roughly the following:
# #
# { # {
# :type => :static, # type: :static,
# :ip => "192.168.33.10", # ip: "192.168.33.10",
# :netmask => "255.255.255.0", # netmask: "255.255.255.0",
# :interface => 1 # interface: 1
# } # }
# #
def configure_networks(networks) def configure_networks(networks)
raise BaseError, :_key => :unsupported_configure_networks raise BaseError, _key: :unsupported_configure_networks
end end
# Called to change the hostname of the virtual machine. # Called to change the hostname of the virtual machine.
def change_host_name(name) def change_host_name(name)
raise BaseError, :_key => :unsupported_host_name raise BaseError, _key: :unsupported_host_name
end end
end end
end end

View File

@ -38,10 +38,10 @@ module Vagrant
# following: # following:
# #
# { # {
# :host => "1.2.3.4", # host: "1.2.3.4",
# :port => "22", # port: "22",
# :username => "mitchellh", # username: "mitchellh",
# :private_key_path => "/path/to/my/key" # private_key_path: "/path/to/my/key"
# } # }
# #
# **Note:** Vagrant only supports private key based authentication, # **Note:** Vagrant only supports private key based authentication,

View File

@ -59,7 +59,7 @@ module Vagrant
opts.parse!(argv) opts.parse!(argv)
return argv return argv
rescue OptionParser::InvalidOption rescue OptionParser::InvalidOption
raise Errors::CLIInvalidOptions, :help => opts.help.chomp raise Errors::CLIInvalidOptions, help: opts.help.chomp
end end
# Yields a VM for each target VM for the command. # 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 # We found an active machine with a provider that doesn't
# match the requested provider. Show an error. # match the requested provider. Show an error.
raise Errors::ActiveMachineWithDifferentProvider, raise Errors::ActiveMachineWithDifferentProvider,
:name => active_name.to_s, name: active_name.to_s,
:active_provider => active_provider.to_s, active_provider: active_provider.to_s,
:requested_provider => provider_to_use.to_s requested_provider: provider_to_use.to_s
else else
# Use this provider and exit out of the loop. One of the # Use this provider and exit out of the loop. One of the
# invariants [for now] is that there shouldn't be machines # invariants [for now] is that there shouldn't be machines
@ -190,7 +190,7 @@ module Vagrant
# String name, just look for a specific VM # String name, just look for a specific VM
@logger.debug("Finding machine that match name: #{name}") @logger.debug("Finding machine that match name: #{name}")
machines << get_machine.call(name.to_sym) 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
end end
else else

View File

@ -130,7 +130,7 @@ module Vagrant
def _detected_errors def _detected_errors
return [] if !@__invalid_methods || @__invalid_methods.empty? return [] if !@__invalid_methods || @__invalid_methods.empty?
return [I18n.t("vagrant.config.common.bad_field", return [I18n.t("vagrant.config.common.bad_field",
:fields => @__invalid_methods.to_a.sort.join(", "))] fields: @__invalid_methods.to_a.sort.join(", "))]
end end
# An internal finalize call that no subclass should override. # An internal finalize call that no subclass should override.

View File

@ -57,10 +57,10 @@ module Vagrant
# following: # following:
# #
# { # {
# :host => "1.2.3.4", # host: "1.2.3.4",
# :port => "22", # port: "22",
# :username => "mitchellh", # username: "mitchellh",
# :private_key_path => "/path/to/my/key" # private_key_path: "/path/to/my/key"
# } # }
# #
# **Note:** Vagrant only supports private key based authentication, # **Note:** Vagrant only supports private key based authentication,

View File

@ -77,8 +77,8 @@ module Vagrant
def __internal_state def __internal_state
{ {
:items => @items, items: @items,
:results_cache => @results_cache results_cache: @results_cache
} }
end end
end end

View File

@ -181,20 +181,20 @@ module Vagrant
line = "Progress: #{progress}" line = "Progress: #{progress}"
end end
info(line, :new_line => false) info(line, new_line: false)
end end
def clear_line def clear_line
# See: http://en.wikipedia.org/wiki/ANSI_escape_code # See: http://en.wikipedia.org/wiki/ANSI_escape_code
reset = "\r\033[K" reset = "\r\033[K"
info(reset, :new_line => false) info(reset, new_line: false)
end end
# This method handles actually outputting a message of a given type # This method handles actually outputting a message of a given type
# to the console. # to the console.
def say(type, message, **opts) def say(type, message, **opts)
defaults = { :new_line => true, :prefix => true } defaults = { new_line: true, prefix: true }
opts = defaults.merge(@opts).merge(opts) opts = defaults.merge(@opts).merge(opts)
# Don't output if we're hiding details # Don't output if we're hiding details
@ -215,7 +215,7 @@ module Vagrant
Thread.new do Thread.new do
@lock.synchronize do @lock.synchronize do
safe_puts(format_message(type, message, **opts), safe_puts(format_message(type, message, **opts),
:io => channel, :printer => printer) io: channel, printer: printer)
end end
end.join end.join
end end

View File

@ -112,7 +112,7 @@ module Vagrant
output = "Progress: #{columns[0]}% (Rate: #{columns[11]}/s, Estimated time remaining: #{columns[10]})" output = "Progress: #{columns[0]}% (Rate: #{columns[11]}/s, Estimated time remaining: #{columns[10]})"
@ui.clear_line @ui.clear_line
@ui.detail(output, :new_line => false) @ui.detail(output, new_line: false)
end end
end end
end end
@ -177,7 +177,7 @@ module Vagrant
@logger.warn("Downloader exit code: #{result.exit_code}") @logger.warn("Downloader exit code: #{result.exit_code}")
parts = result.stderr.split(/\n*curl:\s+\(\d+\)\s*/, 2) parts = result.stderr.split(/\n*curl:\s+\(\d+\)\s*/, 2)
parts[1] ||= "" parts[1] ||= ""
raise Errors::DownloaderError, :message => parts[1].chomp raise Errors::DownloaderError, message: parts[1].chomp
end end
result result

View File

@ -11,7 +11,7 @@ module Vagrant
# http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/ # http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/
def retryable(opts=nil) def retryable(opts=nil)
logger = nil logger = nil
opts = { :tries => 1, :on => Exception }.merge(opts || {}) opts = { tries: 1, on: Exception }.merge(opts || {})
begin begin
return yield return yield

View File

@ -14,8 +14,8 @@ module Vagrant
def safe_puts(message=nil, opts=nil) def safe_puts(message=nil, opts=nil)
message ||= "" message ||= ""
opts = { opts = {
:io => $stdout, io: $stdout,
:printer => :puts printer: :puts
}.merge(opts || {}) }.merge(opts || {})
begin begin

View File

@ -4,16 +4,16 @@ module Vagrant
# prefix. An example speaks best here. Imagine the following hash: # prefix. An example speaks best here. Imagine the following hash:
# #
# original = { # original = {
# :id => "foo", # id: "foo",
# :mitchellh__id => "bar", # mitchellh__id: "bar",
# :mitchellh__other => "foo" # mitchellh__other: "foo"
# } # }
# #
# scoped = scoped_hash_override(original, "mitchellh") # scoped = scoped_hash_override(original, "mitchellh")
# #
# scoped == { # scoped == {
# :id => "bar", # id: "bar",
# :other => "foo" # other: "foo"
# } # }
# #
module ScopedHashOverride module ScopedHashOverride

View File

@ -35,7 +35,7 @@ module Vagrant
if !stat.owned? if !stat.owned?
# The SSH key must be owned by ourselves # The SSH key must be owned by ourselves
raise Errors::SSHKeyBadOwner, :key_path => key_path raise Errors::SSHKeyBadOwner, key_path: key_path
end end
if FileMode.from_octal(stat.mode) != "600" 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 # Re-stat the file to get the new mode, and verify it worked
stat = key_path.stat stat = key_path.stat
if FileMode.from_octal(stat.mode) != "600" if FileMode.from_octal(stat.mode) != "600"
raise Errors::SSHKeyBadPermissions, :key_path => key_path raise Errors::SSHKeyBadPermissions, key_path: key_path
end end
end end
rescue Errno::EPERM rescue Errno::EPERM
# This shouldn't happen since we verify we own the file, but # This shouldn't happen since we verify we own the file, but
# it is possible in theory, so we raise an error. # 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 end
# Halts the running of this process and replaces it with a full-fledged # Halts the running of this process and replaces it with a full-fledged
@ -70,10 +70,10 @@ module Vagrant
if !ssh_path if !ssh_path
if Platform.windows? if Platform.windows?
raise Errors::SSHUnavailableWindows, raise Errors::SSHUnavailableWindows,
:host => ssh_info[:host], host: ssh_info[:host],
:port => ssh_info[:port], port: ssh_info[:port],
:username => ssh_info[:username], username: ssh_info[:username],
:key_path => ssh_info[:private_key_path].join(", ") key_path: ssh_info[:private_key_path].join(", ")
end end
raise Errors::SSHUnavailable raise Errors::SSHUnavailable
@ -85,10 +85,10 @@ module Vagrant
r = Subprocess.execute(ssh_path) r = Subprocess.execute(ssh_path)
if r.stdout.include?("PuTTY Link") if r.stdout.include?("PuTTY Link")
raise Errors::SSHIsPuttyLink, raise Errors::SSHIsPuttyLink,
:host => ssh_info[:host], host: ssh_info[:host],
:port => ssh_info[:port], port: ssh_info[:port],
:username => ssh_info[:username], username: ssh_info[:username],
:key_path => ssh_info[:private_key_path].join(", ") key_path: ssh_info[:private_key_path].join(", ")
end end
end end

View File

@ -120,7 +120,7 @@ module Vagrant
end end
# Create a dictionary to store all the output we see. # 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 # Record the start time for timeout purposes
start_time = Time.now.to_i start_time = Time.now.to_i

View File

@ -73,7 +73,7 @@ module Vagrant
# #
# @return [String] # @return [String]
def render_string def render_string
Erubis::Eruby.new(template, :trim => true).result(binding) Erubis::Eruby.new(template, trim: true).result(binding)
end end
# Returns the full path to the template, taking into accoun the gem directory # Returns the full path to the template, taking into accoun the gem directory

View File

@ -57,8 +57,8 @@ module Vagrant
level = config_errors.empty? ? :warn : :error level = config_errors.empty? ? :warn : :error
output = Util::TemplateRenderer.render( output = Util::TemplateRenderer.render(
"config/messages", "config/messages",
:warnings => config_warnings, warnings: config_warnings,
:errors => config_errors).chomp errors: config_errors).chomp
env.ui.send(level, I18n.t("vagrant.general.config_upgrade_messages", env.ui.send(level, I18n.t("vagrant.general.config_upgrade_messages",
name: name, name: name,
output: output)) output: output))
@ -111,13 +111,13 @@ module Vagrant
sub_machine = @config.vm.defined_vms[name] sub_machine = @config.vm.defined_vms[name]
if !sub_machine if !sub_machine
raise Errors::MachineNotFound, raise Errors::MachineNotFound,
:name => name, :provider => provider name: name, provider: provider
end end
provider_plugin = Vagrant.plugin("2").manager.providers[provider] provider_plugin = Vagrant.plugin("2").manager.providers[provider]
if !provider_plugin if !provider_plugin
raise Errors::ProviderNotFound, raise Errors::ProviderNotFound,
:machine => name, :provider => provider machine: name, provider: provider
end end
provider_cls = provider_plugin[0] provider_cls = provider_plugin[0]

View File

@ -24,7 +24,7 @@ module VagrantPlugins
boxes = @env.boxes.all.sort boxes = @env.boxes.all.sort
if boxes.empty? 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 end
list_boxes(boxes, options[:info]) list_boxes(boxes, options[:info])

View File

@ -46,10 +46,10 @@ module VagrantPlugins
end end
@env.action_runner.run(Vagrant::Action.action_box_remove, { @env.action_runner.run(Vagrant::Action.action_box_remove, {
:box_name => argv[0], box_name: argv[0],
:box_provider => options[:provider], box_provider: options[:provider],
:box_version => options[:version], box_version: options[:version],
:force_confirm_box_remove => options[:force], force_confirm_box_remove: options[:force],
}) })
# Success, exit status 0 # Success, exit status 0

View File

@ -14,7 +14,7 @@ module VagrantPlugins
# Parse the options # Parse the options
argv = parse_options(opts) argv = parse_options(opts)
return if !argv 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_name = argv[0]
box_provider = argv[1].to_sym box_provider = argv[1].to_sym

View File

@ -81,7 +81,7 @@ module VagrantPlugins
opts.separator "For help on any individual subcommand run `vagrant box <subcommand> -h`" opts.separator "For help on any individual subcommand run `vagrant box <subcommand> -h`"
end end
@env.ui.info(opts.help, :prefix => false) @env.ui.info(opts.help, prefix: false)
end end
end end
end end

View File

@ -27,9 +27,9 @@ module VagrantPlugins
@logger.debug("'Destroy' each target VM...") @logger.debug("'Destroy' each target VM...")
declined = 0 declined = 0
total = 0 total = 0
with_target_vms(argv, :reverse => true) do |vm| with_target_vms(argv, reverse: true) do |vm|
action_env = vm.action( action_env = vm.action(
:destroy, :force_confirm_destroy => options[:force]) :destroy, force_confirm_destroy: options[:force])
total += 1 total += 1
declined += 1 if action_env.has_key?(:force_confirm_destroy_result) && declined += 1 if action_env.has_key?(:force_confirm_destroy_result) &&

View File

@ -28,7 +28,7 @@ module VagrantPlugins
@logger.debug("Halt command: #{argv.inspect} #{options.inspect}") @logger.debug("Halt command: #{argv.inspect} #{options.inspect}")
with_target_vms(argv, reverse: true) do |vm| with_target_vms(argv, reverse: true) do |vm|
vm.action(:halt, :force_halt => options[:force]) vm.action(:halt, force_halt: options[:force])
end end
# Success, exit status 0 # Success, exit status 0

View File

@ -54,8 +54,8 @@ module VagrantPlugins
template_path = ::Vagrant.source_root.join(template) template_path = ::Vagrant.source_root.join(template)
contents = Vagrant::Util::TemplateRenderer.render(template_path, contents = Vagrant::Util::TemplateRenderer.render(template_path,
:box_name => argv[0] || "base", box_name: argv[0] || "base",
:box_url => argv[1]) box_url: argv[1])
if save_path if save_path
# Write out the contents # Write out the contents

View File

@ -67,7 +67,7 @@ module VagrantPlugins
end end
def package_target(name, options) 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}") @logger.debug("Packaging VM: #{vm.name}")
package_vm(vm, options) package_vm(vm, options)
end end

View File

@ -22,7 +22,7 @@ module VagrantPlugins
plugin_name_label = plugin_name plugin_name_label = plugin_name
plugin_name_label += " --version '#{version}'" if version plugin_name_label += " --version '#{version}'" if version
env[:ui].info(I18n.t("vagrant.commands.plugin.installing", env[:ui].info(I18n.t("vagrant.commands.plugin.installing",
:name => plugin_name_label)) name: plugin_name_label))
manager = Vagrant::Plugin::Manager.instance manager = Vagrant::Plugin::Manager.instance
plugin_spec = manager.install_plugin( plugin_spec = manager.install_plugin(
@ -38,8 +38,8 @@ module VagrantPlugins
# Tell the user # Tell the user
env[:ui].success(I18n.t("vagrant.commands.plugin.installed", env[:ui].success(I18n.t("vagrant.commands.plugin.installed",
:name => plugin_spec.name, name: plugin_spec.name,
:version => plugin_spec.version.to_s)) version: plugin_spec.version.to_s))
# If the plugin's spec includes a post-install message display it # If the plugin's spec includes a post-install message display it
post_install_message = plugin_spec.post_install_message post_install_message = plugin_spec.post_install_message
@ -49,8 +49,8 @@ module VagrantPlugins
end end
env[:ui].info(I18n.t("vagrant.commands.plugin.post_install", env[:ui].info(I18n.t("vagrant.commands.plugin.post_install",
:name => plugin_spec.name, name: plugin_spec.name,
:message => post_install_message.to_s)) message: post_install_message.to_s))
end end
# Continue # Continue

View File

@ -21,8 +21,8 @@ module VagrantPlugins
license_file = Pathname.new(env[:plugin_license_path]) license_file = Pathname.new(env[:plugin_license_path])
if !license_file.file? if !license_file.file?
raise Vagrant::Errors::PluginInstallLicenseNotFound, raise Vagrant::Errors::PluginInstallLicenseNotFound,
:name => env[:plugin_name], name: env[:plugin_name],
:path => license_file.to_s path: license_file.to_s
end end
# Copy it in. # Copy it in.
@ -30,12 +30,12 @@ module VagrantPlugins
@logger.info("Copying license from: #{license_file}") @logger.info("Copying license from: #{license_file}")
@logger.info("Copying license to: #{final_path}") @logger.info("Copying license to: #{final_path}")
env[:ui].info(I18n.t("vagrant.commands.plugin.installing_license", env[:ui].info(I18n.t("vagrant.commands.plugin.installing_license",
:name => env[:plugin_name])) name: env[:plugin_name]))
FileUtils.cp(license_file, final_path) FileUtils.cp(license_file, final_path)
# Installed! # Installed!
env[:ui].success(I18n.t("vagrant.commands.plugin.installed_license", env[:ui].success(I18n.t("vagrant.commands.plugin.installed_license",
:name => env[:plugin_name])) name: env[:plugin_name]))
@app.call(env) @app.call(env)
end end

View File

@ -12,7 +12,7 @@ module VagrantPlugins
def call(env) def call(env)
# Remove it! # Remove it!
env[:ui].info(I18n.t("vagrant.commands.plugin.uninstalling", env[:ui].info(I18n.t("vagrant.commands.plugin.uninstalling",
:name => env[:plugin_name])) name: env[:plugin_name]))
manager = Vagrant::Plugin::Manager.instance manager = Vagrant::Plugin::Manager.instance
manager.uninstall_plugin(env[:plugin_name]) manager.uninstall_plugin(env[:plugin_name])

View File

@ -25,16 +25,16 @@ module VagrantPlugins
# Parse the options # Parse the options
argv = parse_options(opts) argv = parse_options(opts)
return if !argv 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 # Install the gem
argv.each do |name| argv.each do |name|
action(Action.action_install, { action(Action.action_install, {
:plugin_entry_point => options[:entry_point], plugin_entry_point: options[:entry_point],
:plugin_version => options[:plugin_version], plugin_version: options[:plugin_version],
:plugin_sources => options[:plugin_sources], plugin_sources: options[:plugin_sources],
:plugin_name => name, plugin_name: name,
:plugin_verbose => options[:verbose] plugin_verbose: options[:verbose]
}) })
end end

View File

@ -14,12 +14,12 @@ module VagrantPlugins
# Parse the options # Parse the options
argv = parse_options(opts) argv = parse_options(opts)
return if !argv 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 # License the plugin
action(Action.action_license, { action(Action.action_license, {
:plugin_license_path => argv[1], plugin_license_path: argv[1],
:plugin_name => argv[0] plugin_name: argv[0]
}) })
# Success, exit status 0 # Success, exit status 0

View File

@ -14,7 +14,7 @@ module VagrantPlugins
# Parse the options # Parse the options
argv = parse_options(opts) argv = parse_options(opts)
return if !argv 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 # List the installed plugins
action(Action.action_list) action(Action.action_list)

View File

@ -76,7 +76,7 @@ module VagrantPlugins
o.separator "For help on any individual command run `vagrant plugin COMMAND -h`" o.separator "For help on any individual command run `vagrant plugin COMMAND -h`"
end end
@env.ui.info(opts.help, :prefix => false) @env.ui.info(opts.help, prefix: false)
end end
end end
end end

View File

@ -14,11 +14,11 @@ module VagrantPlugins
# Parse the options # Parse the options
argv = parse_options(opts) argv = parse_options(opts)
return if !argv 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 # Uninstall the gems
argv.each do |gem| argv.each do |gem|
action(Action.action_uninstall, :plugin_name => gem) action(Action.action_uninstall, plugin_name: gem)
end end
# Success, exit status 0 # Success, exit status 0

View File

@ -21,7 +21,7 @@ module VagrantPlugins
# Update the gem # Update the gem
action(Action.action_update, { action(Action.action_update, {
:plugin_name => argv, plugin_name: argv,
}) })
# Success, exit status 0 # Success, exit status 0

View File

@ -38,10 +38,10 @@ module VagrantPlugins
return if !argv return if !argv
# Execute the actual SSH # Execute the actual SSH
with_target_vms(argv, :single_target => true) do |vm| with_target_vms(argv, single_target: true) do |vm|
ssh_opts = { ssh_opts = {
:plain_mode => options[:plain_mode], plain_mode: options[:plain_mode],
:extra_args => options[:ssh_args] extra_args: options[:ssh_args]
} }
if options[:command] if options[:command]
@ -56,7 +56,7 @@ module VagrantPlugins
return exit_status return exit_status
else else
@logger.debug("Invoking `ssh` action on machine") @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` # We should never reach this point, since the point of `ssh`
# is to exec into the proper SSH shell, but we'll just return # is to exec into the proper SSH shell, but we'll just return

View File

@ -33,14 +33,14 @@ module VagrantPlugins
raise Vagrant::Errors::SSHNotReady if ssh_info.nil? raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
variables = { variables = {
:host_key => options[:host] || machine.name || "vagrant", host_key: options[:host] || machine.name || "vagrant",
:ssh_host => ssh_info[:host], ssh_host: ssh_info[:host],
:ssh_port => ssh_info[:port], ssh_port: ssh_info[:port],
:ssh_user => ssh_info[:username], ssh_user: ssh_info[:username],
:private_key_path => ssh_info[:private_key_path], private_key_path: ssh_info[:private_key_path],
:forward_agent => ssh_info[:forward_agent], forward_agent: ssh_info[:forward_agent],
:forward_x11 => ssh_info[:forward_x11], forward_x11: ssh_info[:forward_x11],
:proxy_command => ssh_info[:proxy_command] proxy_command: ssh_info[:proxy_command]
} }
# Render the template and output directly to STDOUT # Render the template and output directly to STDOUT

View File

@ -44,9 +44,9 @@ module VagrantPlugins
end end
@env.ui.info(I18n.t("vagrant.commands.status.output", @env.ui.info(I18n.t("vagrant.commands.status.output",
:states => results.join("\n"), states: results.join("\n"),
:message => message), message: message),
:prefix => false) prefix: false)
# Success, exit status 0 # Success, exit status 0
0 0

View File

@ -64,11 +64,11 @@ module VagrantPlugins
end end
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( @env.ui.info(I18n.t(
"vagrant.commands.up.upping", "vagrant.commands.up.upping",
:name => machine.name, name: machine.name,
:provider => machine.provider_name)) provider: machine.provider_name))
machines << machine machines << machine

View File

@ -162,13 +162,13 @@ module VagrantPlugins
def execute(command, opts=nil, &block) def execute(command, opts=nil, &block)
opts = { opts = {
:error_check => true, error_check: true,
:error_class => Vagrant::Errors::VagrantError, error_class: Vagrant::Errors::VagrantError,
:error_key => :ssh_bad_exit_status, error_key: :ssh_bad_exit_status,
:good_exit => 0, good_exit: 0,
:command => command, command: command,
:shell => nil, shell: nil,
:sudo => false, sudo: false,
}.merge(opts || {}) }.merge(opts || {})
opts[:good_exit] = Array(opts[:good_exit]) opts[:good_exit] = Array(opts[:good_exit])
@ -199,9 +199,9 @@ module VagrantPlugins
# but that makes for an ugly configuration parameter, so we # but that makes for an ugly configuration parameter, so we
# set it here from `error_key` # set it here from `error_key`
error_opts = opts.merge( error_opts = opts.merge(
:_key => opts[:error_key], _key: opts[:error_key],
:stdout => stdout, stdout: stdout,
:stderr => stderr stderr: stderr
) )
raise opts[:error_class], error_opts raise opts[:error_class], error_opts
end end
@ -212,7 +212,7 @@ module VagrantPlugins
def sudo(command, opts=nil, &block) def sudo(command, opts=nil, &block)
# Run `execute` but with the `sudo` option. # Run `execute` but with the `sudo` option.
opts = { :sudo => true }.merge(opts || {}) opts = { sudo: true }.merge(opts || {})
execute(command, opts, &block) execute(command, opts, &block)
end end
@ -225,7 +225,7 @@ module VagrantPlugins
end end
def test(command, opts=nil) def test(command, opts=nil)
opts = { :error_check => false }.merge(opts || {}) opts = { error_check: false }.merge(opts || {})
execute(command, opts) == 0 execute(command, opts) == 0
end end
@ -235,7 +235,7 @@ module VagrantPlugins
scp_connect do |scp| scp_connect do |scp|
if File.directory?(from) if File.directory?(from)
# Recurisvely upload directories # Recurisvely upload directories
scp.upload!(from, to, :recursive => true) scp.upload!(from, to, recursive: true)
else else
# Open file read only to fix issue [GH-1036] # Open file read only to fix issue [GH-1036]
scp.upload!(File.open(from, "r"), to) 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 # Build the options we'll use to initiate the connection via Net::SSH
common_connect_opts = { common_connect_opts = {
:auth_methods => ["none", "publickey", "hostbased", "password"], auth_methods: ["none", "publickey", "hostbased", "password"],
:config => false, config: false,
:forward_agent => ssh_info[:forward_agent], forward_agent: ssh_info[:forward_agent],
:keys => ssh_info[:private_key_path], keys: ssh_info[:private_key_path],
:keys_only => true, keys_only: true,
:paranoid => false, paranoid: false,
:password => ssh_info[:password], password: ssh_info[:password],
:port => ssh_info[:port], port: ssh_info[:port],
:timeout => 15, timeout: 15,
:user_known_hosts_file => [], user_known_hosts_file: [],
:verbose => :debug, verbose: :debug,
} }
# Check that the private key permissions are valid # Check that the private key permissions are valid
@ -327,7 +327,7 @@ module VagrantPlugins
timeout = 60 timeout = 60
@logger.info("Attempting SSH connnection...") @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 Timeout.timeout(timeout) do
begin begin
# This logger will get the Net-SSH log data for us. # This logger will get the Net-SSH log data for us.

View File

@ -83,7 +83,7 @@ module VagrantPlugins
command = @cmd_filter.filter(command) command = @cmd_filter.filter(command)
return false if command.empty? return false if command.empty?
opts = { :error_check => false }.merge(opts || {}) opts = { error_check: false }.merge(opts || {})
execute(command, opts) == 0 execute(command, opts) == 0
end end

View File

@ -153,9 +153,9 @@ module VagrantPlugins
def raise_upload_error_if_failed(out, from, to) def raise_upload_error_if_failed(out, from, to)
raise Errors::WinRMFileTransferError, raise Errors::WinRMFileTransferError,
:from => from, from: from,
:to => to, to: to,
:message => out.inspect if out[:exitcode] != 0 message: out.inspect if out[:exitcode] != 0
end end
end end
end end

View File

@ -77,7 +77,7 @@ module VagrantPlugins
protected protected
def execute_shell(command, shell=:powershell, &block) 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 begin
execute_shell_with_retry(command, shell, &block) execute_shell_with_retry(command, shell, &block)
@ -87,7 +87,7 @@ module VagrantPlugins
end end
def execute_shell_with_retry(command, shell, &block) 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}") @logger.debug("#{shell} executing:\n#{command}")
output = session.send(shell, command) do |out, err| output = session.send(shell, command) do |out, err|
block.call(:stdout, out) if block_given? && out 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 the error is a 401, we can return a more specific error message
if winrm_exception.message.include?("401") if winrm_exception.message.include?("401")
raise Errors::AuthError, raise Errors::AuthError,
:user => @username, user: @username,
:password => @password, password: @password,
:endpoint => endpoint, endpoint: endpoint,
:message => winrm_exception.message message: winrm_exception.message
end end
raise Errors::ExecutionError, raise Errors::ExecutionError,
:shell => shell, shell: shell,
:command => command, command: command,
:message => winrm_exception.message message: winrm_exception.message
end end
def new_session def new_session
@ -135,12 +135,12 @@ module VagrantPlugins
end end
def endpoint_options def endpoint_options
{ :user => @username, { user: @username,
:pass => @password, pass: @password,
:host => @host, host: @host,
:port => @port, port: @port,
:operation_timeout => @timeout_in_seconds, operation_timeout: @timeout_in_seconds,
:basic_auth_only => true } basic_auth_only: true }
end end
end #WinShell class end #WinShell class
end end

View File

@ -12,7 +12,7 @@ module VagrantPlugins
def self.configure_networks(machine, networks) def self.configure_networks(machine, networks)
networks.each do |network| networks.each do |network|
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}", entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
:options => network) options: network)
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
temp.binmode temp.binmode

View File

@ -43,14 +43,14 @@ module VagrantPlugins
primary_machine_ip = get_ip.(primary_machine) primary_machine_ip = get_ip.(primary_machine)
current_ip = get_ip.(machine) current_ip = get_ip.(machine)
if current_ip == primary_machine_ip if current_ip == primary_machine_ip
entry = TemplateRenderer.render("guests/coreos/etcd.service", :options => { entry = TemplateRenderer.render("guests/coreos/etcd.service", options: {
:my_ip => current_ip my_ip: current_ip
}) })
else else
connection_string = "#{primary_machine_ip}:7001" connection_string = "#{primary_machine_ip}:7001"
entry = TemplateRenderer.render("guests/coreos/etcd.service", :options => { entry = TemplateRenderer.render("guests/coreos/etcd.service", options: {
:connection_string => connection_string, connection_string: connection_string,
:my_ip => current_ip my_ip: current_ip
}) })
end end

View File

@ -24,7 +24,7 @@ module VagrantPlugins
mount_command = "mount -t nfs " + mount_command = "mount -t nfs " +
"-o '#{mount_opts.join(",")}' " + "-o '#{mount_opts.join(",")}' " +
"'#{ip}:#{opts[:hostpath]}' '#{expanded_guest_path}'" "'#{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( machine.communicate.sudo(
mount_command, mount_command,
error_class: Vagrant::Errors::DarwinNFSMountFailed) error_class: Vagrant::Errors::DarwinNFSMountFailed)

View File

@ -11,18 +11,18 @@ module VagrantPlugins
def self.mount_vmware_shared_folder(machine, name, guestpath, options) def self.mount_vmware_shared_folder(machine, name, guestpath, options)
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
# clear prior symlink # clear prior symlink
if comm.test("test -L \"#{guestpath}\"", :sudo => true) if comm.test("test -L \"#{guestpath}\"", sudo: true)
comm.sudo("rm \"#{guestpath}\"") comm.sudo("rm \"#{guestpath}\"")
end end
# clear prior directory if exists # 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}\"") comm.sudo("rm -Rf \"#{guestpath}\"")
end end
# create intermediate directories if needed # create intermediate directories if needed
intermediate_dir = File.dirname(guestpath) 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}\"") comm.sudo("mkdir -p \"#{intermediate_dir}\"")
end end

View File

@ -25,7 +25,7 @@ module VagrantPlugins
networks.each do |network| networks.each do |network|
interfaces.add(network[:interface]) interfaces.add(network[:interface])
entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}", entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}",
:options => network) options: network)
entries << entry entries << entry
end end

View File

@ -13,9 +13,9 @@ module VagrantPlugins
comm.execute("localcli storage nfs remove -v #{volume}") comm.execute("localcli storage nfs remove -v #{volume}")
end end
mount_command = "localcli storage nfs add -H #{ip} -s '#{opts[:hostpath]}' -v '#{volume}'" 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, comm.execute(mount_command,
:error_class => Vagrant::Errors::LinuxNFSMountFailed) error_class: Vagrant::Errors::LinuxNFSMountFailed)
end end
# symlink vmfs volume to :guestpath # symlink vmfs volume to :guestpath

View File

@ -54,7 +54,7 @@ module VagrantPlugins
# Render and upload the network entry file to a deterministic # Render and upload the network entry file to a deterministic
# temporary location. # temporary location.
entry = TemplateRenderer.render("guests/fedora/network_#{network[:type]}", entry = TemplateRenderer.render("guests/fedora/network_#{network[:type]}",
:options => network) options: network)
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
temp.binmode temp.binmode
@ -68,9 +68,9 @@ module VagrantPlugins
# each specifically, we avoid reconfiguring p7p (the NAT interface) so # each specifically, we avoid reconfiguring p7p (the NAT interface) so
# SSH never dies. # SSH never dies.
interfaces.each do |interface| 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("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}") machine.communicate.sudo("/sbin/ifup #{interface}")
end end

View File

@ -3,9 +3,9 @@ module VagrantPlugins
module Cap module Cap
class ChangeHostName class ChangeHostName
def self.change_host_name(machine, name) def self.change_host_name(machine, name)
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{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("sed -i '' 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf", {shell: "sh"})
machine.communicate.sudo("hostname #{name}", {:shell => "sh"}) machine.communicate.sudo("hostname #{name}", {shell: "sh"})
end end
end end
end end

View File

@ -10,7 +10,7 @@ module VagrantPlugins
def self.configure_networks(machine, networks) def self.configure_networks(machine, networks)
# Remove any previous network additions to the configuration file. # 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| networks.each do |network|
# Determine the interface prefix... # Determine the interface prefix...
@ -27,7 +27,7 @@ module VagrantPlugins
end end
entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}", entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}",
:options => network) options: network)
# Write the entry to a temporary location # Write the entry to a temporary location
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
@ -36,13 +36,13 @@ module VagrantPlugins
temp.close temp.close
machine.communicate.upload(temp.path, "/tmp/vagrant-network-entry") 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("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("rm /tmp/vagrant-network-entry", {shell: "sh"})
if network[:type].to_sym == :static 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 elsif network[:type].to_sym == :dhcp
machine.communicate.sudo("dhclient #{ifname}", {:shell => "sh"}) machine.communicate.sudo("dhclient #{ifname}", {shell: "sh"})
end end
end end
end end

View File

@ -4,7 +4,7 @@ module VagrantPlugins
class Halt class Halt
def self.halt(machine) def self.halt(machine)
begin begin
machine.communicate.sudo("shutdown -p now", {:shell => "sh"}) machine.communicate.sudo("shutdown -p now", {shell: "sh"})
rescue IOError rescue IOError
# Do nothing because SSH connection closed and it probably # Do nothing because SSH connection closed and it probably
# means the VM just shut down really fast. # means the VM just shut down really fast.

View File

@ -4,8 +4,8 @@ module VagrantPlugins
class MountNFSFolder class MountNFSFolder
def self.mount_nfs_folder(machine, ip, folders) def self.mount_nfs_folder(machine, ip, folders)
folders.each do |name, opts| folders.each do |name, opts|
machine.communicate.sudo("mkdir -p #{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"}) machine.communicate.sudo("mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'", {shell: "sh"})
end end
end end
end end

View File

@ -7,7 +7,7 @@ module VagrantPlugins
# Contributed by Kenneth Vestergaard <kvs@binarysolutions.dk> # Contributed by Kenneth Vestergaard <kvs@binarysolutions.dk>
class Guest < Vagrant.plugin("2", :guest) class Guest < Vagrant.plugin("2", :guest)
def detect?(machine) def detect?(machine)
machine.communicate.test("uname -s | grep 'FreeBSD'", {:shell => "sh"}) machine.communicate.test("uname -s | grep 'FreeBSD'", {shell: "sh"})
end end
end end
end end

View File

@ -22,7 +22,7 @@ module VagrantPlugins
comm.sudo(cmd) comm.sudo(cmd)
ifFile = "netif.eth#{network[:interface]}" ifFile = "netif.eth#{network[:interface]}"
entry = TemplateRenderer.render("guests/funtoo/network_#{network[:type]}", entry = TemplateRenderer.render("guests/funtoo/network_#{network[:type]}",
:options => network) options: network)
# Upload the entry to a temporary location # Upload the entry to a temporary location
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
temp.binmode temp.binmode

View File

@ -18,7 +18,7 @@ module VagrantPlugins
# Configure each network interface # Configure each network interface
networks.each do |network| networks.each do |network|
entry = TemplateRenderer.render("guests/gentoo/network_#{network[:type]}", entry = TemplateRenderer.render("guests/gentoo/network_#{network[:type]}",
:options => network) options: network)
# Upload the entry to a temporary location # Upload the entry to a temporary location
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")

View File

@ -27,9 +27,9 @@ module VagrantPlugins
end end
mount_command = "mount -o '#{mount_opts.join(",")}' #{ip}:'#{hostpath}' #{expanded_guest_path}" 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, machine.communicate.sudo(mount_command,
:error_class => Vagrant::Errors::LinuxNFSMountFailed) error_class: Vagrant::Errors::LinuxNFSMountFailed)
end end
# Emit an upstart event if we can # Emit an upstart event if we can

View File

@ -4,7 +4,7 @@ module VagrantPlugins
class ChangeHostName class ChangeHostName
def self.change_host_name(machine, name) def self.change_host_name(machine, name)
if !machine.communicate.test("hostname -s | grep '^#{name}$'") if !machine.communicate.test("hostname -s | grep '^#{name}$'")
machine.communicate.sudo(<<CMDS, {:shell => "sh"}) machine.communicate.sudo(<<CMDS, {shell: "sh"})
set -e set -e
sed -e 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf > /tmp/rc.conf.vagrant_changehostname_#{name} 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 mv /tmp/rc.conf.vagrant_changehostname_#{name} /etc/rc.conf

View File

@ -18,7 +18,7 @@ module VagrantPlugins
# create an interface configuration file fragment # create an interface configuration file fragment
entry = TemplateRenderer.render("guests/netbsd/network_#{network[:type]}", entry = TemplateRenderer.render("guests/netbsd/network_#{network[:type]}",
:options => network) options: network)
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
temp.binmode temp.binmode
@ -32,8 +32,8 @@ module VagrantPlugins
ifname = "wm#{network[:interface]}" ifname = "wm#{network[:interface]}"
# remove old configuration # remove old configuration
machine.communicate.sudo("/sbin/dhcpcd -x #{ifname}", { :error_check => false }) 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/ifconfig #{ifname} inet delete", { error_check: false })
# live new configuration # live new configuration
if network[:type].to_sym == :static if network[:type].to_sym == :static

View File

@ -4,7 +4,7 @@ module VagrantPlugins
class MountNFSFolder class MountNFSFolder
def self.mount_nfs_folder(machine, ip, folders) def self.mount_nfs_folder(machine, ip, folders)
folders.each do |name, opts| folders.each do |name, opts|
machine.communicate.sudo(<<CMDS, {:shell => "sh"}) machine.communicate.sudo(<<CMDS, {shell: "sh"})
set -e set -e
mkdir -p #{opts[:guestpath]} mkdir -p #{opts[:guestpath]}
/sbin/mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}' /sbin/mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'

View File

@ -10,7 +10,7 @@ module VagrantPlugins
def self.change_host_name(machine, name) def self.change_host_name(machine, name)
# upload the config file # 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") upload(machine, hostname_module, "/etc/nixos/vagrant-hostname.nix")
end end

View File

@ -19,7 +19,7 @@ module VagrantPlugins
assign_device_names(machine, networks) assign_device_names(machine, networks)
# upload the config file # 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") upload(machine, network_module, "/etc/nixos/vagrant-network.nix")
end end
@ -111,9 +111,9 @@ module VagrantPlugins
# populate the interface list # populate the interface list
kernel_if_names.each_index do |i| kernel_if_names.each_index do |i|
interfaces << { interfaces << {
:kernel => kernel_if_names[i], kernel: kernel_if_names[i],
:ethn => ethns[i], ethn: ethns[i],
:mac_address => mac_addresses[i] mac_address: mac_addresses[i]
} }
end end

View File

@ -11,7 +11,7 @@ module VagrantPlugins
def self.configure_networks(machine, networks) def self.configure_networks(machine, networks)
networks.each do |network| networks.each do |network|
entry = TemplateRenderer.render("guests/openbsd/network_#{network[:type]}", entry = TemplateRenderer.render("guests/openbsd/network_#{network[:type]}",
:options => network) options: network)
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
temp.binmode temp.binmode
@ -35,8 +35,8 @@ module VagrantPlugins
machine.communicate.sudo("mv /tmp/vagrant-network-entry /etc/hostname.#{ifname}") machine.communicate.sudo("mv /tmp/vagrant-network-entry /etc/hostname.#{ifname}")
# remove old configurations # remove old configurations
machine.communicate.sudo("sudo ifconfig #{ifname} inet delete", { :error_check => false }) machine.communicate.sudo("sudo ifconfig #{ifname} inet delete", { error_check: false })
machine.communicate.sudo("pkill -f 'dhclient: #{ifname}'", { :error_check => false }) machine.communicate.sudo("pkill -f 'dhclient: #{ifname}'", { error_check: false })
if network[:type].to_sym == :static if network[:type].to_sym == :static
machine.communicate.sudo("ifconfig #{ifname} inet #{network[:ip]} netmask #{network[:netmask]}") machine.communicate.sudo("ifconfig #{ifname} inet #{network[:ip]} netmask #{network[:netmask]}")

View File

@ -36,7 +36,7 @@ module VagrantPlugins
# Render and upload the network entry file to a deterministic # Render and upload the network entry file to a deterministic
# temporary location. # temporary location.
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}", entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
:options => network) options: network)
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
temp.binmode temp.binmode
@ -50,7 +50,7 @@ module VagrantPlugins
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so # each specifically, we avoid reconfiguring eth0 (the NAT interface) so
# SSH never dies. # SSH never dies.
interfaces.each do |interface| 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 # The interface should already be down so this probably
# won't do anything, so we run it with error_check false. # won't do anything, so we run it with error_check false.
machine.communicate.sudo( machine.communicate.sudo(

View File

@ -7,8 +7,8 @@ module VagrantPlugins
folders.each do |name, opts| folders.each do |name, opts|
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
comm.execute("#{sudo} mkdir -p #{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"}) comm.execute("#{sudo} /usr/sbin/mount -F nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'", {shell: "sh"})
end end
end end
end end

View File

@ -31,7 +31,7 @@ module VagrantPlugins
# Render and upload the network entry file to a deterministic # Render and upload the network entry file to a deterministic
# temporary location. # temporary location.
entry = TemplateRenderer.render("guests/suse/network_#{network[:type]}", entry = TemplateRenderer.render("guests/suse/network_#{network[:type]}",
:options => network) options: network)
temp = Tempfile.new("vagrant") temp = Tempfile.new("vagrant")
temp.binmode temp.binmode
@ -45,8 +45,8 @@ module VagrantPlugins
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so # each specifically, we avoid reconfiguring eth0 (the NAT interface) so
# SSH never dies. # SSH never dies.
interfaces.each do |interface| 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("/sbin/ifdown eth#{interface} 2> /dev/null", :error_check => false) 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("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-eth#{interface}")
machine.communicate.sudo("/sbin/ifup eth#{interface} 2> /dev/null") machine.communicate.sudo("/sbin/ifup eth#{interface} 2> /dev/null")
end end

View File

@ -6,7 +6,7 @@ module VagrantPlugins
# On windows, renaming a computer seems to require a reboot # On windows, renaming a computer seems to require a reboot
machine.communicate.execute( machine.communicate.execute(
"wmic computersystem where name=\"%COMPUTERNAME%\" call rename name=\"#{name}\"", "wmic computersystem where name=\"%COMPUTERNAME%\" call rename name=\"#{name}\"",
:shell => :cmd) shell: :cmd)
end end
end end
end end

View File

@ -66,10 +66,10 @@ module VagrantPlugins
naked_mac = nic[:mac_address].gsub(':','') naked_mac = nic[:mac_address].gsub(':','')
if driver_mac_address[naked_mac] if driver_mac_address[naked_mac]
vm_interface_map[driver_mac_address[naked_mac]] = { vm_interface_map[driver_mac_address[naked_mac]] = {
:net_connection_id => nic[:net_connection_id], net_connection_id: nic[:net_connection_id],
:mac_address => naked_mac, mac_address: naked_mac,
:interface_index => nic[:interface_index], interface_index: nic[:interface_index],
:index => nic[:index] } index: nic[:index] }
end end
end end

View File

@ -93,7 +93,7 @@ module VagrantPlugins
# Get all NICs that have a MAC address # Get all NICs that have a MAC address
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394216(v=vs.85).aspx # 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}") @logger.debug("#{adapters.inspect}")
return adapters return adapters
end end

View File

@ -89,10 +89,10 @@ module VagrantPlugins
end end
output = Vagrant::Util::TemplateRenderer.render(nfs_exports_template, output = Vagrant::Util::TemplateRenderer.render(nfs_exports_template,
:uuid => id, uuid: id,
:ips => ips, ips: ips,
:folders => dirmap, folders: dirmap,
:user => Process.uid) user: Process.uid)
# The sleep ensures that the output is truly flushed before any `sudo` # The sleep ensures that the output is truly flushed before any `sudo`
# commands are issued. # commands are issued.

View File

@ -28,10 +28,10 @@ module VagrantPlugins
nfs_opts_setup(folders) nfs_opts_setup(folders)
output = Vagrant::Util::TemplateRenderer.render('nfs/exports_linux', output = Vagrant::Util::TemplateRenderer.render('nfs/exports_linux',
:uuid => id, uuid: id,
:ips => ips, ips: ips,
:folders => folders, folders: folders,
:user => Process.uid) user: Process.uid)
ui.info I18n.t("vagrant.hosts.linux.nfs_export") ui.info I18n.t("vagrant.hosts.linux.nfs_export")
sleep 0.5 sleep 0.5
@ -51,7 +51,7 @@ module VagrantPlugins
end end
def self.nfs_installed(environment) 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 # Check procfs to see if NFSd is a supported filesystem
system("cat /proc/filesystems | grep nfsd > /dev/null 2>&1") system("cat /proc/filesystems | grep nfsd > /dev/null 2>&1")
end end

View File

@ -41,14 +41,14 @@ module VagrantPlugins
def share_folder(name, guestpath, hostpath, opts=nil) def share_folder(name, guestpath, hostpath, opts=nil)
@shared_folders[name] = { @shared_folders[name] = {
:guestpath => guestpath.to_s, guestpath: guestpath.to_s,
:hostpath => hostpath.to_s, hostpath: hostpath.to_s,
:create => false, create: false,
:owner => nil, owner: nil,
:group => nil, group: nil,
:nfs => false, nfs: false,
:transient => false, transient: false,
:extra => nil extra: nil
}.merge(opts || {}) }.merge(opts || {})
end end

View File

@ -551,11 +551,11 @@ module VagrantPlugins
if guestpath.relative? && guestpath.to_s !~ /^\w+:/ if guestpath.relative? && guestpath.to_s !~ /^\w+:/
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative", errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative",
:path => options[:guestpath]) path: options[:guestpath])
else else
if used_guest_paths.include?(options[:guestpath]) if used_guest_paths.include?(options[:guestpath])
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_duplicate", errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_duplicate",
:path => options[:guestpath]) path: options[:guestpath])
end end
used_guest_paths.add(options[:guestpath]) used_guest_paths.add(options[:guestpath])
@ -563,14 +563,14 @@ module VagrantPlugins
if !hostpath.directory? && !options[:create] if !hostpath.directory? && !options[:create]
errors << I18n.t("vagrant.config.vm.shared_folder_hostpath_missing", errors << I18n.t("vagrant.config.vm.shared_folder_hostpath_missing",
:path => options[:hostpath]) path: options[:hostpath])
end end
if options[:type] == :nfs if options[:type] == :nfs
if options[:owner] || options[:group] if options[:owner] || options[:group]
# Owner/group don't work with NFS # Owner/group don't work with NFS
errors << I18n.t("vagrant.config.vm.shared_folder_nfs_owner_group", errors << I18n.t("vagrant.config.vm.shared_folder_nfs_owner_group",
:path => options[:hostpath]) path: options[:hostpath])
end end
end end
@ -593,7 +593,7 @@ module VagrantPlugins
networks.each do |type, options| networks.each do |type, options|
if !valid_network_types.include?(type) if !valid_network_types.include?(type)
errors << I18n.t("vagrant.config.vm.network_type_invalid", errors << I18n.t("vagrant.config.vm.network_type_invalid",
:type => type.to_s) type: type.to_s)
end end
if type == :forwarded_port if type == :forwarded_port
@ -606,8 +606,8 @@ module VagrantPlugins
key = "#{options[:protocol]}#{options[:host]}" key = "#{options[:protocol]}#{options[:host]}"
if fp_used.include?(key) if fp_used.include?(key)
errors << I18n.t("vagrant.config.vm.network_fp_host_not_unique", errors << I18n.t("vagrant.config.vm.network_fp_host_not_unique",
:host => options[:host].to_s, host: options[:host].to_s,
:protocol => options[:protocol].to_s) protocol: options[:protocol].to_s)
end end
fp_used.add(key) fp_used.add(key)
@ -647,7 +647,7 @@ module VagrantPlugins
@provisioners.each do |vm_provisioner| @provisioners.each do |vm_provisioner|
if vm_provisioner.invalid? if vm_provisioner.invalid?
errors["vm"] << I18n.t("vagrant.config.vm.provisioner_not_found", errors["vm"] << I18n.t("vagrant.config.vm.provisioner_not_found",
:name => vm_provisioner.name) name: vm_provisioner.name)
next next
end end

View File

@ -148,7 +148,7 @@ module VagrantPlugins
b3.use Call, DestroyConfirm do |env3, b4| b3.use Call, DestroyConfirm do |env3, b4|
if env3[:result] if env3[:result]
b4.use ConfigValidate b4.use ConfigValidate
b4.use EnvSet, :force_halt => true b4.use EnvSet, force_halt: true
b4.use action_halt b4.use action_halt
b4.use HostMachineSyncFoldersDisable b4.use HostMachineSyncFoldersDisable
b4.use Destroy b4.use Destroy

View File

@ -9,7 +9,7 @@ module VagrantPlugins
class Local class Local
def execute(*cmd, **opts, &block) def execute(*cmd, **opts, &block)
# Append in the options for subprocess # Append in the options for subprocess
cmd << { :notify => [:stdout, :stderr] } cmd << { notify: [:stdout, :stderr] }
interrupted = false interrupted = false
int_callback = ->{ interrupted = true } int_callback = ->{ interrupted = true }

View File

@ -8,7 +8,7 @@ module VagrantPlugins
def call(env) def call(env)
env[:ui].info I18n.t("vagrant.commands.destroy.will_not_destroy", env[:ui].info I18n.t("vagrant.commands.destroy.will_not_destroy",
:name => env[:machine].name) name: env[:machine].name)
@app.call(env) @app.call(env)
end end
end end

View File

@ -54,7 +54,7 @@ module VagrantPlugins
b.use SetName b.use SetName
b.use ClearForwardedPorts b.use ClearForwardedPorts
b.use Provision b.use Provision
b.use EnvSet, :port_collision_repair => true b.use EnvSet, port_collision_repair: true
b.use PrepareForwardedPortCollisionParams b.use PrepareForwardedPortCollisionParams
b.use HandleForwardedPortCollisions b.use HandleForwardedPortCollisions
b.use PrepareNFSValidIds b.use PrepareNFSValidIds
@ -89,7 +89,7 @@ module VagrantPlugins
b2.use Call, DestroyConfirm do |env2, b3| b2.use Call, DestroyConfirm do |env2, b3|
if env2[:result] if env2[:result]
b3.use CheckAccessible b3.use CheckAccessible
b3.use EnvSet, :force_halt => true b3.use EnvSet, force_halt: true
b3.use action_halt b3.use action_halt
b3.use Destroy b3.use Destroy
b3.use CleanMachineFolder b3.use CleanMachineFolder
@ -206,7 +206,7 @@ module VagrantPlugins
b.use Call, Created do |env, b2| b.use Call, Created do |env, b2|
if env[:result] if env[:result]
b2.use CheckAccessible b2.use CheckAccessible
b2.use EnvSet, :port_collision_repair => false b2.use EnvSet, port_collision_repair: false
b2.use PrepareForwardedPortCollisionParams b2.use PrepareForwardedPortCollisionParams
b2.use HandleForwardedPortCollisions b2.use HandleForwardedPortCollisions
b2.use Resume b2.use Resume

View File

@ -40,8 +40,8 @@ module VagrantPlugins
if guest_version != vb_version if guest_version != vb_version
env[:ui].detail(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch", env[:ui].detail(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
:guest_version => version, guest_version: version,
:virtualbox_version => vb_version)) virtualbox_version: vb_version))
end end
end end

View File

@ -14,8 +14,8 @@ module VagrantPlugins
adapters = [] adapters = []
2.upto(env[:machine].provider.driver.max_network_adapters).each do |i| 2.upto(env[:machine].provider.driver.max_network_adapters).each do |i|
adapters << { adapters << {
:adapter => i, adapter: i,
:type => :none type: :none
} }
end end

View File

@ -30,8 +30,8 @@ module VagrantPlugins
processed_command + [retryable: true]) processed_command + [retryable: true])
rescue Vagrant::Errors::VBoxManageError => e rescue Vagrant::Errors::VBoxManageError => e
raise Vagrant::Errors::VMCustomizationFailed, { raise Vagrant::Errors::VMCustomizationFailed, {
:command => command, command: command,
:error => e.inspect error: e.inspect
} }
end end
end end

View File

@ -38,9 +38,9 @@ module VagrantPlugins
@env[:forwarded_ports].each do |fp| @env[:forwarded_ports].each do |fp|
message_attributes = { message_attributes = {
:adapter => fp.adapter, adapter: fp.adapter,
:guest_port => fp.guest_port, guest_port: fp.guest_port,
:host_port => fp.host_port host_port: fp.host_port
} }
# Assuming the only reason to establish port forwarding is # Assuming the only reason to establish port forwarding is
@ -53,9 +53,9 @@ module VagrantPlugins
# Verify we have the network interface to attach to # Verify we have the network interface to attach to
if !interfaces[fp.adapter] if !interfaces[fp.adapter]
raise Vagrant::Errors::ForwardPortAdapterNotFound, raise Vagrant::Errors::ForwardPortAdapterNotFound,
:adapter => fp.adapter.to_s, adapter: fp.adapter.to_s,
:guest => fp.guest_port.to_s, guest: fp.guest_port.to_s,
:host => fp.host_port.to_s host: fp.host_port.to_s
end end
# Port forwarding requires the network interface to be a NAT interface, # 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 # Add the options to the ports array to send to the driver later
ports << { ports << {
:adapter => fp.adapter, adapter: fp.adapter,
:guestip => fp.guest_ip, guestip: fp.guest_ip,
:guestport => fp.guest_port, guestport: fp.guest_port,
:hostip => fp.host_ip, hostip: fp.host_ip,
:hostport => fp.host_port, hostport: fp.host_port,
:name => fp.id, name: fp.id,
:protocol => fp.protocol protocol: fp.protocol
} }
end end

View File

@ -8,7 +8,7 @@ module VagrantPlugins
def call(env) def call(env)
env[:ui].info I18n.t("vagrant.actions.vm.import.importing", env[:ui].info I18n.t("vagrant.actions.vm.import.importing",
:name => env[:machine].box.name) name: env[:machine].box.name)
# Import the virtual machine # Import the virtual machine
ovf_file = env[:machine].box.directory.join("box.ovf").to_s 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