From bb052366f7f9616666299a97edcceadae007394a Mon Sep 17 00:00:00 2001 From: Kalman Hazins Date: Thu, 22 May 2014 12:35:12 -0400 Subject: [PATCH] Change symbols inside hashes to 1.9 JSON-like syntax --- Rakefile | 2 +- bin/vagrant | 2 +- lib/vagrant/action/builtin/box_remove.rb | 6 +- lib/vagrant/action/builtin/config_validate.rb | 4 +- lib/vagrant/action/builtin/destroy_confirm.rb | 2 +- .../handle_forwarded_port_collisions.rb | 16 +-- lib/vagrant/action/general/package.rb | 8 +- lib/vagrant/batch_action.rb | 10 +- lib/vagrant/box.rb | 2 +- lib/vagrant/box_collection.rb | 4 +- lib/vagrant/bundler.rb | 2 +- lib/vagrant/capability_host.rb | 8 +- lib/vagrant/cli.rb | 2 +- lib/vagrant/config/loader.rb | 6 +- lib/vagrant/config/v2/loader.rb | 2 +- lib/vagrant/config/v2/root.rb | 2 +- lib/vagrant/environment.rb | 42 +++--- lib/vagrant/machine.rb | 12 +- lib/vagrant/plugin/state_file.rb | 2 +- lib/vagrant/plugin/v1/command.rb | 4 +- lib/vagrant/plugin/v1/guest.rb | 18 +-- lib/vagrant/plugin/v1/provider.rb | 8 +- lib/vagrant/plugin/v2/command.rb | 10 +- lib/vagrant/plugin/v2/config.rb | 2 +- lib/vagrant/plugin/v2/provider.rb | 8 +- lib/vagrant/registry.rb | 4 +- lib/vagrant/ui.rb | 8 +- lib/vagrant/util/downloader.rb | 4 +- lib/vagrant/util/retryable.rb | 2 +- lib/vagrant/util/safe_puts.rb | 4 +- lib/vagrant/util/scoped_hash_override.rb | 10 +- lib/vagrant/util/ssh.rb | 22 ++-- lib/vagrant/util/subprocess.rb | 2 +- lib/vagrant/util/template_renderer.rb | 2 +- lib/vagrant/vagrantfile.rb | 8 +- plugins/commands/box/command/list.rb | 2 +- plugins/commands/box/command/remove.rb | 8 +- plugins/commands/box/command/repackage.rb | 2 +- plugins/commands/box/command/root.rb | 2 +- plugins/commands/destroy/command.rb | 4 +- plugins/commands/halt/command.rb | 2 +- plugins/commands/init/command.rb | 4 +- plugins/commands/package/command.rb | 2 +- plugins/commands/plugin/action/install_gem.rb | 10 +- .../commands/plugin/action/license_plugin.rb | 8 +- .../plugin/action/uninstall_plugin.rb | 2 +- plugins/commands/plugin/command/install.rb | 12 +- plugins/commands/plugin/command/license.rb | 6 +- plugins/commands/plugin/command/list.rb | 2 +- plugins/commands/plugin/command/root.rb | 2 +- plugins/commands/plugin/command/uninstall.rb | 4 +- plugins/commands/plugin/command/update.rb | 2 +- plugins/commands/ssh/command.rb | 8 +- plugins/commands/ssh_config/command.rb | 16 +-- plugins/commands/status/command.rb | 6 +- plugins/commands/up/command.rb | 6 +- plugins/communicators/ssh/communicator.rb | 50 +++---- plugins/communicators/winrm/communicator.rb | 2 +- plugins/communicators/winrm/file_manager.rb | 6 +- plugins/communicators/winrm/shell.rb | 30 ++--- plugins/guests/arch/cap/configure_networks.rb | 2 +- .../guests/coreos/cap/configure_networks.rb | 10 +- plugins/guests/darwin/cap/mount_nfs_folder.rb | 2 +- .../darwin/cap/mount_vmware_shared_folder.rb | 6 +- .../guests/debian/cap/configure_networks.rb | 2 +- plugins/guests/esxi/cap/mount_nfs_folder.rb | 4 +- .../guests/fedora/cap/configure_networks.rb | 6 +- .../guests/freebsd/cap/change_host_name.rb | 6 +- .../guests/freebsd/cap/configure_networks.rb | 12 +- plugins/guests/freebsd/cap/halt.rb | 2 +- .../guests/freebsd/cap/mount_nfs_folder.rb | 4 +- plugins/guests/freebsd/guest.rb | 2 +- .../guests/funtoo/cap/configure_networks.rb | 2 +- .../guests/gentoo/cap/configure_networks.rb | 2 +- plugins/guests/linux/cap/mount_nfs.rb | 4 +- plugins/guests/netbsd/cap/change_host_name.rb | 2 +- .../guests/netbsd/cap/configure_networks.rb | 6 +- plugins/guests/netbsd/cap/mount_nfs_folder.rb | 2 +- plugins/guests/nixos/cap/change_host_name.rb | 2 +- .../guests/nixos/cap/configure_networks.rb | 8 +- .../guests/openbsd/cap/configure_networks.rb | 6 +- .../guests/redhat/cap/configure_networks.rb | 4 +- plugins/guests/smartos/cap/mount_nfs.rb | 4 +- plugins/guests/suse/cap/configure_networks.rb | 6 +- .../guests/windows/cap/change_host_name.rb | 2 +- .../guests/windows/cap/configure_networks.rb | 8 +- plugins/guests/windows/guest_network.rb | 2 +- plugins/hosts/bsd/cap/nfs.rb | 8 +- plugins/hosts/linux/cap/nfs.rb | 10 +- plugins/kernel_v1/config/vm.rb | 16 +-- plugins/kernel_v2/config/vm.rb | 16 +-- plugins/providers/docker/action.rb | 2 +- plugins/providers/docker/executor/local.rb | 2 +- .../hyperv/action/message_will_not_destroy.rb | 2 +- plugins/providers/virtualbox/action.rb | 6 +- .../action/check_guest_additions.rb | 4 +- .../action/clear_network_interfaces.rb | 4 +- .../providers/virtualbox/action/customize.rb | 4 +- .../virtualbox/action/forward_ports.rb | 26 ++-- plugins/providers/virtualbox/action/import.rb | 2 +- .../action/message_will_not_destroy.rb | 2 +- .../providers/virtualbox/action/network.rb | 122 +++++++++--------- .../virtualbox/action/package_vagrantfile.rb | 2 +- .../providers/virtualbox/action/set_name.rb | 2 +- .../virtualbox/action/setup_package_files.rb | 2 +- plugins/providers/virtualbox/driver/base.rb | 26 ++-- .../virtualbox/driver/version_4_0.rb | 36 +++--- .../virtualbox/driver/version_4_1.rb | 36 +++--- .../virtualbox/driver/version_4_2.rb | 40 +++--- .../virtualbox/driver/version_4_3.rb | 38 +++--- plugins/providers/virtualbox/provider.rb | 4 +- plugins/providers/virtualbox/synced_folder.rb | 2 +- plugins/provisioners/ansible/config.rb | 10 +- plugins/provisioners/ansible/provisioner.rb | 8 +- .../cap/linux/cfengine_needs_bootstrap.rb | 4 +- plugins/provisioners/cfengine/provisioner.rb | 2 +- plugins/provisioners/chef/provisioner/base.rb | 42 +++--- .../chef/provisioner/chef_client.rb | 10 +- .../chef/provisioner/chef_solo.rb | 12 +- plugins/provisioners/file/config.rb | 2 +- plugins/provisioners/puppet/config/puppet.rb | 6 +- .../provisioners/puppet/provisioner/puppet.rb | 8 +- .../puppet/provisioner/puppet_server.rb | 6 +- plugins/provisioners/shell/config.rb | 2 +- plugins/provisioners/shell/provisioner.rb | 2 +- plugins/synced_folders/smb/synced_folder.rb | 16 +-- templates/commands/init/Vagrantfile.erb | 2 +- .../commands/ssh_config/command_test.rb | 20 +-- .../winrm/command_filter_test.rb | 2 +- .../communicators/winrm/communicator_test.rb | 10 +- .../smartos/cap/configure_networks_test.rb | 4 +- .../guests/smartos/cap/mount_nfs_test.rb | 4 +- .../action/prepare_nfs_settings_test.rb | 6 +- .../provisioners/ansible/config_test.rb | 22 ++-- test/unit/support/isolated_environment.rb | 10 +- test/unit/vagrant/action/builder_test.rb | 4 +- test/unit/vagrant/action/builtin/call_test.rb | 4 +- .../vagrant/action/builtin/confirm_test.rb | 2 +- .../vagrant/action/builtin/env_set_test.rb | 4 +- .../action/builtin/graceful_halt_test.rb | 6 +- .../vagrant/action/builtin/is_state_test.rb | 2 +- test/unit/vagrant/action/builtin/lock_test.rb | 10 +- .../vagrant/action/builtin/message_test.rb | 2 +- .../builtin/mixin_synced_folders_test.rb | 12 +- .../vagrant/action/builtin/ssh_exec_test.rb | 4 +- .../builtin/synced_folder_cleanup_test.rb | 8 +- .../action/builtin/synced_folders_test.rb | 8 +- test/unit/vagrant/action/warden_test.rb | 4 +- test/unit/vagrant/batch_action_test.rb | 4 +- test/unit/vagrant/config/v1/loader_test.rb | 12 +- test/unit/vagrant/config/v1/root_test.rb | 4 +- test/unit/vagrant/config/v2/loader_test.rb | 16 +-- test/unit/vagrant/config/v2/root_test.rb | 8 +- test/unit/vagrant/environment_test.rb | 36 +++--- test/unit/vagrant/guest_test.rb | 8 +- test/unit/vagrant/machine_test.rb | 8 +- test/unit/vagrant/plugin/v1/command_test.rb | 16 +-- test/unit/vagrant/plugin/v2/command_test.rb | 52 ++++---- test/unit/vagrant/util/downloader_test.rb | 4 +- test/unit/vagrant/util/retryable_test.rb | 10 +- .../vagrant/util/scoped_hash_override_test.rb | 24 ++-- test/unit/vagrant_test.rb | 2 +- website/docs/config.rb | 8 +- website/docs/config.ru | 14 +- .../v2/getting-started/networking.html.md | 2 +- .../v2/getting-started/provisioning.html.md | 2 +- .../source/v2/multi-machine/index.html.md | 6 +- .../v2/networking/public_network.html.md | 2 +- .../docs/source/v2/plugins/commands.html.md | 2 +- .../v2/plugins/development-basics.html.md | 2 +- .../docs/source/v2/plugins/packaging.html.md | 2 +- website/www/config.rb | 4 +- website/www/config.ru | 14 +- 173 files changed, 761 insertions(+), 761 deletions(-) diff --git a/Rakefile b/Rakefile index 84ada2d5e..2af398a1e 100644 --- a/Rakefile +++ b/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" diff --git a/bin/vagrant b/bin/vagrant index 4210c06c2..b566e643b 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -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 diff --git a/lib/vagrant/action/builtin/box_remove.rb b/lib/vagrant/action/builtin/box_remove.rb index 26924612b..1d0cea7fd 100644 --- a/lib/vagrant/action/builtin/box_remove.rb +++ b/lib/vagrant/action/builtin/box_remove.rb @@ -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 diff --git a/lib/vagrant/action/builtin/config_validate.rb b/lib/vagrant/action/builtin/config_validate.rb index 0f727da32..e4fd44cdd 100644 --- a/lib/vagrant/action/builtin/config_validate.rb +++ b/lib/vagrant/action/builtin/config_validate.rb @@ -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 diff --git a/lib/vagrant/action/builtin/destroy_confirm.rb b/lib/vagrant/action/builtin/destroy_confirm.rb index 3a2272c3d..db4d25cd3 100644 --- a/lib/vagrant/action/builtin/destroy_confirm.rb +++ b/lib/vagrant/action/builtin/destroy_confirm.rb @@ -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 diff --git a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb index 467c3167f..b53ba35c2 100644 --- a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +++ b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb @@ -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 diff --git a/lib/vagrant/action/general/package.rb b/lib/vagrant/action/general/package.rb index 6c44491fa..ee7e30ec3 100644 --- a/lib/vagrant/action/general/package.rb +++ b/lib/vagrant/action/general/package.rb @@ -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 diff --git a/lib/vagrant/batch_action.rb b/lib/vagrant/batch_action.rb index aaae23732..9b6900f2d 100644 --- a/lib/vagrant/batch_action.rb +++ b/lib/vagrant/batch_action.rb @@ -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 diff --git a/lib/vagrant/box.rb b/lib/vagrant/box.rb index 7daef43a0..537c94e2a 100644 --- a/lib/vagrant/box.rb +++ b/lib/vagrant/box.rb @@ -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) diff --git a/lib/vagrant/box_collection.rb b/lib/vagrant/box_collection.rb index 70bf1befe..0bc81b9aa 100644 --- a/lib/vagrant/box_collection.rb +++ b/lib/vagrant/box_collection.rb @@ -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 diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb index f569e3f63..8c8e5a566 100644 --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -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 diff --git a/lib/vagrant/capability_host.rb b/lib/vagrant/capability_host.rb index 6c2161f7e..e3b579a49 100644 --- a/lib/vagrant/capability_host.rb +++ b/lib/vagrant/capability_host.rb @@ -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 diff --git a/lib/vagrant/cli.rb b/lib/vagrant/cli.rb index aecfc1b2e..a6e9655f0 100644 --- a/lib/vagrant/cli.rb +++ b/lib/vagrant/cli.rb @@ -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 diff --git a/lib/vagrant/config/loader.rb b/lib/vagrant/config/loader.rb index feaca4377..f57b5d31e 100644 --- a/lib/vagrant/config/loader.rb +++ b/lib/vagrant/config/loader.rb @@ -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 diff --git a/lib/vagrant/config/v2/loader.rb b/lib/vagrant/config/v2/loader.rb index ac7c34d05..1c3bc0224 100644 --- a/lib/vagrant/config/v2/loader.rb +++ b/lib/vagrant/config/v2/loader.rb @@ -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] diff --git a/lib/vagrant/config/v2/root.rb b/lib/vagrant/config/v2/root.rb index 85ba6a0ab..f64129dad 100644 --- a/lib/vagrant/config/v2/root.rb +++ b/lib/vagrant/config/v2/root.rb @@ -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 diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 375452914..021eb47ae 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -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 diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 9f80181d9..765813b07 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -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 diff --git a/lib/vagrant/plugin/state_file.rb b/lib/vagrant/plugin/state_file.rb index faf92c0ec..4a39a52bc 100644 --- a/lib/vagrant/plugin/state_file.rb +++ b/lib/vagrant/plugin/state_file.rb @@ -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"] diff --git a/lib/vagrant/plugin/v1/command.rb b/lib/vagrant/plugin/v1/command.rb index e40e9077d..8d023ae3e 100644 --- a/lib/vagrant/plugin/v1/command.rb +++ b/lib/vagrant/plugin/v1/command.rb @@ -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 diff --git a/lib/vagrant/plugin/v1/guest.rb b/lib/vagrant/plugin/v1/guest.rb index a62cbbce6..cab2cca94 100644 --- a/lib/vagrant/plugin/v1/guest.rb +++ b/lib/vagrant/plugin/v1/guest.rb @@ -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 diff --git a/lib/vagrant/plugin/v1/provider.rb b/lib/vagrant/plugin/v1/provider.rb index 0a71e134c..4a18bbe13 100644 --- a/lib/vagrant/plugin/v1/provider.rb +++ b/lib/vagrant/plugin/v1/provider.rb @@ -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, diff --git a/lib/vagrant/plugin/v2/command.rb b/lib/vagrant/plugin/v2/command.rb index 8f957b901..a702b767c 100644 --- a/lib/vagrant/plugin/v2/command.rb +++ b/lib/vagrant/plugin/v2/command.rb @@ -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 diff --git a/lib/vagrant/plugin/v2/config.rb b/lib/vagrant/plugin/v2/config.rb index 6588f093c..20e08cbfe 100644 --- a/lib/vagrant/plugin/v2/config.rb +++ b/lib/vagrant/plugin/v2/config.rb @@ -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. diff --git a/lib/vagrant/plugin/v2/provider.rb b/lib/vagrant/plugin/v2/provider.rb index 59bc0c089..0ea7a1f13 100644 --- a/lib/vagrant/plugin/v2/provider.rb +++ b/lib/vagrant/plugin/v2/provider.rb @@ -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, diff --git a/lib/vagrant/registry.rb b/lib/vagrant/registry.rb index e69574ed8..5095f2097 100644 --- a/lib/vagrant/registry.rb +++ b/lib/vagrant/registry.rb @@ -77,8 +77,8 @@ module Vagrant def __internal_state { - :items => @items, - :results_cache => @results_cache + items: @items, + results_cache: @results_cache } end end diff --git a/lib/vagrant/ui.rb b/lib/vagrant/ui.rb index 3ec7821e2..4b47c3e1f 100644 --- a/lib/vagrant/ui.rb +++ b/lib/vagrant/ui.rb @@ -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 diff --git a/lib/vagrant/util/downloader.rb b/lib/vagrant/util/downloader.rb index 01d92b38e..c671b863d 100644 --- a/lib/vagrant/util/downloader.rb +++ b/lib/vagrant/util/downloader.rb @@ -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 diff --git a/lib/vagrant/util/retryable.rb b/lib/vagrant/util/retryable.rb index 780c4416a..ac73b20b9 100644 --- a/lib/vagrant/util/retryable.rb +++ b/lib/vagrant/util/retryable.rb @@ -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 diff --git a/lib/vagrant/util/safe_puts.rb b/lib/vagrant/util/safe_puts.rb index 6aed4b39e..d6381e62b 100644 --- a/lib/vagrant/util/safe_puts.rb +++ b/lib/vagrant/util/safe_puts.rb @@ -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 diff --git a/lib/vagrant/util/scoped_hash_override.rb b/lib/vagrant/util/scoped_hash_override.rb index ebe1e4959..d7c67adf0 100644 --- a/lib/vagrant/util/scoped_hash_override.rb +++ b/lib/vagrant/util/scoped_hash_override.rb @@ -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 diff --git a/lib/vagrant/util/ssh.rb b/lib/vagrant/util/ssh.rb index 681c8ad20..a13314a62 100644 --- a/lib/vagrant/util/ssh.rb +++ b/lib/vagrant/util/ssh.rb @@ -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 diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index 37490452f..fe3b5cf01 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -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 diff --git a/lib/vagrant/util/template_renderer.rb b/lib/vagrant/util/template_renderer.rb index ec0c0179e..d794f1426 100644 --- a/lib/vagrant/util/template_renderer.rb +++ b/lib/vagrant/util/template_renderer.rb @@ -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 diff --git a/lib/vagrant/vagrantfile.rb b/lib/vagrant/vagrantfile.rb index b6b2c15ec..511d1443e 100644 --- a/lib/vagrant/vagrantfile.rb +++ b/lib/vagrant/vagrantfile.rb @@ -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] diff --git a/plugins/commands/box/command/list.rb b/plugins/commands/box/command/list.rb index 086c0ea07..6bb90b79b 100644 --- a/plugins/commands/box/command/list.rb +++ b/plugins/commands/box/command/list.rb @@ -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]) diff --git a/plugins/commands/box/command/remove.rb b/plugins/commands/box/command/remove.rb index 28eed63f5..013ca2921 100644 --- a/plugins/commands/box/command/remove.rb +++ b/plugins/commands/box/command/remove.rb @@ -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 diff --git a/plugins/commands/box/command/repackage.rb b/plugins/commands/box/command/repackage.rb index a8df09159..2bb32847c 100644 --- a/plugins/commands/box/command/repackage.rb +++ b/plugins/commands/box/command/repackage.rb @@ -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 diff --git a/plugins/commands/box/command/root.rb b/plugins/commands/box/command/root.rb index 825489f78..1749d9bb7 100644 --- a/plugins/commands/box/command/root.rb +++ b/plugins/commands/box/command/root.rb @@ -81,7 +81,7 @@ module VagrantPlugins opts.separator "For help on any individual subcommand run `vagrant box -h`" end - @env.ui.info(opts.help, :prefix => false) + @env.ui.info(opts.help, prefix: false) end end end diff --git a/plugins/commands/destroy/command.rb b/plugins/commands/destroy/command.rb index b8a7cdd5c..e7a2f603f 100644 --- a/plugins/commands/destroy/command.rb +++ b/plugins/commands/destroy/command.rb @@ -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) && diff --git a/plugins/commands/halt/command.rb b/plugins/commands/halt/command.rb index e71f4f85b..224ce0e6d 100644 --- a/plugins/commands/halt/command.rb +++ b/plugins/commands/halt/command.rb @@ -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 diff --git a/plugins/commands/init/command.rb b/plugins/commands/init/command.rb index b67b04db0..438159523 100644 --- a/plugins/commands/init/command.rb +++ b/plugins/commands/init/command.rb @@ -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 diff --git a/plugins/commands/package/command.rb b/plugins/commands/package/command.rb index 40dac487c..3bb2cf563 100644 --- a/plugins/commands/package/command.rb +++ b/plugins/commands/package/command.rb @@ -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 diff --git a/plugins/commands/plugin/action/install_gem.rb b/plugins/commands/plugin/action/install_gem.rb index 9f553a0ac..842945423 100644 --- a/plugins/commands/plugin/action/install_gem.rb +++ b/plugins/commands/plugin/action/install_gem.rb @@ -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 diff --git a/plugins/commands/plugin/action/license_plugin.rb b/plugins/commands/plugin/action/license_plugin.rb index f4566c94c..6adf12527 100644 --- a/plugins/commands/plugin/action/license_plugin.rb +++ b/plugins/commands/plugin/action/license_plugin.rb @@ -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 diff --git a/plugins/commands/plugin/action/uninstall_plugin.rb b/plugins/commands/plugin/action/uninstall_plugin.rb index acf1ef2a3..0aa9b4a9a 100644 --- a/plugins/commands/plugin/action/uninstall_plugin.rb +++ b/plugins/commands/plugin/action/uninstall_plugin.rb @@ -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]) diff --git a/plugins/commands/plugin/command/install.rb b/plugins/commands/plugin/command/install.rb index 3c872baf4..441500387 100644 --- a/plugins/commands/plugin/command/install.rb +++ b/plugins/commands/plugin/command/install.rb @@ -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 diff --git a/plugins/commands/plugin/command/license.rb b/plugins/commands/plugin/command/license.rb index 81a0c9419..89e9ca3ce 100644 --- a/plugins/commands/plugin/command/license.rb +++ b/plugins/commands/plugin/command/license.rb @@ -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 diff --git a/plugins/commands/plugin/command/list.rb b/plugins/commands/plugin/command/list.rb index 61027c216..7949b5db8 100644 --- a/plugins/commands/plugin/command/list.rb +++ b/plugins/commands/plugin/command/list.rb @@ -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) diff --git a/plugins/commands/plugin/command/root.rb b/plugins/commands/plugin/command/root.rb index c3675fb93..8c4d1ad1b 100644 --- a/plugins/commands/plugin/command/root.rb +++ b/plugins/commands/plugin/command/root.rb @@ -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 diff --git a/plugins/commands/plugin/command/uninstall.rb b/plugins/commands/plugin/command/uninstall.rb index a61fb182e..ec032a5d9 100644 --- a/plugins/commands/plugin/command/uninstall.rb +++ b/plugins/commands/plugin/command/uninstall.rb @@ -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 diff --git a/plugins/commands/plugin/command/update.rb b/plugins/commands/plugin/command/update.rb index a0b832238..96bd1f678 100644 --- a/plugins/commands/plugin/command/update.rb +++ b/plugins/commands/plugin/command/update.rb @@ -21,7 +21,7 @@ module VagrantPlugins # Update the gem action(Action.action_update, { - :plugin_name => argv, + plugin_name: argv, }) # Success, exit status 0 diff --git a/plugins/commands/ssh/command.rb b/plugins/commands/ssh/command.rb index 2f6e374f5..dc262548d 100644 --- a/plugins/commands/ssh/command.rb +++ b/plugins/commands/ssh/command.rb @@ -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 diff --git a/plugins/commands/ssh_config/command.rb b/plugins/commands/ssh_config/command.rb index 79f430aba..e534b7182 100644 --- a/plugins/commands/ssh_config/command.rb +++ b/plugins/commands/ssh_config/command.rb @@ -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 diff --git a/plugins/commands/status/command.rb b/plugins/commands/status/command.rb index 03b0aee68..8a754eee3 100644 --- a/plugins/commands/status/command.rb +++ b/plugins/commands/status/command.rb @@ -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 diff --git a/plugins/commands/up/command.rb b/plugins/commands/up/command.rb index af708e5d4..7fdb6eb3c 100644 --- a/plugins/commands/up/command.rb +++ b/plugins/commands/up/command.rb @@ -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 diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index 3573f9812..fcb696368 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -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. diff --git a/plugins/communicators/winrm/communicator.rb b/plugins/communicators/winrm/communicator.rb index 3de84b67b..268a3c5d4 100644 --- a/plugins/communicators/winrm/communicator.rb +++ b/plugins/communicators/winrm/communicator.rb @@ -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 diff --git a/plugins/communicators/winrm/file_manager.rb b/plugins/communicators/winrm/file_manager.rb index 18ea62786..44065c1a2 100644 --- a/plugins/communicators/winrm/file_manager.rb +++ b/plugins/communicators/winrm/file_manager.rb @@ -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 diff --git a/plugins/communicators/winrm/shell.rb b/plugins/communicators/winrm/shell.rb index 131c79141..4a5a3c25a 100644 --- a/plugins/communicators/winrm/shell.rb +++ b/plugins/communicators/winrm/shell.rb @@ -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 diff --git a/plugins/guests/arch/cap/configure_networks.rb b/plugins/guests/arch/cap/configure_networks.rb index bb29f7be1..5d2bc2aa6 100644 --- a/plugins/guests/arch/cap/configure_networks.rb +++ b/plugins/guests/arch/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/coreos/cap/configure_networks.rb b/plugins/guests/coreos/cap/configure_networks.rb index 209bdcc49..c92b2cd90 100644 --- a/plugins/guests/coreos/cap/configure_networks.rb +++ b/plugins/guests/coreos/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/darwin/cap/mount_nfs_folder.rb b/plugins/guests/darwin/cap/mount_nfs_folder.rb index c70e81e9f..85c68e8e7 100644 --- a/plugins/guests/darwin/cap/mount_nfs_folder.rb +++ b/plugins/guests/darwin/cap/mount_nfs_folder.rb @@ -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) diff --git a/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb b/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb index 5b1cce976..3d7525e7a 100644 --- a/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb +++ b/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb @@ -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 diff --git a/plugins/guests/debian/cap/configure_networks.rb b/plugins/guests/debian/cap/configure_networks.rb index e448d76bb..97be13d40 100644 --- a/plugins/guests/debian/cap/configure_networks.rb +++ b/plugins/guests/debian/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/esxi/cap/mount_nfs_folder.rb b/plugins/guests/esxi/cap/mount_nfs_folder.rb index 97147247f..bbd98ce4d 100644 --- a/plugins/guests/esxi/cap/mount_nfs_folder.rb +++ b/plugins/guests/esxi/cap/mount_nfs_folder.rb @@ -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 diff --git a/plugins/guests/fedora/cap/configure_networks.rb b/plugins/guests/fedora/cap/configure_networks.rb index c7873dcad..f07c8707f 100644 --- a/plugins/guests/fedora/cap/configure_networks.rb +++ b/plugins/guests/fedora/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/freebsd/cap/change_host_name.rb b/plugins/guests/freebsd/cap/change_host_name.rb index 1f4423a22..37f921123 100644 --- a/plugins/guests/freebsd/cap/change_host_name.rb +++ b/plugins/guests/freebsd/cap/change_host_name.rb @@ -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 diff --git a/plugins/guests/freebsd/cap/configure_networks.rb b/plugins/guests/freebsd/cap/configure_networks.rb index aa2daa9fe..80267ca23 100644 --- a/plugins/guests/freebsd/cap/configure_networks.rb +++ b/plugins/guests/freebsd/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/freebsd/cap/halt.rb b/plugins/guests/freebsd/cap/halt.rb index 05437ed8d..4408fb051 100644 --- a/plugins/guests/freebsd/cap/halt.rb +++ b/plugins/guests/freebsd/cap/halt.rb @@ -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. diff --git a/plugins/guests/freebsd/cap/mount_nfs_folder.rb b/plugins/guests/freebsd/cap/mount_nfs_folder.rb index 8b314a684..c36f928ca 100644 --- a/plugins/guests/freebsd/cap/mount_nfs_folder.rb +++ b/plugins/guests/freebsd/cap/mount_nfs_folder.rb @@ -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 diff --git a/plugins/guests/freebsd/guest.rb b/plugins/guests/freebsd/guest.rb index 3f8de663b..edf290f31 100644 --- a/plugins/guests/freebsd/guest.rb +++ b/plugins/guests/freebsd/guest.rb @@ -7,7 +7,7 @@ module VagrantPlugins # Contributed by Kenneth Vestergaard 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 diff --git a/plugins/guests/funtoo/cap/configure_networks.rb b/plugins/guests/funtoo/cap/configure_networks.rb index 9fe51c1f9..466e3a57b 100644 --- a/plugins/guests/funtoo/cap/configure_networks.rb +++ b/plugins/guests/funtoo/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/gentoo/cap/configure_networks.rb b/plugins/guests/gentoo/cap/configure_networks.rb index ad534b437..c4848f321 100644 --- a/plugins/guests/gentoo/cap/configure_networks.rb +++ b/plugins/guests/gentoo/cap/configure_networks.rb @@ -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") diff --git a/plugins/guests/linux/cap/mount_nfs.rb b/plugins/guests/linux/cap/mount_nfs.rb index aae63125c..9fbb72d47 100644 --- a/plugins/guests/linux/cap/mount_nfs.rb +++ b/plugins/guests/linux/cap/mount_nfs.rb @@ -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 diff --git a/plugins/guests/netbsd/cap/change_host_name.rb b/plugins/guests/netbsd/cap/change_host_name.rb index 826ffe8a6..60a142399 100644 --- a/plugins/guests/netbsd/cap/change_host_name.rb +++ b/plugins/guests/netbsd/cap/change_host_name.rb @@ -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(< "sh"}) + machine.communicate.sudo(< /tmp/rc.conf.vagrant_changehostname_#{name} mv /tmp/rc.conf.vagrant_changehostname_#{name} /etc/rc.conf diff --git a/plugins/guests/netbsd/cap/configure_networks.rb b/plugins/guests/netbsd/cap/configure_networks.rb index 80750658c..750f2c7b6 100644 --- a/plugins/guests/netbsd/cap/configure_networks.rb +++ b/plugins/guests/netbsd/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/netbsd/cap/mount_nfs_folder.rb b/plugins/guests/netbsd/cap/mount_nfs_folder.rb index d9a31d625..5facd3780 100644 --- a/plugins/guests/netbsd/cap/mount_nfs_folder.rb +++ b/plugins/guests/netbsd/cap/mount_nfs_folder.rb @@ -4,7 +4,7 @@ module VagrantPlugins class MountNFSFolder def self.mount_nfs_folder(machine, ip, folders) folders.each do |name, opts| - machine.communicate.sudo(< "sh"}) + machine.communicate.sudo(< name) + hostname_module = TemplateRenderer.render("guests/nixos/hostname", name: name) upload(machine, hostname_module, "/etc/nixos/vagrant-hostname.nix") end diff --git a/plugins/guests/nixos/cap/configure_networks.rb b/plugins/guests/nixos/cap/configure_networks.rb index 3649d702b..b2174c81c 100644 --- a/plugins/guests/nixos/cap/configure_networks.rb +++ b/plugins/guests/nixos/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/openbsd/cap/configure_networks.rb b/plugins/guests/openbsd/cap/configure_networks.rb index 6e64a563b..5ca9fed07 100644 --- a/plugins/guests/openbsd/cap/configure_networks.rb +++ b/plugins/guests/openbsd/cap/configure_networks.rb @@ -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]}") diff --git a/plugins/guests/redhat/cap/configure_networks.rb b/plugins/guests/redhat/cap/configure_networks.rb index eb30474c5..9d5a9c485 100644 --- a/plugins/guests/redhat/cap/configure_networks.rb +++ b/plugins/guests/redhat/cap/configure_networks.rb @@ -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( diff --git a/plugins/guests/smartos/cap/mount_nfs.rb b/plugins/guests/smartos/cap/mount_nfs.rb index 14fa0bdfa..d23bbcf5d 100644 --- a/plugins/guests/smartos/cap/mount_nfs.rb +++ b/plugins/guests/smartos/cap/mount_nfs.rb @@ -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 diff --git a/plugins/guests/suse/cap/configure_networks.rb b/plugins/guests/suse/cap/configure_networks.rb index a87f6d172..bf09b868a 100644 --- a/plugins/guests/suse/cap/configure_networks.rb +++ b/plugins/guests/suse/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/windows/cap/change_host_name.rb b/plugins/guests/windows/cap/change_host_name.rb index 5f39cd05f..6b1af2b8a 100644 --- a/plugins/guests/windows/cap/change_host_name.rb +++ b/plugins/guests/windows/cap/change_host_name.rb @@ -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 diff --git a/plugins/guests/windows/cap/configure_networks.rb b/plugins/guests/windows/cap/configure_networks.rb index 326978517..8130cef77 100644 --- a/plugins/guests/windows/cap/configure_networks.rb +++ b/plugins/guests/windows/cap/configure_networks.rb @@ -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 diff --git a/plugins/guests/windows/guest_network.rb b/plugins/guests/windows/guest_network.rb index 78327ed14..5cfda59e1 100644 --- a/plugins/guests/windows/guest_network.rb +++ b/plugins/guests/windows/guest_network.rb @@ -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 diff --git a/plugins/hosts/bsd/cap/nfs.rb b/plugins/hosts/bsd/cap/nfs.rb index aef3d9064..df37f559d 100644 --- a/plugins/hosts/bsd/cap/nfs.rb +++ b/plugins/hosts/bsd/cap/nfs.rb @@ -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. diff --git a/plugins/hosts/linux/cap/nfs.rb b/plugins/hosts/linux/cap/nfs.rb index adcd97dc2..6b1c95c43 100644 --- a/plugins/hosts/linux/cap/nfs.rb +++ b/plugins/hosts/linux/cap/nfs.rb @@ -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 diff --git a/plugins/kernel_v1/config/vm.rb b/plugins/kernel_v1/config/vm.rb index d64bbbd79..6e105cc8f 100644 --- a/plugins/kernel_v1/config/vm.rb +++ b/plugins/kernel_v1/config/vm.rb @@ -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 diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 9bb0e78fa..de70e5f66 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -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 diff --git a/plugins/providers/docker/action.rb b/plugins/providers/docker/action.rb index 10a8b8c50..3189d6bec 100644 --- a/plugins/providers/docker/action.rb +++ b/plugins/providers/docker/action.rb @@ -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 diff --git a/plugins/providers/docker/executor/local.rb b/plugins/providers/docker/executor/local.rb index c3fda2515..55c55cf2c 100644 --- a/plugins/providers/docker/executor/local.rb +++ b/plugins/providers/docker/executor/local.rb @@ -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 } diff --git a/plugins/providers/hyperv/action/message_will_not_destroy.rb b/plugins/providers/hyperv/action/message_will_not_destroy.rb index bedb77b13..e7b117a8b 100644 --- a/plugins/providers/hyperv/action/message_will_not_destroy.rb +++ b/plugins/providers/hyperv/action/message_will_not_destroy.rb @@ -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 diff --git a/plugins/providers/virtualbox/action.rb b/plugins/providers/virtualbox/action.rb index 08e881744..668cbe0ef 100644 --- a/plugins/providers/virtualbox/action.rb +++ b/plugins/providers/virtualbox/action.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/check_guest_additions.rb b/plugins/providers/virtualbox/action/check_guest_additions.rb index 5d37eeb57..04a15376b 100644 --- a/plugins/providers/virtualbox/action/check_guest_additions.rb +++ b/plugins/providers/virtualbox/action/check_guest_additions.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/clear_network_interfaces.rb b/plugins/providers/virtualbox/action/clear_network_interfaces.rb index 369c80f46..5bbde0651 100644 --- a/plugins/providers/virtualbox/action/clear_network_interfaces.rb +++ b/plugins/providers/virtualbox/action/clear_network_interfaces.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/customize.rb b/plugins/providers/virtualbox/action/customize.rb index 25ec7fc5f..95049c3d0 100644 --- a/plugins/providers/virtualbox/action/customize.rb +++ b/plugins/providers/virtualbox/action/customize.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/forward_ports.rb b/plugins/providers/virtualbox/action/forward_ports.rb index b45f074eb..aac663918 100644 --- a/plugins/providers/virtualbox/action/forward_ports.rb +++ b/plugins/providers/virtualbox/action/forward_ports.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/import.rb b/plugins/providers/virtualbox/action/import.rb index 4c195d891..6648faefc 100644 --- a/plugins/providers/virtualbox/action/import.rb +++ b/plugins/providers/virtualbox/action/import.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/message_will_not_destroy.rb b/plugins/providers/virtualbox/action/message_will_not_destroy.rb index a80bea3c9..fe6a8d119 100644 --- a/plugins/providers/virtualbox/action/message_will_not_destroy.rb +++ b/plugins/providers/virtualbox/action/message_will_not_destroy.rb @@ -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 diff --git a/plugins/providers/virtualbox/action/network.rb b/plugins/providers/virtualbox/action/network.rb index 1a98b41e5..ee2c73cf0 100644 --- a/plugins/providers/virtualbox/action/network.rb +++ b/plugins/providers/virtualbox/action/network.rb @@ -136,11 +136,11 @@ module VagrantPlugins def bridged_config(options) return { - :auto_config => true, - :bridge => nil, - :mac => nil, - :nic_type => nil, - :use_dhcp_assigned_default_route => false + auto_config: true, + bridge: nil, + mac: nil, + nic_type: nil, + use_dhcp_assigned_default_route: false }.merge(options || {}) end @@ -168,7 +168,7 @@ module VagrantPlugins # If one wasn't found, then we notify the user here. if !chosen_bridge @env[:ui].info I18n.t("vagrant.actions.vm.bridged_networking.specific_not_found", - :bridge => config[:bridge]) + bridge: config[:bridge]) end end @@ -185,10 +185,10 @@ module VagrantPlugins # More than one bridgable interface requires a user decision, so # show options to choose from. @env[:ui].info I18n.t("vagrant.actions.vm.bridged_networking.available", - :prefix => false) + prefix: false) bridgedifs.each_index do |index| interface = bridgedifs[index] - @env[:ui].info("#{index + 1}) #{interface[:name]}", :prefix => false) + @env[:ui].info("#{index + 1}) #{interface[:name]}", prefix: false) end # The range of valid choices @@ -209,39 +209,39 @@ module VagrantPlugins # Given the choice we can now define the adapter we're using return { - :adapter => config[:adapter], - :type => :bridged, - :bridge => chosen_bridge, - :mac_address => config[:mac], - :nic_type => config[:nic_type] + adapter: config[:adapter], + type: :bridged, + bridge: chosen_bridge, + mac_address: config[:mac], + nic_type: config[:nic_type] } end def bridged_network_config(config) if config[:ip] options = { - :auto_config => true, - :mac => nil, - :netmask => "255.255.255.0", - :type => :static + auto_config: true, + mac: nil, + netmask: "255.255.255.0", + type: :static }.merge(config) options[:type] = options[:type].to_sym return options end return { - :type => :dhcp, - :use_dhcp_assigned_default_route => config[:use_dhcp_assigned_default_route] + type: :dhcp, + use_dhcp_assigned_default_route: config[:use_dhcp_assigned_default_route] } end def hostonly_config(options) options = { - :auto_config => true, - :mac => nil, - :nic_type => nil, - :netmask => "255.255.255.0", - :type => :static + auto_config: true, + mac: nil, + nic_type: nil, + netmask: "255.255.255.0", + type: :static }.merge(options) # Make sure the type is a symbol @@ -294,13 +294,13 @@ module VagrantPlugins end return { - :adapter_ip => options[:adapter_ip], - :auto_config => options[:auto_config], - :ip => options[:ip], - :mac => options[:mac], - :netmask => options[:netmask], - :nic_type => options[:nic_type], - :type => options[:type] + adapter_ip: options[:adapter_ip], + auto_config: options[:auto_config], + ip: options[:ip], + mac: options[:mac], + netmask: options[:netmask], + nic_type: options[:nic_type], + type: options[:type] }.merge(dhcp_options) end @@ -314,7 +314,7 @@ module VagrantPlugins # It is an error if a specific host only network name was specified # but the network wasn't found. if config[:name] - raise Vagrant::Errors::NetworkNotFound, :name => config[:name] + raise Vagrant::Errors::NetworkNotFound, name: config[:name] end # Create a new network @@ -341,32 +341,32 @@ module VagrantPlugins end return { - :adapter => config[:adapter], - :hostonly => interface[:name], - :mac_address => config[:mac], - :nic_type => config[:nic_type], - :type => :hostonly + adapter: config[:adapter], + hostonly: interface[:name], + mac_address: config[:mac], + nic_type: config[:nic_type], + type: :hostonly } end def hostonly_network_config(config) return { - :type => config[:type], - :adapter_ip => config[:adapter_ip], - :ip => config[:ip], - :netmask => config[:netmask] + type: config[:type], + adapter_ip: config[:adapter_ip], + ip: config[:ip], + netmask: config[:netmask] } end def intnet_config(options) return { - :type => "static", - :ip => nil, - :netmask => "255.255.255.0", - :adapter => nil, - :mac => nil, - :intnet => nil, - :auto_config => true + type: "static", + ip: nil, + netmask: "255.255.255.0", + adapter: nil, + mac: nil, + intnet: nil, + auto_config: true }.merge(options || {}) end @@ -375,32 +375,32 @@ module VagrantPlugins intnet_name = "intnet" if intnet_name == true return { - :adapter => config[:adapter], - :type => :intnet, - :mac_address => config[:mac], - :nic_type => config[:nic_type], - :intnet => intnet_name, + adapter: config[:adapter], + type: :intnet, + mac_address: config[:mac], + nic_type: config[:nic_type], + intnet: intnet_name, } end def intnet_network_config(config) return { - :type => config[:type], - :ip => config[:ip], - :netmask => config[:netmask] + type: config[:type], + ip: config[:ip], + netmask: config[:netmask] } end def nat_config(options) return { - :auto_config => false + auto_config: false } end def nat_adapter(config) return { - :adapter => config[:adapter], - :type => :nat, + adapter: config[:adapter], + type: :nat, } end @@ -450,8 +450,8 @@ module VagrantPlugins # This creates a host only network for the given configuration. def hostonly_create_network(config) @env[:machine].provider.driver.create_host_only_network( - :adapter_ip => config[:adapter_ip], - :netmask => config[:netmask] + adapter_ip: config[:adapter_ip], + netmask: config[:netmask] ) end diff --git a/plugins/providers/virtualbox/action/package_vagrantfile.rb b/plugins/providers/virtualbox/action/package_vagrantfile.rb index 0517718ee..f7ab1e22c 100644 --- a/plugins/providers/virtualbox/action/package_vagrantfile.rb +++ b/plugins/providers/virtualbox/action/package_vagrantfile.rb @@ -23,7 +23,7 @@ module VagrantPlugins def create_vagrantfile File.open(File.join(@env["export.temp_dir"], "Vagrantfile"), "w") do |f| f.write(TemplateRenderer.render("package_Vagrantfile", { - :base_mac => @env[:machine].provider.driver.read_mac_address + base_mac: @env[:machine].provider.driver.read_mac_address })) end end diff --git a/plugins/providers/virtualbox/action/set_name.rb b/plugins/providers/virtualbox/action/set_name.rb index 4e68e2f82..3cbcf131a 100644 --- a/plugins/providers/virtualbox/action/set_name.rb +++ b/plugins/providers/virtualbox/action/set_name.rb @@ -31,7 +31,7 @@ module VagrantPlugins # Verify the name is not taken vms = env[:machine].provider.driver.read_vms - raise Vagrant::Errors::VMNameExists, :name => name if \ + raise Vagrant::Errors::VMNameExists, name: name if \ vms.has_key?(name) && vms[name] != env[:machine].id if vms.has_key?(name) diff --git a/plugins/providers/virtualbox/action/setup_package_files.rb b/plugins/providers/virtualbox/action/setup_package_files.rb index 93e1fdd89..1654393c4 100644 --- a/plugins/providers/virtualbox/action/setup_package_files.rb +++ b/plugins/providers/virtualbox/action/setup_package_files.rb @@ -37,7 +37,7 @@ module VagrantPlugins # Verify the mapping files.each do |from, _| raise Vagrant::Errors::PackageIncludeMissing, - :file => from if !File.exist?(from) + file: from if !File.exist?(from) end # Save the mapping diff --git a/plugins/providers/virtualbox/driver/base.rb b/plugins/providers/virtualbox/driver/base.rb index 142f116b9..2cb1a7093 100644 --- a/plugins/providers/virtualbox/driver/base.rb +++ b/plugins/providers/virtualbox/driver/base.rb @@ -96,9 +96,9 @@ module VagrantPlugins # The format of each adapter specification should be like so: # # { - # :type => :hostonly, - # :hostonly => "vboxnet0", - # :mac_address => "tubes" + # type: :hostonly, + # hostonly: "vboxnet0", + # mac_address: "tubes" # } # # This must support setting up both host only and bridged networks. @@ -109,7 +109,7 @@ module VagrantPlugins # Execute a raw command straight through to VBoxManage. # - # Accepts a :retryable => true option if the command should be retried + # Accepts a retryable: true option if the command should be retried # upon failure. # # Raises a VBoxManage error if it fails. @@ -133,11 +133,11 @@ module VagrantPlugins # The format of each port hash should be the following: # # { - # :name => "foo", - # :hostport => 8500, - # :guestport => 80, - # :adapter => 1, - # :protocol => "tcp" + # name: "foo", + # hostport: 8500, + # guestport: 80, + # adapter: 1, + # protocol: "tcp" # } # # Note that "adapter" and "protocol" are optional and will default @@ -302,7 +302,7 @@ module VagrantPlugins # Variable to store our execution result r = nil - retryable(:on => Vagrant::Errors::VBoxManageError, :tries => tries, :sleep => 1) do + retryable(on: Vagrant::Errors::VBoxManageError, tries: tries, sleep: 1) do # If there is an error with VBoxManage, this gets set to true errored = false @@ -345,8 +345,8 @@ module VagrantPlugins # output. if errored raise Vagrant::Errors::VBoxManageError, - :command => command.inspect, - :stderr => r.stderr + command: command.inspect, + stderr: r.stderr end end @@ -366,7 +366,7 @@ module VagrantPlugins end # Append in the options for subprocess - command << { :notify => [:stdout, :stderr] } + command << { notify: [:stdout, :stderr] } Vagrant::Util::Busy.busy(int_callback) do Vagrant::Util::Subprocess.execute(@vboxmanage_path, *command, &block) diff --git a/plugins/providers/virtualbox/driver/version_4_0.rb b/plugins/providers/virtualbox/driver/version_4_0.rb index 149f51272..670adfd0a 100644 --- a/plugins/providers/virtualbox/driver/version_4_0.rb +++ b/plugins/providers/virtualbox/driver/version_4_0.rb @@ -26,7 +26,7 @@ module VagrantPlugins end def clear_shared_folders - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if name = line[/^SharedFolderNameMachineMapping\d+="(.+?)"$/, 1] execute("sharedfolder", "remove", @uuid, "--name", name) @@ -55,10 +55,10 @@ module VagrantPlugins # Return the details return { - :name => name, - :ip => options[:adapter_ip], - :netmask => options[:netmask], - :dhcp => nil + name: name, + ip: options[:adapter_ip], + netmask: options[:netmask], + dhcp: nil } end @@ -76,7 +76,7 @@ module VagrantPlugins execute("list", "vms").split("\n").each do |line| if vm_name = line[/^".+?"\s+\{(.+?)\}$/, 1] - info = execute("showvminfo", vm_name, "--machinereadable", :retryable => true) + info = execute("showvminfo", vm_name, "--machinereadable", retryable: true) info.split("\n").each do |line| if network_name = line[/^hostonlyadapter\d+="(.+?)"$/, 1] networks.delete(network_name) @@ -209,7 +209,7 @@ module VagrantPlugins results = [] current_nic = nil - info = execute("showvminfo", uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| # This is how we find the nic that a FP is attached to, # since this comes first. @@ -257,7 +257,7 @@ module VagrantPlugins def read_guest_additions_version output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version", - :retryable => true) + retryable: true) if value = output[/^Value: (.+?)$/, 1] # Split the version by _ since some distro versions modify it # to look like this: 4.1.2_ubuntu, and the distro part isn't @@ -277,13 +277,13 @@ module VagrantPlugins if output =~ /^Value: (.+?)$/ $1.to_s else - raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, :guest_property => property + raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: property end end def read_host_only_interfaces dhcp = {} - execute("list", "dhcpservers", :retryable => true).split("\n\n").each do |block| + execute("list", "dhcpservers", retryable: true).split("\n\n").each do |block| info = {} block.split("\n").each do |line| @@ -302,7 +302,7 @@ module VagrantPlugins dhcp[info[:network]] = info end - execute("list", "hostonlyifs", :retryable => true).split("\n\n").collect do |block| + execute("list", "hostonlyifs", retryable: true).split("\n\n").collect do |block| info = {} block.split("\n").each do |line| @@ -325,7 +325,7 @@ module VagrantPlugins end def read_mac_address - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if mac = line[/^macaddress1="(.+?)"$/, 1] return mac @@ -337,7 +337,7 @@ module VagrantPlugins def read_mac_addresses macs = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if matcher = /^macaddress(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i @@ -349,7 +349,7 @@ module VagrantPlugins end def read_machine_folder - execute("list", "systemproperties", :retryable => true).split("\n").each do |line| + execute("list", "systemproperties", retryable: true).split("\n").each do |line| if folder = line[/^Default machine folder:\s+(.+?)$/i, 1] return folder end @@ -360,7 +360,7 @@ module VagrantPlugins def read_network_interfaces nics = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if matcher = /^nic(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i @@ -387,7 +387,7 @@ module VagrantPlugins end def read_state - output = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + output = execute("showvminfo", @uuid, "--machinereadable", retryable: true) if output =~ /^name=""$/ return :inaccessible elsif state = output[/^VMState="(.+?)"$/, 1] @@ -399,7 +399,7 @@ module VagrantPlugins def read_used_ports ports = [] - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if uuid = line[/^".+?" \{(.+?)\}$/, 1] # Ignore our own used ports next if uuid == @uuid @@ -415,7 +415,7 @@ module VagrantPlugins def read_vms results = {} - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if line =~ /^"(.+?)" \{(.+?)\}$/ results[$1.to_s] = $2.to_s end diff --git a/plugins/providers/virtualbox/driver/version_4_1.rb b/plugins/providers/virtualbox/driver/version_4_1.rb index 26e70da7c..60bbdadad 100644 --- a/plugins/providers/virtualbox/driver/version_4_1.rb +++ b/plugins/providers/virtualbox/driver/version_4_1.rb @@ -26,7 +26,7 @@ module VagrantPlugins end def clear_shared_folders - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if folder = line[/^SharedFolderNameMachineMapping\d+="(.+?)"$/, 1] execute("sharedfolder", "remove", @uuid, "--name", folder) @@ -55,10 +55,10 @@ module VagrantPlugins # Return the details return { - :name => name, - :ip => options[:adapter_ip], - :netmask => options[:netmask], - :dhcp => nil + name: name, + ip: options[:adapter_ip], + netmask: options[:netmask], + dhcp: nil } end @@ -76,7 +76,7 @@ module VagrantPlugins execute("list", "vms").split("\n").each do |line| if vm = line[/^".+?"\s+\{(.+?)\}$/, 1] - info = execute("showvminfo", vm, "--machinereadable", :retryable => true) + info = execute("showvminfo", vm, "--machinereadable", retryable: true) info.split("\n").each do |line| if adapter = line[/^hostonlyadapter\d+="(.+?)"$/, 1] networks.delete(adapter) @@ -214,7 +214,7 @@ module VagrantPlugins results = [] current_nic = nil - info = execute("showvminfo", uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| # This is how we find the nic that a FP is attached to, # since this comes first. @@ -262,7 +262,7 @@ module VagrantPlugins def read_guest_additions_version output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version", - :retryable => true) + retryable: true) if value = output[/^Value: (.+?)$/, 1] # Split the version by _ since some distro versions modify it # to look like this: 4.1.2_ubuntu, and the distro part isn't @@ -282,13 +282,13 @@ module VagrantPlugins if output =~ /^Value: (.+?)$/ $1.to_s else - raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, :guest_property => property + raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: property end end def read_host_only_interfaces dhcp = {} - execute("list", "dhcpservers", :retryable => true).split("\n\n").each do |block| + execute("list", "dhcpservers", retryable: true).split("\n\n").each do |block| info = {} block.split("\n").each do |line| @@ -307,7 +307,7 @@ module VagrantPlugins dhcp[info[:network]] = info end - execute("list", "hostonlyifs", :retryable => true).split("\n\n").collect do |block| + execute("list", "hostonlyifs", retryable: true).split("\n\n").collect do |block| info = {} block.split("\n").each do |line| @@ -330,7 +330,7 @@ module VagrantPlugins end def read_mac_address - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if mac = line[/^macaddress1="(.+?)"$/, 1] return mac @@ -342,7 +342,7 @@ module VagrantPlugins def read_mac_addresses macs = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if matcher = /^macaddress(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i @@ -354,7 +354,7 @@ module VagrantPlugins end def read_machine_folder - execute("list", "systemproperties", :retryable => true).split("\n").each do |line| + execute("list", "systemproperties", retryable: true).split("\n").each do |line| if folder = line[/^Default machine folder:\s+(.+?)$/i, 1] return folder end @@ -365,7 +365,7 @@ module VagrantPlugins def read_network_interfaces nics = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if matcher = /^nic(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i @@ -392,7 +392,7 @@ module VagrantPlugins end def read_state - output = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + output = execute("showvminfo", @uuid, "--machinereadable", retryable: true) if output =~ /^name=""$/ return :inaccessible elsif state = output[/^VMState="(.+?)"$/, 1] @@ -404,7 +404,7 @@ module VagrantPlugins def read_used_ports ports = [] - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if uuid = line[/^".+?" \{(.+?)\}$/, 1] # Ignore our own used ports next if uuid == @uuid @@ -420,7 +420,7 @@ module VagrantPlugins def read_vms results = {} - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if line =~ /^"(.+?)" \{(.+?)\}$/ results[$1.to_s] = $2.to_s end diff --git a/plugins/providers/virtualbox/driver/version_4_2.rb b/plugins/providers/virtualbox/driver/version_4_2.rb index a5b1b0d7c..94325fe70 100644 --- a/plugins/providers/virtualbox/driver/version_4_2.rb +++ b/plugins/providers/virtualbox/driver/version_4_2.rb @@ -26,7 +26,7 @@ module VagrantPlugins end def clear_shared_folders - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if line =~ /^SharedFolderNameMachineMapping\d+="(.+?)"$/ execute("sharedfolder", "remove", @uuid, "--name", $1.to_s) @@ -55,10 +55,10 @@ module VagrantPlugins # Return the details return { - :name => name, - :ip => options[:adapter_ip], - :netmask => options[:netmask], - :dhcp => nil + name: name, + ip: options[:adapter_ip], + netmask: options[:netmask], + dhcp: nil } end @@ -74,7 +74,7 @@ module VagrantPlugins execute("list", "vms").split("\n").each do |line| if line =~ /^".+?"\s+\{(.+?)\}$/ - info = execute("showvminfo", $1.to_s, "--machinereadable", :retryable => true) + info = execute("showvminfo", $1.to_s, "--machinereadable", retryable: true) info.split("\n").each do |inner_line| if inner_line =~ /^hostonlyadapter\d+="(.+?)"$/ networks.delete($1.to_s) @@ -232,7 +232,7 @@ module VagrantPlugins results = [] current_nic = nil - info = execute("showvminfo", uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| # This is how we find the nic that a FP is attached to, # since this comes first. @@ -278,7 +278,7 @@ module VagrantPlugins def read_guest_additions_version output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version", - :retryable => true) + retryable: true) if output =~ /^Value: (.+?)$/ # Split the version by _ since some distro versions modify it # to look like this: 4.1.2_ubuntu, and the distro part isn't @@ -289,7 +289,7 @@ module VagrantPlugins # If we can't get the guest additions version by guest property, try # to get it from the VM info itself. - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| return $1.to_s if line =~ /^GuestAdditionsVersion="(.+?)"$/ end @@ -306,13 +306,13 @@ module VagrantPlugins if output =~ /^Value: (.+?)$/ $1.to_s else - raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, :guest_property => property + raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: property end end def read_host_only_interfaces dhcp = {} - execute("list", "dhcpservers", :retryable => true).split("\n\n").each do |block| + execute("list", "dhcpservers", retryable: true).split("\n\n").each do |block| info = {} block.split("\n").each do |line| @@ -331,7 +331,7 @@ module VagrantPlugins dhcp[info[:network]] = info end - execute("list", "hostonlyifs", :retryable => true).split("\n\n").collect do |block| + execute("list", "hostonlyifs", retryable: true).split("\n\n").collect do |block| info = {} block.split("\n").each do |line| @@ -354,7 +354,7 @@ module VagrantPlugins end def read_mac_address - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| return $1.to_s if line =~ /^macaddress1="(.+?)"$/ end @@ -364,7 +364,7 @@ module VagrantPlugins def read_mac_addresses macs = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if matcher = /^macaddress(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i @@ -376,7 +376,7 @@ module VagrantPlugins end def read_machine_folder - execute("list", "systemproperties", :retryable => true).split("\n").each do |line| + execute("list", "systemproperties", retryable: true).split("\n").each do |line| if line =~ /^Default machine folder:\s+(.+?)$/i return $1.to_s end @@ -387,7 +387,7 @@ module VagrantPlugins def read_network_interfaces nics = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if line =~ /^nic(\d+)="(.+?)"$/ adapter = $1.to_i @@ -414,7 +414,7 @@ module VagrantPlugins end def read_state - output = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + output = execute("showvminfo", @uuid, "--machinereadable", retryable: true) if output =~ /^name=""$/ return :inaccessible elsif output =~ /^VMState="(.+?)"$/ @@ -426,7 +426,7 @@ module VagrantPlugins def read_used_ports ports = [] - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if line =~ /^".+?" \{(.+?)\}$/ uuid = $1.to_s @@ -444,7 +444,7 @@ module VagrantPlugins def read_vms results = {} - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if line =~ /^"(.+?)" \{(.+?)\}$/ results[$1.to_s] = $2.to_s end @@ -458,7 +458,7 @@ module VagrantPlugins end def set_name(name) - execute("modifyvm", @uuid, "--name", name, :retryable => true) + execute("modifyvm", @uuid, "--name", name, retryable: true) end def share_folders(folders) diff --git a/plugins/providers/virtualbox/driver/version_4_3.rb b/plugins/providers/virtualbox/driver/version_4_3.rb index 236d44c9d..74ddb4474 100644 --- a/plugins/providers/virtualbox/driver/version_4_3.rb +++ b/plugins/providers/virtualbox/driver/version_4_3.rb @@ -26,7 +26,7 @@ module VagrantPlugins end def clear_shared_folders - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if line =~ /^SharedFolderNameMachineMapping\d+="(.+?)"$/ execute("sharedfolder", "remove", @uuid, "--name", $1.to_s) @@ -55,10 +55,10 @@ module VagrantPlugins # Return the details return { - :name => name, - :ip => options[:adapter_ip], - :netmask => options[:netmask], - :dhcp => nil + name: name, + ip: options[:adapter_ip], + netmask: options[:netmask], + dhcp: nil } end @@ -74,7 +74,7 @@ module VagrantPlugins execute("list", "vms", retryable: true).split("\n").each do |line| if line =~ /^".+?"\s+\{(.+?)\}$/ - info = execute("showvminfo", $1.to_s, "--machinereadable", :retryable => true) + info = execute("showvminfo", $1.to_s, "--machinereadable", retryable: true) info.split("\n").each do |inner_line| if inner_line =~ /^hostonlyadapter\d+="(.+?)"$/ networks.delete($1.to_s) @@ -238,7 +238,7 @@ module VagrantPlugins results = [] current_nic = nil - info = execute("showvminfo", uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| # This is how we find the nic that a FP is attached to, # since this comes first. @@ -284,7 +284,7 @@ module VagrantPlugins def read_guest_additions_version output = execute("guestproperty", "get", @uuid, "/VirtualBox/GuestAdd/Version", - :retryable => true) + retryable: true) if output =~ /^Value: (.+?)$/ # Split the version by _ since some distro versions modify it # to look like this: 4.1.2_ubuntu, and the distro part isn't @@ -295,7 +295,7 @@ module VagrantPlugins # If we can't get the guest additions version by guest property, try # to get it from the VM info itself. - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| return $1.to_s if line =~ /^GuestAdditionsVersion="(.+?)"$/ end @@ -312,13 +312,13 @@ module VagrantPlugins if output =~ /^Value: (.+?)$/ $1.to_s else - raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, :guest_property => property + raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: property end end def read_host_only_interfaces dhcp = {} - execute("list", "dhcpservers", :retryable => true).split("\n\n").each do |block| + execute("list", "dhcpservers", retryable: true).split("\n\n").each do |block| info = {} block.split("\n").each do |line| @@ -360,7 +360,7 @@ module VagrantPlugins end def read_mac_address - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| return $1.to_s if line =~ /^macaddress1="(.+?)"$/ end @@ -370,7 +370,7 @@ module VagrantPlugins def read_mac_addresses macs = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if matcher = /^macaddress(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i @@ -382,7 +382,7 @@ module VagrantPlugins end def read_machine_folder - execute("list", "systemproperties", :retryable => true).split("\n").each do |line| + execute("list", "systemproperties", retryable: true).split("\n").each do |line| if line =~ /^Default machine folder:\s+(.+?)$/i return $1.to_s end @@ -393,7 +393,7 @@ module VagrantPlugins def read_network_interfaces nics = {} - info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + info = execute("showvminfo", @uuid, "--machinereadable", retryable: true) info.split("\n").each do |line| if line =~ /^nic(\d+)="(.+?)"$/ adapter = $1.to_i @@ -420,7 +420,7 @@ module VagrantPlugins end def read_state - output = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) + output = execute("showvminfo", @uuid, "--machinereadable", retryable: true) if output =~ /^name=""$/ return :inaccessible elsif output =~ /^VMState="(.+?)"$/ @@ -432,7 +432,7 @@ module VagrantPlugins def read_used_ports ports = [] - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if line =~ /^".+?" \{(.+?)\}$/ uuid = $1.to_s @@ -450,7 +450,7 @@ module VagrantPlugins def read_vms results = {} - execute("list", "vms", :retryable => true).split("\n").each do |line| + execute("list", "vms", retryable: true).split("\n").each do |line| if line =~ /^"(.+?)" \{(.+?)\}$/ results[$1.to_s] = $2.to_s end @@ -464,7 +464,7 @@ module VagrantPlugins end def set_name(name) - execute("modifyvm", @uuid, "--name", name, :retryable => true) + execute("modifyvm", @uuid, "--name", name, retryable: true) end def share_folders(folders) diff --git a/plugins/providers/virtualbox/provider.rb b/plugins/providers/virtualbox/provider.rb index 3f265c6ad..9428fe6d7 100644 --- a/plugins/providers/virtualbox/provider.rb +++ b/plugins/providers/virtualbox/provider.rb @@ -63,8 +63,8 @@ module VagrantPlugins # VirtualBox VMs are always local. The port we try to discover # by reading the forwarded ports. return { - :host => "127.0.0.1", - :port => @driver.ssh_port(@machine.config.ssh.guest_port) + host: "127.0.0.1", + port: @driver.ssh_port(@machine.config.ssh.guest_port) } end diff --git a/plugins/providers/virtualbox/synced_folder.rb b/plugins/providers/virtualbox/synced_folder.rb index 4a3ed916b..49d403e44 100644 --- a/plugins/providers/virtualbox/synced_folder.rb +++ b/plugins/providers/virtualbox/synced_folder.rb @@ -54,7 +54,7 @@ module VagrantPlugins else # If no guest path is specified, then automounting is disabled machine.ui.detail(I18n.t("vagrant.actions.vm.share_folders.nomount_entry", - :hostpath => data[:hostpath])) + hostpath: data[:hostpath])) end end end diff --git a/plugins/provisioners/ansible/config.rb b/plugins/provisioners/ansible/config.rb index b29433f6e..784cf48f7 100644 --- a/plugins/provisioners/ansible/config.rb +++ b/plugins/provisioners/ansible/config.rb @@ -75,7 +75,7 @@ module VagrantPlugins expanded_path = Pathname.new(playbook).expand_path(machine.env.root_path) if !expanded_path.file? errors << I18n.t("vagrant.provisioners.ansible.playbook_path_invalid", - :path => expanded_path) + path: expanded_path) end end @@ -97,8 +97,8 @@ module VagrantPlugins if !extra_vars_is_valid errors << I18n.t("vagrant.provisioners.ansible.extra_vars_invalid", - :type => extra_vars.class.to_s, - :value => extra_vars.to_s + type: extra_vars.class.to_s, + value: extra_vars.to_s ) end end @@ -108,7 +108,7 @@ module VagrantPlugins expanded_path = Pathname.new(inventory_path).expand_path(machine.env.root_path) if !expanded_path.exist? errors << I18n.t("vagrant.provisioners.ansible.inventory_path_invalid", - :path => expanded_path) + path: expanded_path) end end @@ -117,7 +117,7 @@ module VagrantPlugins expanded_path = Pathname.new(vault_password_file).expand_path(machine.env.root_path) if !expanded_path.exist? errors << I18n.t("vagrant.provisioners.ansible.vault_password_file_invalid", - :path => expanded_path) + path: expanded_path) end end diff --git a/plugins/provisioners/ansible/provisioner.rb b/plugins/provisioners/ansible/provisioner.rb index 79417c866..eac7db7f0 100644 --- a/plugins/provisioners/ansible/provisioner.rb +++ b/plugins/provisioners/ansible/provisioner.rb @@ -70,15 +70,15 @@ module VagrantPlugins # Write stdout and stderr data, since it's the regular Ansible output command << { - :env => env, - :notify => [:stdout, :stderr], - :workdir => @machine.env.root_path.to_s + env: env, + notify: [:stdout, :stderr], + workdir: @machine.env.root_path.to_s } begin result = Vagrant::Util::Subprocess.execute(*command) do |type, data| if type == :stdout || type == :stderr - @machine.env.ui.info(data, :new_line => false, :prefix => false) + @machine.env.ui.info(data, new_line: false, prefix: false) end end diff --git a/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb b/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb index 11bb25c89..4319d7a1a 100644 --- a/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb +++ b/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb @@ -11,13 +11,13 @@ module VagrantPlugins machine.communicate.tap do |comm| # We hardcode fixing the permissions on /var/cfengine/ppkeys/, if it exists, # because otherwise CFEngine will fail to bootstrap. - if comm.test("test -d /var/cfengine/ppkeys", :sudo => true) + if comm.test("test -d /var/cfengine/ppkeys", sudo: true) logger.debug("Fixing permissions on /var/cfengine/ppkeys") comm.sudo("chmod -R 600 /var/cfengine/ppkeys") end logger.debug("Checking if CFEngine is bootstrapped...") - bootstrapped = comm.test("test -f /var/cfengine/policy_server.dat", :sudo => true) + bootstrapped = comm.test("test -f /var/cfengine/policy_server.dat", sudo: true) if bootstrapped && !config.force_bootstrap logger.info("CFEngine already bootstrapped, no need to do it again") return false diff --git a/plugins/provisioners/cfengine/provisioner.rb b/plugins/provisioners/cfengine/provisioner.rb index 03ed687f1..0335da8f6 100644 --- a/plugins/provisioners/cfengine/provisioner.rb +++ b/plugins/provisioners/cfengine/provisioner.rb @@ -48,7 +48,7 @@ module VagrantPlugins color = type == :stdout ? :green : :red @machine.ui.info( data, - :color => color, :new_line => false, :prefix => false) + color: color, new_line: false, prefix: false) end end end diff --git a/plugins/provisioners/chef/provisioner/base.rb b/plugins/provisioners/chef/provisioner/base.rb index 02a4dd52f..a891b1251 100644 --- a/plugins/provisioners/chef/provisioner/base.rb +++ b/plugins/provisioners/chef/provisioner/base.rb @@ -18,9 +18,9 @@ module VagrantPlugins # doesn't exist. @machine.communicate.sudo( "which #{binary}", - :error_class => ChefError, - :error_key => :chef_not_detected, - :binary => binary) + error_class: ChefError, + error_key: :chef_not_detected, + binary: binary) end # This returns the command to run Chef for the given client @@ -63,22 +63,22 @@ module VagrantPlugins end config_file = Vagrant::Util::TemplateRenderer.render(template, { - :custom_configuration => remote_custom_config_path, - :encrypted_data_bag_secret => guest_encrypted_data_bag_secret_key_path, - :environment => @config.environment, - :file_cache_path => @config.file_cache_path, - :file_backup_path => @config.file_backup_path, - :log_level => @config.log_level.to_sym, - :node_name => @config.node_name, - :verbose_logging => @config.verbose_logging, - :http_proxy => @config.http_proxy, - :http_proxy_user => @config.http_proxy_user, - :http_proxy_pass => @config.http_proxy_pass, - :https_proxy => @config.https_proxy, - :https_proxy_user => @config.https_proxy_user, - :https_proxy_pass => @config.https_proxy_pass, - :no_proxy => @config.no_proxy, - :formatter => @config.formatter + custom_configuration: remote_custom_config_path, + encrypted_data_bag_secret: guest_encrypted_data_bag_secret_key_path, + environment: @config.environment, + file_cache_path: @config.file_cache_path, + file_backup_path: @config.file_backup_path, + log_level: @config.log_level.to_sym, + node_name: @config.node_name, + verbose_logging: @config.verbose_logging, + http_proxy: @config.http_proxy, + http_proxy_user: @config.http_proxy_user, + http_proxy_pass: @config.http_proxy_pass, + https_proxy: @config.https_proxy, + https_proxy_user: @config.https_proxy_user, + https_proxy_pass: @config.https_proxy_pass, + no_proxy: @config.no_proxy, + formatter: @config.formatter }.merge(template_vars)) # Create a temporary file to store the data so we @@ -89,7 +89,7 @@ module VagrantPlugins remote_file = File.join(config.provisioning_path, filename) @machine.communicate.tap do |comm| - comm.sudo("rm -f #{remote_file}", :error_check => false) + comm.sudo("rm -f #{remote_file}", error_check: false) comm.upload(temp.path, remote_file) end end @@ -110,7 +110,7 @@ module VagrantPlugins remote_file = File.join(@config.provisioning_path, "dna.json") @machine.communicate.tap do |comm| - comm.sudo("rm -f #{remote_file}", :error_check => false) + comm.sudo("rm -f #{remote_file}", error_check: false) comm.upload(temp.path, remote_file) end end diff --git a/plugins/provisioners/chef/provisioner/chef_client.rb b/plugins/provisioners/chef/provisioner/chef_client.rb index f475b1a82..3760f53d3 100644 --- a/plugins/provisioners/chef/provisioner/chef_client.rb +++ b/plugins/provisioners/chef/provisioner/chef_client.rb @@ -46,10 +46,10 @@ module VagrantPlugins def setup_server_config setup_config("provisioners/chef_client/client", "client.rb", { - :chef_server_url => @config.chef_server_url, - :validation_client_name => @config.validation_client_name, - :validation_key => guest_validation_key_path, - :client_key => @config.client_key_path, + chef_server_url: @config.chef_server_url, + validation_client_name: @config.validation_client_name, + validation_key: guest_validation_key_path, + client_key: @config.client_key_path, }) end @@ -79,7 +79,7 @@ module VagrantPlugins data = data.chomp next if data.empty? - @machine.ui.info(data, :color => color) + @machine.ui.info(data, color: color) end # There is no need to run Chef again if it converges diff --git a/plugins/provisioners/chef/provisioner/chef_solo.rb b/plugins/provisioners/chef/provisioner/chef_solo.rb index 53a2af0d3..bf66c99d5 100644 --- a/plugins/provisioners/chef/provisioner/chef_solo.rb +++ b/plugins/provisioners/chef/provisioner/chef_solo.rb @@ -121,11 +121,11 @@ module VagrantPlugins data_bags_path = guest_paths(@data_bags_folders).first environments_path = guest_paths(@environments_folders).first setup_config("provisioners/chef_solo/solo", "solo.rb", { - :cookbooks_path => cookbooks_path, - :recipe_url => @config.recipe_url, - :roles_path => roles_path, - :data_bags_path => data_bags_path, - :environments_path => environments_path, + cookbooks_path: cookbooks_path, + recipe_url: @config.recipe_url, + roles_path: roles_path, + data_bags_path: data_bags_path, + environments_path: environments_path, }) end @@ -155,7 +155,7 @@ module VagrantPlugins data = data.chomp next if data.empty? - @machine.ui.info(data, :color => color) + @machine.ui.info(data, color: color) end # There is no need to run Chef again if it converges diff --git a/plugins/provisioners/file/config.rb b/plugins/provisioners/file/config.rb index a78a19ba8..2af27e67b 100644 --- a/plugins/provisioners/file/config.rb +++ b/plugins/provisioners/file/config.rb @@ -18,7 +18,7 @@ module VagrantPlugins s = File.expand_path(source) if ! File.exist?(s) errors << I18n.t("vagrant.provisioners.file.path_invalid", - :path => s) + path: s) end end diff --git a/plugins/provisioners/puppet/config/puppet.rb b/plugins/provisioners/puppet/config/puppet.rb index e7c9dda70..2bd0d097f 100644 --- a/plugins/provisioners/puppet/config/puppet.rb +++ b/plugins/provisioners/puppet/config/puppet.rb @@ -102,12 +102,12 @@ module VagrantPlugins expand_path(machine.env.root_path) if !expanded_path.directory? errors << I18n.t("vagrant.provisioners.puppet.manifests_path_missing", - :path => expanded_path.to_s) + path: expanded_path.to_s) else expanded_manifest_file = expanded_path.join(manifest_file) if !expanded_manifest_file.file? errors << I18n.t("vagrant.provisioners.puppet.manifest_missing", - :manifest => expanded_manifest_file.to_s) + manifest: expanded_manifest_file.to_s) end end end @@ -116,7 +116,7 @@ module VagrantPlugins this_expanded_module_paths.each do |path| if !path.directory? errors << I18n.t("vagrant.provisioners.puppet.module_path_missing", - :path => path) + path: path) end end diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index c91143715..2db004d21 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -95,9 +95,9 @@ module VagrantPlugins def verify_binary(binary) @machine.communicate.sudo( "which #{binary}", - :error_class => PuppetError, - :error_key => :not_detected, - :binary => binary) + error_class: PuppetError, + error_key: :not_detected, + binary: binary) end def run_puppet_apply @@ -157,7 +157,7 @@ module VagrantPlugins @machine.ui.info(I18n.t( "vagrant.provisioners.puppet.running_puppet", - :manifest => config.manifest_file)) + manifest: config.manifest_file)) @machine.communicate.sudo(command, good_exit: [0,2]) do |type, data| if !data.chomp.empty? diff --git a/plugins/provisioners/puppet/provisioner/puppet_server.rb b/plugins/provisioners/puppet/provisioner/puppet_server.rb index 7b2337de5..ea3a67308 100644 --- a/plugins/provisioners/puppet/provisioner/puppet_server.rb +++ b/plugins/provisioners/puppet/provisioner/puppet_server.rb @@ -19,9 +19,9 @@ module VagrantPlugins def verify_binary(binary) @machine.communicate.sudo( "which #{binary}", - :error_class => PuppetServerError, - :error_key => :not_detected, - :binary => binary) + error_class: PuppetServerError, + error_key: :not_detected, + binary: binary) end def run_puppet_agent diff --git a/plugins/provisioners/shell/config.rb b/plugins/provisioners/shell/config.rb index 881b3e4cb..211090dcc 100644 --- a/plugins/provisioners/shell/config.rb +++ b/plugins/provisioners/shell/config.rb @@ -50,7 +50,7 @@ module VagrantPlugins expanded_path = Pathname.new(path).expand_path(machine.env.root_path) if !expanded_path.file? errors << I18n.t("vagrant.provisioners.shell.path_invalid", - :path => expanded_path) + path: expanded_path) else data = expanded_path.read(16) if data && !data.valid_encoding? diff --git a/plugins/provisioners/shell/provisioner.rb b/plugins/provisioners/shell/provisioner.rb index 74fa4fa57..67eca5a16 100644 --- a/plugins/provisioners/shell/provisioner.rb +++ b/plugins/provisioners/shell/provisioner.rb @@ -52,7 +52,7 @@ module VagrantPlugins # Reset upload path permissions for the current ssh user user = @machine.ssh_info[:username] comm.sudo("chown -R #{user} #{config.upload_path}", - :error_check => false) + error_check: false) comm.upload(path.to_s, config.upload_path) diff --git a/plugins/synced_folders/smb/synced_folder.rb b/plugins/synced_folders/smb/synced_folder.rb index d46fb8a81..2080efefc 100644 --- a/plugins/synced_folders/smb/synced_folder.rb +++ b/plugins/synced_folders/smb/synced_folder.rb @@ -156,14 +156,14 @@ module VagrantPlugins result = @env[:machine].provider.driver.execute('host_info.ps1', {}) @smb_shared_folders.each do |id, data| begin - options = { :share_name => data[:share_name], - :guest_path => data[:guestpath].gsub("/", "\\"), - :guest_ip => ssh_info[:host], - :username => ssh_info[:username], - :host_ip => result["host_ip"], - :password => @env[:machine].provider_config.guest.password, - :host_share_username => @env[:machine].provider_config.host_share.username, - :host_share_password => @env[:machine].provider_config.host_share.password} + options = { share_name: data[:share_name], + guest_path: data[:guestpath].gsub("/", "\\"), + guest_ip: ssh_info[:host], + username: ssh_info[:username], + host_ip: result["host_ip"], + password: @env[:machine].provider_config.guest.password, + host_share_username: @env[:machine].provider_config.host_share.username, + host_share_password: @env[:machine].provider_config.host_share.password} @env[:ui].info("Linking #{data[:share_name]} to Guest at #{data[:guestpath]} ...") @env[:machine].provider.driver.execute('mount_share.ps1', options) rescue Error::SubprocessError => e diff --git a/templates/commands/init/Vagrantfile.erb b/templates/commands/init/Vagrantfile.erb index 75bb138f1..ca55d38f2 100644 --- a/templates/commands/init/Vagrantfile.erb +++ b/templates/commands/init/Vagrantfile.erb @@ -100,7 +100,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # chef.add_role "web" # # # You may also specify custom JSON attributes: - # chef.json = { :mysql_password => "foo" } + # chef.json = { mysql_password: "foo" } # end # Enable provisioning with chef server, specifying the chef server URL, diff --git a/test/unit/plugins/commands/ssh_config/command_test.rb b/test/unit/plugins/commands/ssh_config/command_test.rb index f80c5b225..e458776ec 100644 --- a/test/unit/plugins/commands/ssh_config/command_test.rb +++ b/test/unit/plugins/commands/ssh_config/command_test.rb @@ -19,12 +19,12 @@ describe VagrantPlugins::CommandSSHConfig::Command do let(:argv) { [] } let(:ssh_info) {{ - :host => "testhost.vagrant.dev", - :port => 1234, - :username => "testuser", - :private_key_path => [], - :forward_agent => false, - :forward_x11 => false + host: "testhost.vagrant.dev", + port: 1234, + username: "testuser", + private_key_path: [], + forward_agent: false, + forward_x11: false }} subject { described_class.new(argv, iso_env) } @@ -57,7 +57,7 @@ Host #{machine.name} end it "turns on agent forwarding when it is configured" do - allow(machine).to receive(:ssh_info) { ssh_info.merge(:forward_agent => true) } + allow(machine).to receive(:ssh_info) { ssh_info.merge(forward_agent: true) } output = "" allow(subject).to receive(:safe_puts) do |data| @@ -70,7 +70,7 @@ Host #{machine.name} end it "turns on x11 forwarding when it is configured" do - allow(machine).to receive(:ssh_info) { ssh_info.merge(:forward_x11 => true) } + allow(machine).to receive(:ssh_info) { ssh_info.merge(forward_x11: true) } output = "" allow(subject).to receive(:safe_puts) do |data| @@ -83,7 +83,7 @@ Host #{machine.name} end it "handles multiple private key paths" do - allow(machine).to receive(:ssh_info) { ssh_info.merge(:private_key_path => ["foo", "bar"]) } + allow(machine).to receive(:ssh_info) { ssh_info.merge(private_key_path: ["foo", "bar"]) } output = "" allow(subject).to receive(:safe_puts) do |data| @@ -97,7 +97,7 @@ Host #{machine.name} end it "puts quotes around an identityfile path if it has a space" do - allow(machine).to receive(:ssh_info) { ssh_info.merge(:private_key_path => ["with a space"]) } + allow(machine).to receive(:ssh_info) { ssh_info.merge(private_key_path: ["with a space"]) } output = "" allow(subject).to receive(:safe_puts) do |data| output += data if data diff --git a/test/unit/plugins/communicators/winrm/command_filter_test.rb b/test/unit/plugins/communicators/winrm/command_filter_test.rb index e56d1cd10..f7ed9eb54 100644 --- a/test/unit/plugins/communicators/winrm/command_filter_test.rb +++ b/test/unit/plugins/communicators/winrm/command_filter_test.rb @@ -2,7 +2,7 @@ require File.expand_path("../../../../base", __FILE__) require Vagrant.source_root.join("plugins/communicators/winrm/command_filter") -describe VagrantPlugins::CommunicatorWinRM::CommandFilter, :unit => true do +describe VagrantPlugins::CommunicatorWinRM::CommandFilter, unit: true do describe '.command_filters' do it 'initializes all command filters in command filters directory' do diff --git a/test/unit/plugins/communicators/winrm/communicator_test.rb b/test/unit/plugins/communicators/winrm/communicator_test.rb index c2a8c8139..80d11d4c6 100644 --- a/test/unit/plugins/communicators/winrm/communicator_test.rb +++ b/test/unit/plugins/communicators/winrm/communicator_test.rb @@ -5,9 +5,9 @@ require Vagrant.source_root.join("plugins/communicators/winrm/communicator") describe VagrantPlugins::CommunicatorWinRM::Communicator do include_context "unit" - let(:winrm) { double("winrm", :timeout => 1) } - let(:config) { double("config", :winrm => winrm) } - let(:machine) { double("machine", :config => config) } + let(:winrm) { double("winrm", timeout: 1) } + let(:config) { double("config", winrm: winrm) } + let(:machine) { double("machine", config: config) } let(:shell) { double("shell") } @@ -57,7 +57,7 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do it "can use cmd shell" do expect(shell).to receive(:cmd).with(kind_of(String)).and_return({ exitcode: 0 }) - expect(subject.execute("dir", { :shell => :cmd })).to eq(0) + expect(subject.execute("dir", { shell: :cmd })).to eq(0) end it "raises error when error_check is true and exit code is non-zero" do @@ -68,7 +68,7 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do it "does not raise error when error_check is false and exit code is non-zero" do expect(shell).to receive(:powershell).with(kind_of(String)).and_return({ exitcode: 1 }) - expect(subject.execute("dir", { :error_check => false })).to eq(1) + expect(subject.execute("dir", { error_check: false })).to eq(1) end end diff --git a/test/unit/plugins/guests/smartos/cap/configure_networks_test.rb b/test/unit/plugins/guests/smartos/cap/configure_networks_test.rb index 711875573..ca47a988f 100644 --- a/test/unit/plugins/guests/smartos/cap/configure_networks_test.rb +++ b/test/unit/plugins/guests/smartos/cap/configure_networks_test.rb @@ -20,7 +20,7 @@ describe "VagrantPlugins::VagrantPlugins::Cap::ConfigureNetworks" do let(:device) { "e1000g#{interface}" } describe 'dhcp' do - let(:network) { {:interface => interface, :type => :dhcp} } + let(:network) { {interface: interface, type: :dhcp} } it "plumbs the device" do communicator.expect_command(%Q(pfexec /sbin/ifconfig #{device} plumb)) @@ -34,7 +34,7 @@ describe "VagrantPlugins::VagrantPlugins::Cap::ConfigureNetworks" do end describe 'static' do - let(:network) { {:interface => interface, :type => :static, :ip => '1.1.1.1', :netmask => '255.255.255.0'} } + let(:network) { {interface: interface, type: :static, ip: '1.1.1.1', netmask: '255.255.255.0'} } it "plumbs the network" do communicator.expect_command(%Q(pfexec /sbin/ifconfig #{device} plumb)) diff --git a/test/unit/plugins/guests/smartos/cap/mount_nfs_test.rb b/test/unit/plugins/guests/smartos/cap/mount_nfs_test.rb index cbf0b875a..b4038f76a 100644 --- a/test/unit/plugins/guests/smartos/cap/mount_nfs_test.rb +++ b/test/unit/plugins/guests/smartos/cap/mount_nfs_test.rb @@ -18,12 +18,12 @@ describe "VagrantPlugins::VagrantPlugins::Cap::MountNFS" do describe ".mount_nfs_folder" do it "creates the directory mount point" do communicator.expect_command(%Q(pfexec mkdir -p /mountpoint)) - plugin.mount_nfs_folder(machine, '1.1.1.1', {'nfs' => {:guestpath => '/mountpoint'}}) + plugin.mount_nfs_folder(machine, '1.1.1.1', {'nfs' => {guestpath: '/mountpoint'}}) end it "mounts the NFS share" do communicator.expect_command(%Q(pfexec /usr/sbin/mount -F nfs '1.1.1.1:/some/share' '/mountpoint')) - plugin.mount_nfs_folder(machine, '1.1.1.1', {'nfs' => {:guestpath => '/mountpoint', :hostpath => '/some/share'}}) + plugin.mount_nfs_folder(machine, '1.1.1.1', {'nfs' => {guestpath: '/mountpoint', hostpath: '/some/share'}}) end end end diff --git a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb index 6353ea095..8acc6fa28 100644 --- a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb +++ b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb @@ -73,7 +73,7 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do it "retries through guest property not found errors" do raise_then_return = [ - lambda { raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, :guest_property => 'stub' }, + lambda { raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: 'stub' }, lambda { "2.3.4.5" } ] allow(driver).to receive(:read_guest_ip) { raise_then_return.shift.call } @@ -86,7 +86,7 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do it "raises an error informing the user of a bug when the guest IP cannot be found" do allow(driver).to receive(:read_guest_ip) { - raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, :guest_property => 'stub' + raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: 'stub' } expect { subject.call(env) }. @@ -97,7 +97,7 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do env[:machine].config.vm.network :private_network, ip: "11.12.13.14" allow(driver).to receive(:read_guest_ip) { - raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, :guest_property => "stub" + raise Vagrant::Errors::VirtualBoxGuestPropertyNotFound, guest_property: "stub" } subject.call(env) diff --git a/test/unit/plugins/provisioners/ansible/config_test.rb b/test/unit/plugins/provisioners/ansible/config_test.rb index d3cdc8208..ab1b6dca0 100644 --- a/test/unit/plugins/provisioners/ansible/config_test.rb +++ b/test/unit/plugins/provisioners/ansible/config_test.rb @@ -99,7 +99,7 @@ describe VagrantPlugins::Ansible::Config do result = subject.validate(machine) expect(result["ansible provisioner"]).to eql([ I18n.t("vagrant.provisioners.ansible.playbook_path_invalid", - :path => non_existing_file) + path: non_existing_file) ]) end @@ -126,8 +126,8 @@ describe VagrantPlugins::Ansible::Config do result = subject.validate(machine) expect(result["ansible provisioner"]).to eql([ I18n.t("vagrant.provisioners.ansible.extra_vars_invalid", - :type => subject.extra_vars.class.to_s, - :value => subject.extra_vars.to_s) + type: subject.extra_vars.class.to_s, + value: subject.extra_vars.to_s) ]) end @@ -138,8 +138,8 @@ describe VagrantPlugins::Ansible::Config do result = subject.validate(machine) expect(result["ansible provisioner"]).to eql([ I18n.t("vagrant.provisioners.ansible.extra_vars_invalid", - :type => subject.extra_vars.class.to_s, - :value => subject.extra_vars.to_s) + type: subject.extra_vars.class.to_s, + value: subject.extra_vars.to_s) ]) end @@ -158,7 +158,7 @@ describe VagrantPlugins::Ansible::Config do result = subject.validate(machine) expect(result["ansible provisioner"]).to eql([ I18n.t("vagrant.provisioners.ansible.inventory_path_invalid", - :path => non_existing_file) + path: non_existing_file) ]) end @@ -169,7 +169,7 @@ describe VagrantPlugins::Ansible::Config do result = subject.validate(machine) expect(result["ansible provisioner"]).to eql([ I18n.t("vagrant.provisioners.ansible.vault_password_file_invalid", - :path => non_existing_file) + path: non_existing_file) ]) end @@ -182,14 +182,14 @@ describe VagrantPlugins::Ansible::Config do result = subject.validate(machine) expect(result["ansible provisioner"]).to include( I18n.t("vagrant.provisioners.ansible.playbook_path_invalid", - :path => non_existing_file)) + path: non_existing_file)) expect(result["ansible provisioner"]).to include( I18n.t("vagrant.provisioners.ansible.extra_vars_invalid", - :type => subject.extra_vars.class.to_s, - :value => subject.extra_vars.to_s)) + type: subject.extra_vars.class.to_s, + value: subject.extra_vars.to_s)) expect(result["ansible provisioner"]).to include( I18n.t("vagrant.provisioners.ansible.inventory_path_invalid", - :path => non_existing_file)) + path: non_existing_file)) end end diff --git a/test/unit/support/isolated_environment.rb b/test/unit/support/isolated_environment.rb index 94fb907bd..d8393f72b 100644 --- a/test/unit/support/isolated_environment.rb +++ b/test/unit/support/isolated_environment.rb @@ -15,8 +15,8 @@ module Unit class IsolatedEnvironment < ::IsolatedEnvironment def create_vagrant_env(options=nil) options = { - :cwd => @workdir, - :home_path => @homedir + cwd: @workdir, + home_path: @homedir }.merge(options || {}) Vagrant::Environment.new(options) @@ -64,7 +64,7 @@ module Unit def box2(name, provider, options=nil) # Default options options = { - :vagrantfile => "" + vagrantfile: "" }.merge(options || {}) # Make the box directory @@ -75,7 +75,7 @@ module Unit box_metadata_file = box_dir.join("metadata.json") box_metadata_file.open("w") do |f| f.write(JSON.generate({ - :provider => provider.to_s + provider: provider.to_s })) end @@ -105,7 +105,7 @@ module Unit box_metadata_file = box_dir.join("metadata.json") box_metadata_file.open("w") do |f| f.write(JSON.generate({ - :provider => provider.to_s + provider: provider.to_s })) end diff --git a/test/unit/vagrant/action/builder_test.rb b/test/unit/vagrant/action/builder_test.rb index 98c198dfa..c4f67a118 100644 --- a/test/unit/vagrant/action/builder_test.rb +++ b/test/unit/vagrant/action/builder_test.rb @@ -1,7 +1,7 @@ require File.expand_path("../../../base", __FILE__) describe Vagrant::Action::Builder do - let(:data) { { :data => [] } } + let(:data) { { data: [] } } # This returns a proc that can be used with the builder # that simply appends data to an array in the env. @@ -246,7 +246,7 @@ describe Vagrant::Action::Builder do it "applies without prepend/append if it has already" do hook = double("hook") - expect(hook).to receive(:apply).with(anything, { :no_prepend_or_append => true }).once + expect(hook).to receive(:apply).with(anything, { no_prepend_or_append: true }).once data[:action_hooks] = [hook] data[:action_hooks_already_ran] = true diff --git a/test/unit/vagrant/action/builtin/call_test.rb b/test/unit/vagrant/action/builtin/call_test.rb index c096c5692..43e910c25 100644 --- a/test/unit/vagrant/action/builtin/call_test.rb +++ b/test/unit/vagrant/action/builtin/call_test.rb @@ -49,7 +49,7 @@ describe Vagrant::Action::Builtin::Call do described_class.new(app, env, callable) do |_env, _builder| # Nothing. - end.call({ :foo => :bar }) + end.call({ foo: :bar }) expect(received).to eq(:bar) end @@ -73,7 +73,7 @@ describe Vagrant::Action::Builtin::Call do described_class.new(app, env, callable) do |_env, builder| builder.use next_step - end.call({ :foo => :bar }) + end.call({ foo: :bar }) expect(received).to eq(:bar) end diff --git a/test/unit/vagrant/action/builtin/confirm_test.rb b/test/unit/vagrant/action/builtin/confirm_test.rb index 33122b17d..fb386eb1d 100644 --- a/test/unit/vagrant/action/builtin/confirm_test.rb +++ b/test/unit/vagrant/action/builtin/confirm_test.rb @@ -2,7 +2,7 @@ require File.expand_path("../../../../base", __FILE__) describe Vagrant::Action::Builtin::Confirm do let(:app) { lambda { |env| } } - let(:env) { { :ui => double("ui") } } + let(:env) { { ui: double("ui") } } let(:message) { "foo" } ["y", "Y"].each do |valid| diff --git a/test/unit/vagrant/action/builtin/env_set_test.rb b/test/unit/vagrant/action/builtin/env_set_test.rb index 50dd4fc6d..2b3401aee 100644 --- a/test/unit/vagrant/action/builtin/env_set_test.rb +++ b/test/unit/vagrant/action/builtin/env_set_test.rb @@ -5,7 +5,7 @@ describe Vagrant::Action::Builtin::EnvSet do let(:env) { {} } it "should set the new environment" do - described_class.new(app, env, :foo => :bar).call(env) + described_class.new(app, env, foo: :bar).call(env) expect(env[:foo]).to eq(:bar) end @@ -14,7 +14,7 @@ describe Vagrant::Action::Builtin::EnvSet do callable = lambda { |env| env[:called] = env[:foo] } expect(env[:called]).to be_nil - described_class.new(callable, env, :foo => :yep).call(env) + described_class.new(callable, env, foo: :yep).call(env) expect(env[:called]).to eq(:yep) end end diff --git a/test/unit/vagrant/action/builtin/graceful_halt_test.rb b/test/unit/vagrant/action/builtin/graceful_halt_test.rb index 93d3fc887..46d56039f 100644 --- a/test/unit/vagrant/action/builtin/graceful_halt_test.rb +++ b/test/unit/vagrant/action/builtin/graceful_halt_test.rb @@ -2,7 +2,7 @@ require File.expand_path("../../../../base", __FILE__) describe Vagrant::Action::Builtin::GracefulHalt do let(:app) { lambda { |env| } } - let(:env) { { :machine => machine, :ui => ui } } + let(:env) { { machine: machine, ui: ui } } let(:machine) do result = double("machine") allow(result).to receive(:config).and_return(machine_config) @@ -13,8 +13,8 @@ describe Vagrant::Action::Builtin::GracefulHalt do let(:machine_config) do double("machine_config").tap do |top_config| vm_config = double("machien_vm_config") - vm_config.stub(:graceful_halt_timeout => 10) - top_config.stub(:vm => vm_config) + vm_config.stub(graceful_halt_timeout: 10) + top_config.stub(vm: vm_config) end end let(:machine_guest) { double("machine_guest") } diff --git a/test/unit/vagrant/action/builtin/is_state_test.rb b/test/unit/vagrant/action/builtin/is_state_test.rb index 3e0133365..e060d7fb7 100644 --- a/test/unit/vagrant/action/builtin/is_state_test.rb +++ b/test/unit/vagrant/action/builtin/is_state_test.rb @@ -5,7 +5,7 @@ require File.expand_path("../../../../base", __FILE__) describe Vagrant::Action::Builtin::IsState do let(:app) { lambda { |env| } } - let(:env) { { :machine => machine } } + let(:env) { { machine: machine } } let(:machine) do double("machine").tap do |machine| allow(machine).to receive(:state).and_return(state) diff --git a/test/unit/vagrant/action/builtin/lock_test.rb b/test/unit/vagrant/action/builtin/lock_test.rb index 03c425772..f2cdf793a 100644 --- a/test/unit/vagrant/action/builtin/lock_test.rb +++ b/test/unit/vagrant/action/builtin/lock_test.rb @@ -10,8 +10,8 @@ describe Vagrant::Action::Builtin::Lock do let(:options) do { - :exception => Class.new(StandardError), - :path => lock_path + exception: Class.new(StandardError), + path: lock_path } end @@ -19,13 +19,13 @@ describe Vagrant::Action::Builtin::Lock do expect { described_class.new(app, env) }. to raise_error(ArgumentError) - expect { described_class.new(app, env, :path => "foo") }. + expect { described_class.new(app, env, path: "foo") }. to raise_error(ArgumentError) - expect { described_class.new(app, env, :exception => "foo") }. + expect { described_class.new(app, env, exception: "foo") }. to raise_error(ArgumentError) - expect { described_class.new(app, env, :path => "bar", :exception => "foo") }. + expect { described_class.new(app, env, path: "bar", exception: "foo") }. to_not raise_error end diff --git a/test/unit/vagrant/action/builtin/message_test.rb b/test/unit/vagrant/action/builtin/message_test.rb index bb477da1b..2a51c17b4 100644 --- a/test/unit/vagrant/action/builtin/message_test.rb +++ b/test/unit/vagrant/action/builtin/message_test.rb @@ -5,7 +5,7 @@ require File.expand_path("../../../../base", __FILE__) describe Vagrant::Action::Builtin::Message do let(:app) { lambda { |env| } } - let(:env) { { :ui => ui } } + let(:env) { { ui: ui } } let(:ui) { double("ui") } diff --git a/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb b/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb index eb4156cab..9ab2bf637 100644 --- a/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb +++ b/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb @@ -24,7 +24,7 @@ describe Vagrant::Action::Builtin::MixinSyncedFolders do let(:machine_config) do double("machine_config").tap do |top_config| - top_config.stub(:vm => vm_config) + top_config.stub(vm: vm_config) end end @@ -46,9 +46,9 @@ describe Vagrant::Action::Builtin::MixinSyncedFolders do describe "impl_opts" do it "should return only relevant keys" do env = { - :foo_bar => "baz", - :bar_bar => "nope", - :foo_baz => "bar", + foo_bar: "baz", + bar_bar: "nope", + foo_baz: "bar", } result = subject.impl_opts("foo", env) @@ -66,8 +66,8 @@ describe Vagrant::Action::Builtin::MixinSyncedFolders do plugins[:default] = [impl(true, "default"), 10] plugins[:nfs] = [impl(true, "nfs"), 5] - subject.stub(:plugins => plugins) - vm_config.stub(:synced_folders => folders) + subject.stub(plugins: plugins) + vm_config.stub(synced_folders: folders) end it "should raise exception if bad type is given" do diff --git a/test/unit/vagrant/action/builtin/ssh_exec_test.rb b/test/unit/vagrant/action/builtin/ssh_exec_test.rb index 5662321e0..17f355497 100644 --- a/test/unit/vagrant/action/builtin/ssh_exec_test.rb +++ b/test/unit/vagrant/action/builtin/ssh_exec_test.rb @@ -4,7 +4,7 @@ require "vagrant/util/ssh" describe Vagrant::Action::Builtin::SSHExec do let(:app) { lambda { |env| } } - let(:env) { { :machine => machine } } + let(:env) { { machine: machine } } let(:machine) do result = double("machine") allow(result).to receive(:ssh_info).and_return(machine_ssh_info) @@ -57,7 +57,7 @@ describe Vagrant::Action::Builtin::SSHExec do end it "should exec with the options given in `ssh_opts`" do - ssh_opts = { :foo => :bar } + ssh_opts = { foo: :bar } expect(ssh_klass).to receive(:exec). with(machine_ssh_info, ssh_opts) diff --git a/test/unit/vagrant/action/builtin/synced_folder_cleanup_test.rb b/test/unit/vagrant/action/builtin/synced_folder_cleanup_test.rb index c1ed71f5e..52973f33d 100644 --- a/test/unit/vagrant/action/builtin/synced_folder_cleanup_test.rb +++ b/test/unit/vagrant/action/builtin/synced_folder_cleanup_test.rb @@ -7,7 +7,7 @@ describe Vagrant::Action::Builtin::SyncedFolderCleanup do include_context "synced folder actions" let(:app) { lambda { |env| } } - let(:env) { { :machine => machine, :ui => ui } } + let(:env) { { machine: machine, ui: ui } } let(:machine) do double("machine").tap do |machine| allow(machine).to receive(:config).and_return(machine_config) @@ -16,7 +16,7 @@ describe Vagrant::Action::Builtin::SyncedFolderCleanup do let(:machine_config) do double("machine_config").tap do |top_config| - top_config.stub(:vm => vm_config) + top_config.stub(vm: vm_config) end end @@ -55,8 +55,8 @@ describe Vagrant::Action::Builtin::SyncedFolderCleanup do env[:machine] = Object.new env[:root_path] = Pathname.new(Dir.mktmpdir) - subject.stub(:plugins => plugins) - subject.stub(:synced_folders => synced_folders) + subject.stub(plugins: plugins) + subject.stub(synced_folders: synced_folders) end it "should invoke cleanup" do diff --git a/test/unit/vagrant/action/builtin/synced_folders_test.rb b/test/unit/vagrant/action/builtin/synced_folders_test.rb index f1cf09294..0eb0719cb 100644 --- a/test/unit/vagrant/action/builtin/synced_folders_test.rb +++ b/test/unit/vagrant/action/builtin/synced_folders_test.rb @@ -10,7 +10,7 @@ describe Vagrant::Action::Builtin::SyncedFolders do include_context "synced folder actions" let(:app) { lambda { |env| } } - let(:env) { { :machine => machine, :ui => ui } } + let(:env) { { machine: machine, ui: ui } } let(:machine) do double("machine").tap do |machine| allow(machine).to receive(:config).and_return(machine_config) @@ -19,7 +19,7 @@ describe Vagrant::Action::Builtin::SyncedFolders do let(:machine_config) do double("machine_config").tap do |top_config| - top_config.stub(:vm => vm_config) + top_config.stub(vm: vm_config) end end @@ -42,8 +42,8 @@ describe Vagrant::Action::Builtin::SyncedFolders do plugins[:nfs] = [impl(true, "nfs"), 5] env[:root_path] = Pathname.new(Dir.mktmpdir) - subject.stub(:plugins => plugins) - subject.stub(:synced_folders => synced_folders) + subject.stub(plugins: plugins) + subject.stub(synced_folders: synced_folders) allow(subject).to receive(:save_synced_folders) end diff --git a/test/unit/vagrant/action/warden_test.rb b/test/unit/vagrant/action/warden_test.rb index b726da3cc..b9758be7a 100644 --- a/test/unit/vagrant/action/warden_test.rb +++ b/test/unit/vagrant/action/warden_test.rb @@ -1,7 +1,7 @@ require File.expand_path("../../../base", __FILE__) describe Vagrant::Action::Warden do - let(:data) { { :data => [] } } + let(:data) { { data: [] } } let(:instance) { described_class.new } # This returns a proc that can be used with the builder @@ -48,7 +48,7 @@ describe Vagrant::Action::Warden do error_proc = Proc.new { raise "ERROR!" } - data = { :recover => [] } + data = { recover: [] } instance = described_class.new([Action, ActionTwo, error_proc], data) # The error should be raised back up diff --git a/test/unit/vagrant/batch_action_test.rb b/test/unit/vagrant/batch_action_test.rb index 298c028ad..deba02ac5 100644 --- a/test/unit/vagrant/batch_action_test.rb +++ b/test/unit/vagrant/batch_action_test.rb @@ -11,8 +11,8 @@ describe Vagrant::BatchAction do def new_machine(options) double("machine").tap do |m| - m.stub(:provider_name => provider_name) - m.stub(:provider_options => options) + m.stub(provider_name: provider_name) + m.stub(provider_options: options) allow(m).to receive(:action) do |action, opts| lock.synchronize do called_actions << [m, action, opts] diff --git a/test/unit/vagrant/config/v1/loader_test.rb b/test/unit/vagrant/config/v1/loader_test.rb index deca8cf3c..e1d78102a 100644 --- a/test/unit/vagrant/config/v1/loader_test.rb +++ b/test/unit/vagrant/config/v1/loader_test.rb @@ -98,8 +98,8 @@ describe Vagrant::Config::V1::Loader do describe "merging" do it "should merge available configuration keys" do - old = Vagrant::Config::V1::Root.new({ :foo => Object }) - new = Vagrant::Config::V1::Root.new({ :bar => Object }) + old = Vagrant::Config::V1::Root.new({ foo: Object }) + new = Vagrant::Config::V1::Root.new({ bar: Object }) result = described_class.merge(old, new) expect(result.foo).to be_kind_of(Object) expect(result.bar).to be_kind_of(Object) @@ -110,10 +110,10 @@ describe Vagrant::Config::V1::Loader do attr_accessor :value end - old = Vagrant::Config::V1::Root.new({ :foo => config_class }) + old = Vagrant::Config::V1::Root.new({ foo: config_class }) old.foo.value = "old" - new = Vagrant::Config::V1::Root.new({ :bar => config_class }) + new = Vagrant::Config::V1::Root.new({ bar: config_class }) new.bar.value = "new" result = described_class.merge(old, new) @@ -132,10 +132,10 @@ describe Vagrant::Config::V1::Loader do end end - old = Vagrant::Config::V1::Root.new({ :foo => config_class }) + old = Vagrant::Config::V1::Root.new({ foo: config_class }) old.foo.value = 10 - new = Vagrant::Config::V1::Root.new({ :foo => config_class }) + new = Vagrant::Config::V1::Root.new({ foo: config_class }) new.foo.value = 15 result = described_class.merge(old, new) diff --git a/test/unit/vagrant/config/v1/root_test.rb b/test/unit/vagrant/config/v1/root_test.rb index 695d64250..9494dbcd8 100644 --- a/test/unit/vagrant/config/v1/root_test.rb +++ b/test/unit/vagrant/config/v1/root_test.rb @@ -5,7 +5,7 @@ describe Vagrant::Config::V1::Root do it "should provide access to config objects" do foo_class = Class.new - map = { :foo => foo_class } + map = { foo: foo_class } instance = described_class.new(map) foo = instance.foo @@ -14,7 +14,7 @@ describe Vagrant::Config::V1::Root do end it "can be created with initial state" do - instance = described_class.new({}, { :foo => "bar" }) + instance = described_class.new({}, { foo: "bar" }) expect(instance.foo).to eq("bar") end diff --git a/test/unit/vagrant/config/v2/loader_test.rb b/test/unit/vagrant/config/v2/loader_test.rb index b2e020179..e6e4e421e 100644 --- a/test/unit/vagrant/config/v2/loader_test.rb +++ b/test/unit/vagrant/config/v2/loader_test.rb @@ -67,8 +67,8 @@ describe Vagrant::Config::V2::Loader do describe "merging" do it "should merge available configuration keys" do - old = Vagrant::Config::V2::Root.new({ :foo => Object }) - new = Vagrant::Config::V2::Root.new({ :bar => Object }) + old = Vagrant::Config::V2::Root.new({ foo: Object }) + new = Vagrant::Config::V2::Root.new({ bar: Object }) result = described_class.merge(old, new) expect(result.foo).to be_kind_of(Object) expect(result.bar).to be_kind_of(Object) @@ -79,10 +79,10 @@ describe Vagrant::Config::V2::Loader do attr_accessor :value end - old = Vagrant::Config::V2::Root.new({ :foo => config_class }) + old = Vagrant::Config::V2::Root.new({ foo: config_class }) old.foo.value = "old" - new = Vagrant::Config::V2::Root.new({ :bar => config_class }) + new = Vagrant::Config::V2::Root.new({ bar: config_class }) new.bar.value = "new" result = described_class.merge(old, new) @@ -101,10 +101,10 @@ describe Vagrant::Config::V2::Loader do end end - old = Vagrant::Config::V2::Root.new({ :foo => config_class }) + old = Vagrant::Config::V2::Root.new({ foo: config_class }) old.foo.value = 10 - new = Vagrant::Config::V2::Root.new({ :foo => config_class }) + new = Vagrant::Config::V2::Root.new({ foo: config_class }) new.foo.value = 15 result = described_class.merge(old, new) @@ -115,7 +115,7 @@ describe Vagrant::Config::V2::Loader do describe "upgrading" do it "should continue fine if the key doesn't implement upgrade" do # Make an old V1 root object - old = Vagrant::Config::V1::Root.new({ :foo => Class.new }) + old = Vagrant::Config::V1::Root.new({ foo: Class.new }) # It should work fine expect { result = described_class.upgrade(old) }.to_not raise_error @@ -139,7 +139,7 @@ describe Vagrant::Config::V2::Loader do end # Test it out! - old = Vagrant::Config::V1::Root.new({ :foo => config_class }) + old = Vagrant::Config::V1::Root.new({ foo: config_class }) old.foo.value = 5 data = described_class.upgrade(old) diff --git a/test/unit/vagrant/config/v2/root_test.rb b/test/unit/vagrant/config/v2/root_test.rb index eaf67b038..7eb3cc852 100644 --- a/test/unit/vagrant/config/v2/root_test.rb +++ b/test/unit/vagrant/config/v2/root_test.rb @@ -7,7 +7,7 @@ describe Vagrant::Config::V2::Root do it "should provide access to config objects" do foo_class = Class.new - map = { :foo => foo_class } + map = { foo: foo_class } instance = described_class.new(map) foo = instance.foo @@ -27,7 +27,7 @@ describe Vagrant::Config::V2::Root do end it "can be created with initial state" do - instance = described_class.new({}, { :foo => "bar" }) + instance = described_class.new({}, { foo: "bar" }) expect(instance.foo).to eq("bar") end @@ -51,7 +51,7 @@ describe Vagrant::Config::V2::Root do end end - map = { :foo => foo_class } + map = { foo: foo_class } instance = described_class.new(map) instance.finalize! @@ -72,7 +72,7 @@ describe Vagrant::Config::V2::Root do describe "validation" do let(:instance) do - map = { :foo => Object, :bar => Object } + map = { foo: Object, bar: Object } described_class.new(map) end diff --git a/test/unit/vagrant/environment_test.rb b/test/unit/vagrant/environment_test.rb index f85339310..a447ea9f1 100644 --- a/test/unit/vagrant/environment_test.rb +++ b/test/unit/vagrant/environment_test.rb @@ -28,7 +28,7 @@ describe Vagrant::Environment do describe "#home_path" do it "is set to the home path given" do Dir.mktmpdir do |dir| - instance = described_class.new(:home_path => dir) + instance = described_class.new(home_path: dir) expect(instance.home_path).to eq(Pathname.new(dir)) end end @@ -45,7 +45,7 @@ describe Vagrant::Environment do it "throws an exception if inaccessible", skip_windows: true do expect { - described_class.new(:home_path => "/") + described_class.new(home_path: "/") }.to raise_error(Vagrant::Errors::HomeDirectoryNotAccessible) end @@ -404,7 +404,7 @@ Vagrant.configure("2") do |config| end VF - env.box3("base", "1.0", :foo, :vagrantfile => <<-VF) + env.box3("base", "1.0", :foo, vagrantfile: <<-VF) Vagrant.configure("2") do |config| config.ssh.port = 100 end @@ -426,7 +426,7 @@ Vagrant.configure("2") do |config| end VF - env.box3("base", "1.0", :foo, :vagrantfile => <<-VF) + env.box3("base", "1.0", :foo, vagrantfile: <<-VF) Vagrant.configure("2") do |config| config.ssh.port = 100 end @@ -451,7 +451,7 @@ Vagrant.configure("2") do |config| end VF - env.box3("base", "1.0", :bar, :vagrantfile => <<-VF) + env.box3("base", "1.0", :bar, vagrantfile: <<-VF) Vagrant.configure("2") do |config| config.ssh.port = 100 end @@ -473,13 +473,13 @@ Vagrant.configure("2") do |config| end VF - env.box3("base", "1.0", :fA, :vagrantfile => <<-VF) + env.box3("base", "1.0", :fA, vagrantfile: <<-VF) Vagrant.configure("2") do |config| config.ssh.port = 100 end VF - env.box3("base", "1.0", :fB, :vagrantfile => <<-VF) + env.box3("base", "1.0", :fB, vagrantfile: <<-VF) Vagrant.configure("2") do |config| config.ssh.port = 200 end @@ -502,13 +502,13 @@ Vagrant.configure("2") do |config| end VF - env.box3("base", "1.0", :foo, :vagrantfile => <<-VF) + env.box3("base", "1.0", :foo, vagrantfile: <<-VF) Vagrant.configure("2") do |config| config.ssh.port = 100 end VF - env.box3("base", "1.5", :foo, :vagrantfile => <<-VF) + env.box3("base", "1.5", :foo, vagrantfile: <<-VF) Vagrant.configure("2") do |config| config.ssh.port = 200 end @@ -684,7 +684,7 @@ VF it "is set to the cwd given" do Dir.mktmpdir do |directory| - instance = described_class.new(:cwd => directory) + instance = described_class.new(cwd: directory) expect(instance.cwd).to eq(Pathname.new(directory)) end end @@ -700,7 +700,7 @@ VF end it "raises an exception if the CWD doesn't exist" do - expect { described_class.new(:cwd => "doesntexist") }. + expect { described_class.new(cwd: "doesntexist") }. to raise_error(Vagrant::Errors::EnvironmentNonExistentCWD) end end @@ -816,13 +816,13 @@ VF end it "is expanded relative to the cwd" do - instance = described_class.new(:local_data_path => "foo") + instance = described_class.new(local_data_path: "foo") expect(instance.local_data_path).to eq(instance.cwd.join("foo")) end it "is set to the given value" do Dir.mktmpdir do |dir| - instance = described_class.new(:local_data_path => dir) + instance = described_class.new(local_data_path: dir) expect(instance.local_data_path.to_s).to eq(dir) end end @@ -836,7 +836,7 @@ VF let(:v1_dotfile) { Pathname.new(v1_dotfile_tempfile.path) } let(:local_data_path) { v1_dotfile_tempfile.path } - let(:instance) { described_class.new(:local_data_path => local_data_path) } + let(:instance) { described_class.new(local_data_path: local_data_path) } it "should be fine if dotfile is empty" do v1_dotfile.open("w+") do |f| @@ -885,7 +885,7 @@ VF describe "copying the private SSH key" do it "copies the SSH key into the home directory" do env = isolated_environment - instance = described_class.new(:home_path => env.homedir) + instance = described_class.new(home_path: env.homedir) pk = env.homedir.join("insecure_private_key") expect(pk).to be_exist @@ -974,7 +974,7 @@ VF Vagrant.configure("2") do |config| config.vm.box = "base" config.vm.define :foo - config.vm.define :bar, :primary => true + config.vm.define :bar, primary: true end VF @@ -1026,7 +1026,7 @@ end VF end - env = environment.create_vagrant_env(:vagrantfile_name => "non_standard_name") + env = environment.create_vagrant_env(vagrantfile_name: "non_standard_name") expect(env.vagrantfile.config.ssh.port).to eq(200) end @@ -1056,7 +1056,7 @@ VF # Create a custom UI for our test class CustomUI < Vagrant::UI::Interface; end - instance = described_class.new(:ui_class => CustomUI) + instance = described_class.new(ui_class: CustomUI) expect(instance.ui).to be_kind_of(CustomUI) end end diff --git a/test/unit/vagrant/guest_test.rb b/test/unit/vagrant/guest_test.rb index 07d60f298..b819628c9 100644 --- a/test/unit/vagrant/guest_test.rb +++ b/test/unit/vagrant/guest_test.rb @@ -9,10 +9,10 @@ describe Vagrant::Guest do let(:guests) { {} } let(:machine) do double("machine").tap do |m| - m.stub(:inspect => "machine") - m.stub(:config => double("config")) - m.config.stub(:vm => double("vm_config")) - m.config.vm.stub(:guest => nil) + m.stub(inspect: "machine") + m.stub(config: double("config")) + m.config.stub(vm: double("vm_config")) + m.config.vm.stub(guest: nil) end end diff --git a/test/unit/vagrant/machine_test.rb b/test/unit/vagrant/machine_test.rb index e483a8191..0c40b713a 100644 --- a/test/unit/vagrant/machine_test.rb +++ b/test/unit/vagrant/machine_test.rb @@ -9,12 +9,12 @@ describe Vagrant::Machine do let(:name) { "foo" } let(:provider) do double("provider").tap do |obj| - obj.stub(:_initialize => nil) + obj.stub(_initialize: nil) end end let(:provider_cls) do obj = double("provider_cls") - obj.stub(:new => provider) + obj.stub(new: provider) obj end let(:provider_config) { Object.new } @@ -87,7 +87,7 @@ describe Vagrant::Machine do if !instance instance = double("instance") - instance.stub(:_initialize => nil) + instance.stub(_initialize: nil) end provider_cls = double("provider_cls") @@ -243,7 +243,7 @@ describe Vagrant::Machine do callable = lambda { |env| foo = env[:foo] } allow(provider).to receive(:action).with(action_name).and_return(callable) - instance.action(:up, :foo => :bar) + instance.action(:up, foo: :bar) expect(foo).to eq(:bar) end diff --git a/test/unit/vagrant/plugin/v1/command_test.rb b/test/unit/vagrant/plugin/v1/command_test.rb index 91fb61643..88647f16d 100644 --- a/test/unit/vagrant/plugin/v1/command_test.rb +++ b/test/unit/vagrant/plugin/v1/command_test.rb @@ -55,14 +55,14 @@ describe Vagrant::Plugin::V1::Command do let(:environment) do env = double("environment") - env.stub(:root_path => "foo") + env.stub(root_path: "foo") env end let(:instance) { klass.new([], environment) } it "should raise an exception if a root_path is not available" do - environment.stub(:root_path => nil) + environment.stub(root_path: nil) expect { instance.with_target_vms }. to raise_error(Vagrant::Errors::NoEnvironmentError) @@ -75,9 +75,9 @@ describe Vagrant::Plugin::V1::Command do bar_vm = double("bar") allow(bar_vm).to receive(:name).and_return("bar") - environment.stub(:multivm? => true, - :vms => { "foo" => foo_vm, "bar" => bar_vm }, - :vms_ordered => [foo_vm, bar_vm]) + environment.stub(multivm?: true, + vms: { "foo" => foo_vm, "bar" => bar_vm }, + vms_ordered: [foo_vm, bar_vm]) vms = [] instance.with_target_vms do |vm| @@ -88,7 +88,7 @@ describe Vagrant::Plugin::V1::Command do end it "raises an exception if the named VM doesn't exist" do - environment.stub(:multivm? => true, :vms => {}) + environment.stub(multivm?: true, vms: {}) expect { instance.with_target_vms("foo") }. to raise_error(Vagrant::Errors::VMNotFoundError) @@ -98,8 +98,8 @@ describe Vagrant::Plugin::V1::Command do foo_vm = double("foo") allow(foo_vm).to receive(:name).and_return(:foo) - environment.stub(:multivm? => true, - :vms => { :foo => foo_vm, :bar => nil }) + environment.stub(multivm?: true, + vms: { foo: foo_vm, bar: nil }) vms = [] instance.with_target_vms("foo") { |vm| vms << vm } diff --git a/test/unit/vagrant/plugin/v2/command_test.rb b/test/unit/vagrant/plugin/v2/command_test.rb index c55de305f..a111e9d5f 100644 --- a/test/unit/vagrant/plugin/v2/command_test.rb +++ b/test/unit/vagrant/plugin/v2/command_test.rb @@ -67,7 +67,7 @@ describe Vagrant::Plugin::V2::Command do subject { instance } it "should raise an exception if a root_path is not available" do - environment.stub(:root_path => nil) + environment.stub(root_path: nil) expect { instance.with_target_vms }. to raise_error(Vagrant::Errors::NoEnvironmentError) @@ -75,14 +75,14 @@ describe Vagrant::Plugin::V2::Command do it "should yield every VM in order is no name is given" do foo_vm = double("foo") - foo_vm.stub(:name => "foo", :provider => :foobarbaz) + foo_vm.stub(name: "foo", provider: :foobarbaz) foo_vm.stub(ui: Vagrant::UI::Silent.new) bar_vm = double("bar") - bar_vm.stub(:name => "bar", :provider => :foobarbaz) + bar_vm.stub(name: "bar", provider: :foobarbaz) bar_vm.stub(ui: Vagrant::UI::Silent.new) - environment.stub(:machine_names => [:foo, :bar]) + environment.stub(machine_names: [:foo, :bar]) allow(environment).to receive(:machine).with(:foo, environment.default_provider).and_return(foo_vm) allow(environment).to receive(:machine).with(:bar, environment.default_provider).and_return(bar_vm) @@ -95,7 +95,7 @@ describe Vagrant::Plugin::V2::Command do end it "raises an exception if the named VM doesn't exist" do - environment.stub(:machine_names => [:default]) + environment.stub(machine_names: [:default]) allow(environment).to receive(:machine).with(:foo, anything).and_return(nil) expect { instance.with_target_vms("foo") }. @@ -104,7 +104,7 @@ describe Vagrant::Plugin::V2::Command do it "yields the given VM if a name is given" do foo_vm = double("foo") - foo_vm.stub(:name => "foo", :provider => :foobarbaz) + foo_vm.stub(name: "foo", provider: :foobarbaz) foo_vm.stub(ui: Vagrant::UI::Silent.new) allow(environment).to receive(:machine).with(:foo, environment.default_provider).and_return(foo_vm) @@ -118,20 +118,20 @@ describe Vagrant::Plugin::V2::Command do foo_vm = double("foo") provider = :foobarbaz - foo_vm.stub(:name => "foo", :provider => provider) + foo_vm.stub(name: "foo", provider: provider) foo_vm.stub(ui: Vagrant::UI::Silent.new) allow(environment).to receive(:machine).with(:foo, provider).and_return(foo_vm) vms = [] - instance.with_target_vms("foo", :provider => provider) { |vm| vms << vm } + instance.with_target_vms("foo", provider: provider) { |vm| vms << vm } expect(vms).to eq([foo_vm]) end it "should raise an exception if an active machine exists with a different provider" do name = :foo - environment.stub(:active_machines => [[name, :vmware]]) - expect { instance.with_target_vms(name.to_s, :provider => :foo) }. + environment.stub(active_machines: [[name, :vmware]]) + expect { instance.with_target_vms(name.to_s, provider: :foo) }. to raise_error Vagrant::Errors::ActiveMachineWithDifferentProvider end @@ -140,9 +140,9 @@ describe Vagrant::Plugin::V2::Command do provider = :vmware vmware_vm = double("vmware_vm") - environment.stub(:active_machines => [[name, provider]]) + environment.stub(active_machines: [[name, provider]]) allow(environment).to receive(:machine).with(name, provider).and_return(vmware_vm) - vmware_vm.stub(:name => name, :provider => provider) + vmware_vm.stub(name: name, provider: provider) vmware_vm.stub(ui: Vagrant::UI::Silent.new) vms = [] @@ -155,12 +155,12 @@ describe Vagrant::Plugin::V2::Command do provider = :vmware vmware_vm = double("vmware_vm") - environment.stub(:active_machines => [[name, provider]]) + environment.stub(active_machines: [[name, provider]]) allow(environment).to receive(:machine).with(name, provider).and_return(vmware_vm) - vmware_vm.stub(:name => name, :provider => provider, ui: Vagrant::UI::Silent.new) + vmware_vm.stub(name: name, provider: provider, ui: Vagrant::UI::Silent.new) vms = [] - instance.with_target_vms(name.to_s, :provider => provider) { |vm| vms << vm } + instance.with_target_vms(name.to_s, provider: provider) { |vm| vms << vm } expect(vms).to eq([vmware_vm]) end @@ -169,7 +169,7 @@ describe Vagrant::Plugin::V2::Command do machine = double("machine") allow(environment).to receive(:machine).with(name, environment.default_provider).and_return(machine) - machine.stub(:name => name, :provider => environment.default_provider) + machine.stub(name: name, provider: environment.default_provider) machine.stub(ui: Vagrant::UI::Silent.new) results = [] @@ -182,15 +182,15 @@ describe Vagrant::Plugin::V2::Command do provider = :vmware vmware_vm = double("vmware_vm") - environment.stub(:active_machines => [[name, provider]]) + environment.stub(active_machines: [[name, provider]]) allow(environment).to receive(:machine).with(name, provider).and_return(vmware_vm) - environment.stub(:machine_names => []) - environment.stub(:primary_machine_name => name) - vmware_vm.stub(:name => name, :provider => provider) + environment.stub(machine_names: []) + environment.stub(primary_machine_name: name) + vmware_vm.stub(name: name, provider: provider) vmware_vm.stub(ui: Vagrant::UI::Silent.new) vms = [] - instance.with_target_vms(nil, :single_target => true) { |vm| vms << vm } + instance.with_target_vms(nil, single_target: true) { |vm| vms << vm } expect(vms).to eq([vmware_vm]) end @@ -198,15 +198,15 @@ describe Vagrant::Plugin::V2::Command do name = :foo machine = double("machine") - environment.stub(:active_machines => []) + environment.stub(active_machines: []) allow(environment).to receive(:machine).with(name, environment.default_provider).and_return(machine) - environment.stub(:machine_names => []) - environment.stub(:primary_machine_name => name) - machine.stub(:name => name, :provider => environment.default_provider) + environment.stub(machine_names: []) + environment.stub(primary_machine_name: name) + machine.stub(name: name, provider: environment.default_provider) machine.stub(ui: Vagrant::UI::Silent.new) vms = [] - instance.with_target_vms(nil, :single_target => true) { |vm| vms << machine } + instance.with_target_vms(nil, single_target: true) { |vm| vms << machine } expect(vms).to eq([machine]) end diff --git a/test/unit/vagrant/util/downloader_test.rb b/test/unit/vagrant/util/downloader_test.rb index ad0f95ab3..960e27462 100644 --- a/test/unit/vagrant/util/downloader_test.rb +++ b/test/unit/vagrant/util/downloader_test.rb @@ -9,8 +9,8 @@ describe Vagrant::Util::Downloader do let(:subprocess_result) do double("subprocess_result").tap do |result| - result.stub(:exit_code => exit_code) - result.stub(:stderr => "") + result.stub(exit_code: exit_code) + result.stub(stderr: "") end end diff --git a/test/unit/vagrant/util/retryable_test.rb b/test/unit/vagrant/util/retryable_test.rb index ba7a86460..9482806e7 100644 --- a/test/unit/vagrant/util/retryable_test.rb +++ b/test/unit/vagrant/util/retryable_test.rb @@ -34,7 +34,7 @@ describe Vagrant::Util::Retryable do end # It should re-raise the error - expect { klass.retryable(:tries => 5, &block) }. + expect { klass.retryable(tries: 5, &block) }. to raise_error(RuntimeError) # It should've tried all specified times @@ -50,7 +50,7 @@ describe Vagrant::Util::Retryable do end # It should re-raise the error - expect { klass.retryable(:tries => 5, :on => RuntimeError, &block) }. + expect { klass.retryable(tries: 5, on: RuntimeError, &block) }. to raise_error(StandardError) # It should've never tried since it was a different kind of error @@ -71,7 +71,7 @@ describe Vagrant::Util::Retryable do end # It should re-raise the error - expect { klass.retryable(:tries => 5, :on => [foo_error, bar_error], &block) }. + expect { klass.retryable(tries: 5, on: [foo_error, bar_error], &block) }. to raise_error(RuntimeError) # It should've never tried since it was a different kind of error @@ -87,7 +87,7 @@ describe Vagrant::Util::Retryable do expect(klass).not_to receive(:sleep) # Run it. - expect { klass.retryable(:tries => 5, &block) }. + expect { klass.retryable(tries: 5, &block) }. to raise_error(RuntimeError) end @@ -100,7 +100,7 @@ describe Vagrant::Util::Retryable do expect(klass).to receive(:sleep).with(10).exactly(4).times # Run it. - expect { klass.retryable(:tries => 5, :sleep => 10, &block) }. + expect { klass.retryable(tries: 5, sleep: 10, &block) }. to raise_error(RuntimeError) end end diff --git a/test/unit/vagrant/util/scoped_hash_override_test.rb b/test/unit/vagrant/util/scoped_hash_override_test.rb index 0bc6ced11..3a828d791 100644 --- a/test/unit/vagrant/util/scoped_hash_override_test.rb +++ b/test/unit/vagrant/util/scoped_hash_override_test.rb @@ -11,8 +11,8 @@ describe Vagrant::Util::ScopedHashOverride do it "should not mess with non-overrides" do original = { - :key => "value", - :another_value => "foo" + key: "value", + another_value: "foo" } expect(klass.scoped_hash_override(original, "foo")).to eq(original) @@ -20,13 +20,13 @@ describe Vagrant::Util::ScopedHashOverride do it "should override if the scope matches" do original = { - :key => "value", - :scope__key => "replaced" + key: "value", + scope__key: "replaced" } expected = { - :key => "replaced", - :scope__key => "replaced" + key: "replaced", + scope__key: "replaced" } expect(klass.scoped_hash_override(original, "scope")).to eq(expected) @@ -34,15 +34,15 @@ describe Vagrant::Util::ScopedHashOverride do it "should ignore non-matching scopes" do original = { - :key => "value", - :scope__key => "replaced", - :another__key => "value" + key: "value", + scope__key: "replaced", + another__key: "value" } expected = { - :key => "replaced", - :scope__key => "replaced", - :another__key => "value" + key: "replaced", + scope__key: "replaced", + another__key: "value" } expect(klass.scoped_hash_override(original, "scope")).to eq(expected) diff --git a/test/unit/vagrant_test.rb b/test/unit/vagrant_test.rb index adc42175e..03bb1126e 100644 --- a/test/unit/vagrant_test.rb +++ b/test/unit/vagrant_test.rb @@ -69,7 +69,7 @@ describe Vagrant do it "finds plugins by gem name" do specs = [Gem::Specification.new] specs[0].name = "foo" - Vagrant::Plugin::Manager.instance.stub(:installed_specs => specs) + Vagrant::Plugin::Manager.instance.stub(installed_specs: specs) expect(described_class.has_plugin?("foo")).to be_true expect(described_class.has_plugin?("bar")).to be_false diff --git a/website/docs/config.rb b/website/docs/config.rb index 6f2366254..acb470d48 100644 --- a/website/docs/config.rb +++ b/website/docs/config.rb @@ -18,10 +18,10 @@ # Per-page layout changes: # # With no layout -# page "/path/to/file.html", :layout => false +# page "/path/to/file.html", layout: false # # With alternative layout -# page "/path/to/file.html", :layout => :otherlayout +# page "/path/to/file.html", layout: :otherlayout # # A path which all have the same layout # with_layout :admin do @@ -29,7 +29,7 @@ # end # Proxy (fake) files -# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do +# page "/this-page-has-no-template.html", proxy: "/template-file.html" do # @which_fake_page = "Rendering a fake page with a variable" # end @@ -53,7 +53,7 @@ set :images_dir, 'images' # Use the RedCarpet Markdown engine set :markdown_engine, :redcarpet -set :markdown, :fenced_code_blocks => true +set :markdown, fenced_code_blocks: true # Build-specific configuration configure :build do diff --git a/website/docs/config.ru b/website/docs/config.ru index e06e177d5..b81df1c72 100644 --- a/website/docs/config.ru +++ b/website/docs/config.ru @@ -21,10 +21,10 @@ use HashiCorp::Rack::RedirectV1Docs # we hash the contents of the assets to determine filenames, this is safe # to do. use Rack::StaticCache, - :root => "build", - :urls => ["/images", "/javascripts", "/stylesheets"], - :duration => 2, - :versioning => false + root: "build", + urls: ["/images", "/javascripts", "/stylesheets"], + duration: 2, + versioning: false # For anything that matches below this point, we set the surrogate key # for Fastly so that we can quickly purge all the pages without touching @@ -36,9 +36,9 @@ end # Try to find a static file that matches our request, since Middleman # statically generates everything. use Rack::TryStatic, - :root => "build", - :urls => ["/"], - :try => [".html", "index.html", "/index.html"] + root: "build", + urls: ["/"], + try: [".html", "index.html", "/index.html"] # 404 if we reached this point. Sad times. run Rack::NotFound.new(File.expand_path("../build/404.html", __FILE__)) diff --git a/website/docs/source/v2/getting-started/networking.html.md b/website/docs/source/v2/getting-started/networking.html.md index 8e74cbb9a..150b4cab1 100644 --- a/website/docs/source/v2/getting-started/networking.html.md +++ b/website/docs/source/v2/getting-started/networking.html.md @@ -25,7 +25,7 @@ is a simple edit to the Vagrantfile, which now looks like this: ```ruby Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise32" - config.vm.provision :shell, :path => "bootstrap.sh" + config.vm.provision :shell, path: "bootstrap.sh" config.vm.network :forwarded_port, host: 4567, guest: 80 end ``` diff --git a/website/docs/source/v2/getting-started/provisioning.html.md b/website/docs/source/v2/getting-started/provisioning.html.md index 9da289cc1..18e44772f 100644 --- a/website/docs/source/v2/getting-started/provisioning.html.md +++ b/website/docs/source/v2/getting-started/provisioning.html.md @@ -37,7 +37,7 @@ look like this: ```ruby Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise32" - config.vm.provision :shell, :path => "bootstrap.sh" + config.vm.provision :shell, path: "bootstrap.sh" end ``` diff --git a/website/docs/source/v2/multi-machine/index.html.md b/website/docs/source/v2/multi-machine/index.html.md index 5944b9f82..799df3397 100644 --- a/website/docs/source/v2/multi-machine/index.html.md +++ b/website/docs/source/v2/multi-machine/index.html.md @@ -69,11 +69,11 @@ below: ```ruby Vagrant.configure("2") do |config| - config.vm.provision :shell, :inline => 'echo A' + config.vm.provision :shell, inline: 'echo A' config.vm.define :testing do |test| - test.vm.provision :shell, :inline => 'echo B' + test.vm.provision :shell, inline: 'echo B' end - config.vm.provision :shell, :inline => 'echo C' + config.vm.provision :shell, inline: 'echo C' end ``` diff --git a/website/docs/source/v2/networking/public_network.html.md b/website/docs/source/v2/networking/public_network.html.md index 2c7c141ef..ac098bb2d 100644 --- a/website/docs/source/v2/networking/public_network.html.md +++ b/website/docs/source/v2/networking/public_network.html.md @@ -45,7 +45,7 @@ ask you to choose which interface the virtual machine should bridge to. A defaul interface can be specified by adding a `:bridge` clause to the network definition. ```ruby -config.vm.network "public_network", :bridge => 'en1: Wi-Fi (AirPort)' +config.vm.network "public_network", bridge: 'en1: Wi-Fi (AirPort)' ``` The string identifying the desired interface must exactly match the name of an diff --git a/website/docs/source/v2/plugins/commands.html.md b/website/docs/source/v2/plugins/commands.html.md index 26b723d80..dbf64b5f8 100644 --- a/website/docs/source/v2/plugins/commands.html.md +++ b/website/docs/source/v2/plugins/commands.html.md @@ -115,7 +115,7 @@ An example of using the helper, again pulled directly from the built-in `destroy` command: ```ruby -with_target_vms(argv, :reverse => true) do |machine| +with_target_vms(argv, reverse: true) do |machine| machine.action(:destroy) end ``` diff --git a/website/docs/source/v2/plugins/development-basics.html.md b/website/docs/source/v2/plugins/development-basics.html.md index bb48939ac..071050d02 100644 --- a/website/docs/source/v2/plugins/development-basics.html.md +++ b/website/docs/source/v2/plugins/development-basics.html.md @@ -41,7 +41,7 @@ Vagrant plugin development: source "https://rubygems.org" group :development do - gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git" + gem "vagrant", git: "https://github.com/mitchellh/vagrant.git" end group :plugins do diff --git a/website/docs/source/v2/plugins/packaging.html.md b/website/docs/source/v2/plugins/packaging.html.md index 04dda1da2..89a6e972f 100644 --- a/website/docs/source/v2/plugins/packaging.html.md +++ b/website/docs/source/v2/plugins/packaging.html.md @@ -59,7 +59,7 @@ Vagrant plugin development: source "https://rubygems.org" group :development do - gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git" + gem "vagrant", git: "https://github.com/mitchellh/vagrant.git" end group :plugins do diff --git a/website/www/config.rb b/website/www/config.rb index 0139e8234..495ffad17 100644 --- a/website/www/config.rb +++ b/website/www/config.rb @@ -16,8 +16,8 @@ set :images_dir, 'images' # Use the RedCarpet Markdown engine set :markdown_engine, :redcarpet set :markdown, - :fenced_code_blocks => true, - :with_toc_data => true + fenced_code_blocks: true, + with_toc_data: true # Enable the blog and set the time zone so that post times appear # correctly. diff --git a/website/www/config.ru b/website/www/config.ru index 0674aee27..f36ee894e 100644 --- a/website/www/config.ru +++ b/website/www/config.ru @@ -16,10 +16,10 @@ use HashiCorp::Rack::LegacyRedirect # we hash the contents of the assets to determine filenames, this is safe # to do. use Rack::StaticCache, - :root => "build", - :urls => ["/images", "/javascripts", "/stylesheets"], - :duration => 2, - :versioning => false + root: "build", + urls: ["/images", "/javascripts", "/stylesheets"], + duration: 2, + versioning: false # For anything that matches below this point, we set the surrogate key # for Fastly so that we can quickly purge all the pages without touching @@ -31,9 +31,9 @@ end # Try to find a static file that matches our request, since Middleman # statically generates everything. use Rack::TryStatic, - :root => "build", - :urls => ["/"], - :try => [".html", "index.html", "/index.html"] + root: "build", + urls: ["/"], + try: [".html", "index.html", "/index.html"] # 404 if we reached this point. Sad times. run Rack::NotFound.new(File.expand_path("../build/404.html", __FILE__))