Use .key? instead of .has_key?
This commit is contained in:
parent
cee834ddf3
commit
d2874064f4
|
@ -369,7 +369,7 @@ module Vagrant
|
|||
#
|
||||
# @return [Hash]
|
||||
def downloader(url, env, **opts)
|
||||
opts[:ui] = true if !opts.has_key?(:ui)
|
||||
opts[:ui] = true if !opts.key?(:ui)
|
||||
|
||||
temp_path = env[:tmp_path].join("box" + Digest::SHA1.hexdigest(url))
|
||||
@logger.info("Downloading box: #{url} => #{temp_path}")
|
||||
|
@ -409,7 +409,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def download(url, env, **opts)
|
||||
opts[:ui] = true if !opts.has_key?(:ui)
|
||||
opts[:ui] = true if !opts.key?(:ui)
|
||||
|
||||
d = downloader(url, env, **opts)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def call(env)
|
||||
if !env.has_key?(:config_validate) || env[:config_validate]
|
||||
if !env.key?(:config_validate) || env[:config_validate]
|
||||
errors = env[:machine].config.validate(env[:machine])
|
||||
|
||||
if errors && !errors.empty?
|
||||
|
|
|
@ -24,7 +24,7 @@ module Vagrant
|
|||
|
||||
def call(env)
|
||||
graceful = true
|
||||
graceful = !env[:force_halt] if env.has_key?(:force_halt)
|
||||
graceful = !env[:force_halt] if env.key?(:force_halt)
|
||||
|
||||
# By default, we didn't succeed.
|
||||
env[:result] = false
|
||||
|
|
|
@ -129,7 +129,7 @@ module Vagrant
|
|||
|
||||
# If we have folders with the "default" key, then determine the
|
||||
# most appropriate implementation for this.
|
||||
if folders.has_key?("") && !folders[""].empty?
|
||||
if folders.key?("") && !folders[""].empty?
|
||||
default_impl = default_synced_folder_type(machine, plugins)
|
||||
if !default_impl
|
||||
types = plugins.to_hash.keys.map { |t| t.to_s }.sort.join(", ")
|
||||
|
|
|
@ -24,13 +24,13 @@ module Vagrant
|
|||
|
||||
# Tracks whether we were configured to provision
|
||||
config_enabled = true
|
||||
config_enabled = env[:provision_enabled] if env.has_key?(:provision_enabled)
|
||||
config_enabled = env[:provision_enabled] if env.key?(:provision_enabled)
|
||||
|
||||
# Check if we already provisioned, and if so, disable the rest
|
||||
provision_enabled = true
|
||||
|
||||
ignore_sentinel = true
|
||||
if env.has_key?(:provision_ignore_sentinel)
|
||||
if env.key?(:provision_ignore_sentinel)
|
||||
ignore_sentinel = env[:provision_ignore_sentinel]
|
||||
end
|
||||
if ignore_sentinel
|
||||
|
@ -69,7 +69,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
# Store the value so that other actions can use it
|
||||
env[:provision_enabled] = provision_enabled if !env.has_key?(:provision_enabled)
|
||||
env[:provision_enabled] = provision_enabled if !env.key?(:provision_enabled)
|
||||
|
||||
# Ask the provisioners to modify the configuration if needed
|
||||
provisioner_instances(env).each do |p, _|
|
||||
|
|
|
@ -49,7 +49,7 @@ module Vagrant
|
|||
# Run the action chain in a busy block, marking the environment as
|
||||
# interrupted if a SIGINT occurs, and exiting cleanly once the
|
||||
# chain has been run.
|
||||
ui = environment[:ui] if environment.has_key?(:ui)
|
||||
ui = environment[:ui] if environment.key?(:ui)
|
||||
int_callback = lambda do
|
||||
if environment[:interrupted]
|
||||
ui.error I18n.t("vagrant.actions.runner.exit_immediately") if ui
|
||||
|
|
|
@ -165,7 +165,7 @@ module Vagrant
|
|||
@cap_logger.debug("Checking in: #{host_name}")
|
||||
caps = @cap_caps[host_name]
|
||||
|
||||
if caps && caps.has_key?(cap_name)
|
||||
if caps && caps.key?(cap_name)
|
||||
@cap_logger.debug("Found cap: #{cap_name} in #{host_name}")
|
||||
return caps[cap_name]
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ module Vagrant
|
|||
# Gather the procs for every source, since that is what we care about.
|
||||
procs = []
|
||||
sources.each do |source|
|
||||
if !@proc_cache.has_key?(source)
|
||||
if !@proc_cache.key?(source)
|
||||
# Load the procs for this source and cache them. This caching
|
||||
# avoids the issue where a file may have side effects when loading
|
||||
# and loading it multiple times causes unexpected behavior.
|
||||
|
@ -92,10 +92,10 @@ module Vagrant
|
|||
errors = []
|
||||
|
||||
order.each do |key|
|
||||
next if !@sources.has_key?(key)
|
||||
next if !@sources.key?(key)
|
||||
|
||||
@sources[key].each do |version, proc|
|
||||
if !@config_cache.has_key?(proc)
|
||||
if !@config_cache.key?(proc)
|
||||
@logger.debug("Loading from: #{key} (evaluating)")
|
||||
|
||||
# Get the proper version loader for this version and load
|
||||
|
|
|
@ -60,7 +60,7 @@ module Vagrant
|
|||
new_keys = new_state["keys"]
|
||||
keys = {}
|
||||
old_keys.each do |key, old_value|
|
||||
if new_keys.has_key?(key)
|
||||
if new_keys.key?(key)
|
||||
# We need to do a merge, which we expect to be available
|
||||
# on the config class itself.
|
||||
keys[key] = old_value.merge(new_keys[key])
|
||||
|
@ -72,7 +72,7 @@ module Vagrant
|
|||
|
||||
new_keys.each do |key, new_value|
|
||||
# Add in the keys that the new class has that we haven't merged.
|
||||
if !keys.has_key?(key)
|
||||
if !keys.key?(key)
|
||||
keys[key] = new_value.dup
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Vagrant
|
|||
# used for Vagrant and load the proper configuration classes for
|
||||
# each.
|
||||
def method_missing(name, *args)
|
||||
return @keys[name] if @keys.has_key?(name)
|
||||
return @keys[name] if @keys.key?(name)
|
||||
|
||||
config_klass = @config_map[name.to_sym]
|
||||
if config_klass
|
||||
|
|
|
@ -70,7 +70,7 @@ module Vagrant
|
|||
new_keys = new_state["keys"]
|
||||
keys = {}
|
||||
old_keys.each do |key, old_value|
|
||||
if new_keys.has_key?(key)
|
||||
if new_keys.key?(key)
|
||||
# We need to do a merge, which we expect to be available
|
||||
# on the config class itself.
|
||||
keys[key] = old_value.merge(new_keys[key])
|
||||
|
@ -82,7 +82,7 @@ module Vagrant
|
|||
|
||||
new_keys.each do |key, new_value|
|
||||
# Add in the keys that the new class has that we haven't merged.
|
||||
if !keys.has_key?(key)
|
||||
if !keys.key?(key)
|
||||
keys[key] = new_value.dup
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module Vagrant
|
|||
# used for Vagrant and load the proper configuration classes for
|
||||
# each.
|
||||
def method_missing(name, *args)
|
||||
return @keys[name] if @keys.has_key?(name)
|
||||
return @keys[name] if @keys.key?(name)
|
||||
|
||||
config_klass = @config_map[name.to_sym]
|
||||
if config_klass
|
||||
|
@ -41,7 +41,7 @@ module Vagrant
|
|||
# mutate itself.
|
||||
def finalize!
|
||||
@config_map.each do |key, klass|
|
||||
if !@keys.has_key?(key)
|
||||
if !@keys.key?(key)
|
||||
@keys[key] = klass.new
|
||||
end
|
||||
end
|
||||
|
@ -102,9 +102,9 @@ module Vagrant
|
|||
# This sets the internal state. This is used by the core to do some
|
||||
# merging logic and shouldn't be used by the general public.
|
||||
def __set_internal_state(state)
|
||||
@config_map = state["config_map"] if state.has_key?("config_map")
|
||||
@keys = state["keys"] if state.has_key?("keys")
|
||||
@missing_key_calls = state["missing_key_calls"] if state.has_key?("missing_key_calls")
|
||||
@config_map = state["config_map"] if state.key?("config_map")
|
||||
@keys = state["keys"] if state.key?("keys")
|
||||
@missing_key_calls = state["missing_key_calls"] if state.key?("missing_key_calls")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,7 +80,7 @@ module Vagrant
|
|||
}.merge(opts || {})
|
||||
|
||||
# Set the default working directory to look for the vagrantfile
|
||||
opts[:cwd] ||= ENV["VAGRANT_CWD"] if ENV.has_key?("VAGRANT_CWD")
|
||||
opts[:cwd] ||= ENV["VAGRANT_CWD"] if ENV.key?("VAGRANT_CWD")
|
||||
opts[:cwd] ||= Dir.pwd
|
||||
opts[:cwd] = Pathname.new(opts[:cwd])
|
||||
if !opts[:cwd].directory?
|
||||
|
@ -94,7 +94,7 @@ module Vagrant
|
|||
# Set the Vagrantfile name up. We append "Vagrantfile" and "vagrantfile" so that
|
||||
# those continue to work as well, but anything custom will take precedence.
|
||||
opts[:vagrantfile_name] ||= ENV["VAGRANT_VAGRANTFILE"] if \
|
||||
ENV.has_key?("VAGRANT_VAGRANTFILE")
|
||||
ENV.key?("VAGRANT_VAGRANTFILE")
|
||||
opts[:vagrantfile_name] = [opts[:vagrantfile_name]] if \
|
||||
opts[:vagrantfile_name] && !opts[:vagrantfile_name].is_a?(Array)
|
||||
|
||||
|
@ -307,7 +307,7 @@ module Vagrant
|
|||
# @return [Symbol] Name of the default provider.
|
||||
def default_provider(**opts)
|
||||
opts[:exclude] = Set.new(opts[:exclude]) if opts[:exclude]
|
||||
opts[:force_default] = true if !opts.has_key?(:force_default)
|
||||
opts[:force_default] = true if !opts.key?(:force_default)
|
||||
|
||||
default = ENV["VAGRANT_DEFAULT_PROVIDER"]
|
||||
default = nil if default == ""
|
||||
|
@ -351,15 +351,15 @@ module Vagrant
|
|||
|
||||
# Skip providers that can't be defaulted, unless they're in our
|
||||
# config, in which case someone made our decision for us.
|
||||
if !config.has_key?(key)
|
||||
next if popts.has_key?(:defaultable) && !popts[:defaultable]
|
||||
if !config.key?(key)
|
||||
next if popts.key?(:defaultable) && !popts[:defaultable]
|
||||
end
|
||||
|
||||
# The priority is higher if it is in our config. Otherwise, it is
|
||||
# the priority it set PLUS the length of the config to make sure it
|
||||
# is never higher than the configuration keys.
|
||||
priority = popts[:priority]
|
||||
priority = config[key] + max_priority if config.has_key?(key)
|
||||
priority = config[key] + max_priority if config.key?(key)
|
||||
|
||||
ordered << [priority, key, impl, popts]
|
||||
end
|
||||
|
@ -596,7 +596,7 @@ module Vagrant
|
|||
@machines.delete(cache_key)
|
||||
end
|
||||
|
||||
if @machines.has_key?(cache_key)
|
||||
if @machines.key?(cache_key)
|
||||
@logger.info("Returning cached machine: #{name} (#{provider})")
|
||||
return @machines[cache_key]
|
||||
end
|
||||
|
|
|
@ -157,7 +157,7 @@ module Vagrant
|
|||
|
||||
# Determine whether we lock or not
|
||||
lock = true
|
||||
lock = opts.delete(:lock) if opts.has_key?(:lock)
|
||||
lock = opts.delete(:lock) if opts.key?(:lock)
|
||||
|
||||
# Extra env keys are the remaining opts
|
||||
extra_env = opts.dup
|
||||
|
|
|
@ -143,7 +143,7 @@ module Vagrant
|
|||
|
||||
# If we already have a newer version in our list of installed,
|
||||
# then ignore it
|
||||
next if installed_map.has_key?(spec.name) &&
|
||||
next if installed_map.key?(spec.name) &&
|
||||
installed_map[spec.name].version >= spec.version
|
||||
|
||||
installed_map[spec.name] = spec
|
||||
|
|
|
@ -61,7 +61,7 @@ module Vagrant
|
|||
#
|
||||
# @return [Boolean]
|
||||
def has_plugin?(name)
|
||||
@data["installed"].has_key?(name)
|
||||
@data["installed"].key?(name)
|
||||
end
|
||||
|
||||
# Remove a plugin that is installed from the state file.
|
||||
|
|
|
@ -88,7 +88,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
# By default, the command is primary
|
||||
opts[:primary] = true if !opts.has_key?(:primary)
|
||||
opts[:primary] = true if !opts.key?(:primary)
|
||||
|
||||
# Register the command
|
||||
components.commands.register(name.to_sym) do
|
||||
|
|
|
@ -22,8 +22,8 @@ module Vagrant
|
|||
# This will evaluate the block given to `register` and return the
|
||||
# resulting value.
|
||||
def get(key)
|
||||
return nil if !@items.has_key?(key)
|
||||
return @results_cache[key] if @results_cache.has_key?(key)
|
||||
return nil if !@items.key?(key)
|
||||
return @results_cache[key] if @results_cache.key?(key)
|
||||
@results_cache[key] = @items[key].call
|
||||
end
|
||||
alias :[] :get
|
||||
|
@ -31,9 +31,10 @@ module Vagrant
|
|||
# Checks if the given key is registered with the registry.
|
||||
#
|
||||
# @return [Boolean]
|
||||
def has_key?(key)
|
||||
@items.has_key?(key)
|
||||
def key?(key)
|
||||
@items.key?(key)
|
||||
end
|
||||
alias_method :has_key?, :key?
|
||||
|
||||
# Returns an array populated with the keys of this object.
|
||||
#
|
||||
|
|
|
@ -136,9 +136,9 @@ module Vagrant
|
|||
|
||||
# Setup the options so that the new line is suppressed
|
||||
opts ||= {}
|
||||
opts[:echo] = true if !opts.has_key?(:echo)
|
||||
opts[:new_line] = false if !opts.has_key?(:new_line)
|
||||
opts[:prefix] = false if !opts.has_key?(:prefix)
|
||||
opts[:echo] = true if !opts.key?(:echo)
|
||||
opts[:new_line] = false if !opts.key?(:new_line)
|
||||
opts[:prefix] = false if !opts.key?(:prefix)
|
||||
|
||||
# Output the data
|
||||
say(:info, message, opts)
|
||||
|
@ -249,7 +249,7 @@ module Vagrant
|
|||
class_eval <<-CODE
|
||||
def #{method}(message, *args, **opts)
|
||||
super(message)
|
||||
if !@ui.opts.has_key?(:bold) && !opts.has_key?(:bold)
|
||||
if !@ui.opts.key?(:bold) && !opts.key?(:bold)
|
||||
opts[:bold] = #{method.inspect} != :detail && \
|
||||
#{method.inspect} != :ask
|
||||
end
|
||||
|
@ -284,7 +284,7 @@ module Vagrant
|
|||
opts = self.opts.merge(opts)
|
||||
|
||||
prefix = ""
|
||||
if !opts.has_key?(:prefix) || opts[:prefix]
|
||||
if !opts.key?(:prefix) || opts[:prefix]
|
||||
prefix = OUTPUT_PREFIX
|
||||
prefix = " " * OUTPUT_PREFIX.length if \
|
||||
type == :detail || type == :ask || opts[:prefix_spaces]
|
||||
|
@ -294,7 +294,7 @@ module Vagrant
|
|||
return message if prefix.empty?
|
||||
|
||||
target = @prefix
|
||||
target = opts[:target] if opts.has_key?(:target)
|
||||
target = opts[:target] if opts.key?(:target)
|
||||
|
||||
# Get the lines. The first default is because if the message
|
||||
# is an empty string, then we want to still use the empty string.
|
||||
|
|
|
@ -148,7 +148,7 @@ module Vagrant
|
|||
# output.
|
||||
def terminal_supports_colors?
|
||||
if windows?
|
||||
return true if ENV.has_key?("ANSICON")
|
||||
return true if ENV.key?("ANSICON")
|
||||
return true if cygwin?
|
||||
return true if ENV["TERM"] == "cygwin"
|
||||
return false
|
||||
|
|
|
@ -32,7 +32,7 @@ module VagrantPlugins
|
|||
:destroy, force_confirm_destroy: options[:force])
|
||||
|
||||
total += 1
|
||||
declined += 1 if action_env.has_key?(:force_confirm_destroy_result) &&
|
||||
declined += 1 if action_env.key?(:force_confirm_destroy_result) &&
|
||||
action_env[:force_confirm_destroy_result] == false
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ module VagrantPlugins
|
|||
|
||||
def call(env)
|
||||
installed = Vagrant::Plugin::Manager.instance.installed_plugins
|
||||
if !installed.has_key?(env[:plugin_name])
|
||||
if !installed.key?(env[:plugin_name])
|
||||
raise Vagrant::Errors::PluginNotInstalled,
|
||||
name: env[:plugin_name]
|
||||
end
|
||||
|
|
|
@ -60,8 +60,8 @@ module VagrantPlugins
|
|||
if names.empty?
|
||||
autostart = false
|
||||
@env.vagrantfile.machine_names_and_options.each do |n, o|
|
||||
autostart = true if o.has_key?(:autostart)
|
||||
o[:autostart] = true if !o.has_key?(:autostart)
|
||||
autostart = true if o.key?(:autostart)
|
||||
o[:autostart] = true if !o.key?(:autostart)
|
||||
names << n.to_s if o[:autostart]
|
||||
end
|
||||
|
||||
|
|
|
@ -320,7 +320,7 @@ module VagrantPlugins
|
|||
raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
|
||||
|
||||
# Default some options
|
||||
opts[:retries] = 5 if !opts.has_key?(:retries)
|
||||
opts[:retries] = 5 if !opts.key?(:retries)
|
||||
|
||||
# Build the options we'll use to initiate the connection via Net::SSH
|
||||
common_connect_opts = {
|
||||
|
|
|
@ -17,7 +17,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def self.rsync_post(machine, opts)
|
||||
if opts.has_key?(:chown) && !opts[:chown]
|
||||
if opts.key?(:chown) && !opts[:chown]
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def self.rsync_post(machine, opts)
|
||||
if opts.has_key?(:chown) && !opts[:chown]
|
||||
if opts.key?(:chown) && !opts[:chown]
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def self.rsync_post(machine, opts)
|
||||
if opts.has_key?(:chown) && !opts[:chown]
|
||||
if opts.key?(:chown) && !opts[:chown]
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
other_defined_vms.each do |key, subvm|
|
||||
if !new_defined_vms.has_key?(key)
|
||||
if !new_defined_vms.key?(key)
|
||||
new_defined_vms[key] = subvm.clone
|
||||
else
|
||||
new_defined_vms[key].config_procs.concat(subvm.config_procs)
|
||||
|
@ -197,7 +197,7 @@ module VagrantPlugins
|
|||
options ||= {}
|
||||
options[:guestpath] = guestpath.to_s.gsub(/\/$/, '')
|
||||
options[:hostpath] = hostpath
|
||||
options[:disabled] = false if !options.has_key?(:disabled)
|
||||
options[:disabled] = false if !options.key?(:disabled)
|
||||
options = (@__synced_folders[options[:guestpath]] || {}).
|
||||
merge(options.dup)
|
||||
|
||||
|
@ -247,7 +247,7 @@ module VagrantPlugins
|
|||
id = "#{type}-#{id}"
|
||||
|
||||
# Merge in the previous settings if we have them.
|
||||
if @__networks.has_key?(id)
|
||||
if @__networks.key?(id)
|
||||
options = @__networks[id][1].merge(options)
|
||||
end
|
||||
|
||||
|
@ -279,13 +279,13 @@ module VagrantPlugins
|
|||
|
||||
def provision(name, **options, &block)
|
||||
type = name
|
||||
if options.has_key?(:type)
|
||||
if options.key?(:type)
|
||||
type = options.delete(:type)
|
||||
else
|
||||
name = nil
|
||||
end
|
||||
|
||||
if options.has_key?(:id)
|
||||
if options.key?(:id)
|
||||
puts "Setting `id` on a provisioner is deprecated. Please use the"
|
||||
puts "new syntax of `config.vm.provision \"name\", type: \"type\""
|
||||
puts "where \"name\" is the replacement for `id`. This will be"
|
||||
|
@ -306,8 +306,8 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
prov.preserve_order = !!options.delete(:preserve_order) if \
|
||||
options.has_key?(:preserve_order)
|
||||
prov.run = options.delete(:run) if options.has_key?(:run)
|
||||
options.key?(:preserve_order)
|
||||
prov.run = options.delete(:run) if options.key?(:run)
|
||||
prov.add_config(options, &block)
|
||||
nil
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module VagrantPlugins
|
|||
def call(env)
|
||||
return @app.call(env) if !env[:machine].provider.host_vm?
|
||||
|
||||
if !env.has_key?(:host_machine_sync_folders)
|
||||
if !env.key?(:host_machine_sync_folders)
|
||||
env[:host_machine_sync_folders] = true
|
||||
end
|
||||
|
||||
|
@ -115,7 +115,7 @@ module VagrantPlugins
|
|||
|
||||
# Add this synced folder onto the new config if we haven't
|
||||
# already shared it before.
|
||||
if !existing_ids.has_key?(id)
|
||||
if !existing_ids.key?(id)
|
||||
# A bit of a hack for VirtualBox to mount our
|
||||
# folder as transient. This can be removed once
|
||||
# the VirtualBox synced folder mechanism is smarter.
|
||||
|
|
|
@ -24,7 +24,7 @@ module VagrantPlugins
|
|||
}
|
||||
folders = synced_folders(env[:machine], **opts)
|
||||
|
||||
if folders.has_key?(:nfs)
|
||||
if folders.key?(:nfs)
|
||||
@logger.info("Using NFS, preparing NFS settings by reading host IP and machine IP")
|
||||
add_ips_to_env!(env)
|
||||
end
|
||||
|
|
|
@ -32,9 +32,9 @@ module VagrantPlugins
|
|||
# Verify the name is not taken
|
||||
vms = env[:machine].provider.driver.read_vms
|
||||
raise Vagrant::Errors::VMNameExists, name: name if \
|
||||
vms.has_key?(name) && vms[name] != env[:machine].id
|
||||
vms.key?(name) && vms[name] != env[:machine].id
|
||||
|
||||
if vms.has_key?(name)
|
||||
if vms.key?(name)
|
||||
@logger.info("Not setting the name because our name is already set.")
|
||||
else
|
||||
env[:ui].info(I18n.t(
|
||||
|
|
|
@ -30,8 +30,8 @@ module VagrantPlugins
|
|||
|
||||
# On Windows, we use the VBOX_INSTALL_PATH environmental
|
||||
# variable to find VBoxManage.
|
||||
if ENV.has_key?("VBOX_INSTALL_PATH") ||
|
||||
ENV.has_key?("VBOX_MSI_INSTALL_PATH")
|
||||
if ENV.key?("VBOX_INSTALL_PATH") ||
|
||||
ENV.key?("VBOX_MSI_INSTALL_PATH")
|
||||
# Get the path.
|
||||
path = ENV["VBOX_INSTALL_PATH"] || ENV["VBOX_MSI_INSTALL_PATH"]
|
||||
@logger.debug("VBOX_INSTALL_PATH value: #{path}")
|
||||
|
|
|
@ -445,7 +445,7 @@ module VagrantPlugins
|
|||
folder[:name],
|
||||
"--hostpath",
|
||||
folder[:hostpath]]
|
||||
args << "--transient" if folder.has_key?(:transient) && folder[:transient]
|
||||
args << "--transient" if folder.key?(:transient) && folder[:transient]
|
||||
execute("sharedfolder", "add", @uuid, *args)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -450,7 +450,7 @@ module VagrantPlugins
|
|||
folder[:name],
|
||||
"--hostpath",
|
||||
folder[:hostpath]]
|
||||
args << "--transient" if folder.has_key?(:transient) && folder[:transient]
|
||||
args << "--transient" if folder.key?(:transient) && folder[:transient]
|
||||
|
||||
# Enable symlinks on the shared folder
|
||||
execute("setextradata", @uuid, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{folder[:name]}", "1")
|
||||
|
|
|
@ -189,9 +189,9 @@ module VagrantPlugins
|
|||
# we use the block form of sub here to ensure that if the specified_name happens to end with a number (which is fairly likely) then
|
||||
# we won't end up having the character sequence of a \ followed by a number be interpreted as a back reference. For example, if
|
||||
# specified_name were "abc123", then "\\abc123\\".reverse would be "\\321cba\\", and the \3 would be treated as a back reference by the sub
|
||||
disk_params << path.reverse.sub("\\#{suggested_name}\\".reverse) { "\\#{specified_name}\\".reverse }.reverse # Replace only last occurrence
|
||||
disk_params << path.reverse.sub("\\#{suggested_name}\\".reverse) { "\\#{specified_name}\\".reverse }.reverse # Replace only last occurrence
|
||||
else
|
||||
disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurrence
|
||||
disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurrence
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -481,7 +481,7 @@ module VagrantPlugins
|
|||
folder[:name],
|
||||
"--hostpath",
|
||||
folder[:hostpath]]
|
||||
args << "--transient" if folder.has_key?(:transient) && folder[:transient]
|
||||
args << "--transient" if folder.key?(:transient) && folder[:transient]
|
||||
|
||||
# Enable symlinks on the shared folder
|
||||
execute("setextradata", @uuid, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{folder[:name]}", "1")
|
||||
|
|
|
@ -498,7 +498,7 @@ module VagrantPlugins
|
|||
folder[:name],
|
||||
"--hostpath",
|
||||
folder[:hostpath]]
|
||||
args << "--transient" if folder.has_key?(:transient) && folder[:transient]
|
||||
args << "--transient" if folder.key?(:transient) && folder[:transient]
|
||||
|
||||
# Enable symlinks on the shared folder
|
||||
execute("setextradata", @uuid, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{folder[:name]}", "1")
|
||||
|
|
|
@ -51,7 +51,7 @@ module VagrantPlugins
|
|||
|
||||
options ||= {}
|
||||
@auto_correct = false
|
||||
@auto_correct = options[:auto_correct] if options.has_key?(:auto_correct)
|
||||
@auto_correct = options[:auto_correct] if options.key?(:auto_correct)
|
||||
@adapter = (options[:adapter] || 1).to_i
|
||||
@guest_ip = options[:guest_ip] || nil
|
||||
@host_ip = options[:host_ip] || nil
|
||||
|
|
|
@ -70,8 +70,8 @@ module VagrantPlugins
|
|||
|
||||
@__containers.each do |name, params|
|
||||
params[:image] ||= name
|
||||
params[:auto_assign_name] = true if !params.has_key?(:auto_assign_name)
|
||||
params[:daemonize] = true if !params.has_key?(:daemonize)
|
||||
params[:auto_assign_name] = true if !params.key?(:auto_assign_name)
|
||||
params[:daemonize] = true if !params.key?(:daemonize)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -64,7 +64,7 @@ module VagrantPlugins
|
|||
export_folders = folders.dup
|
||||
export_folders.keys.each do |id|
|
||||
opts = export_folders[id]
|
||||
if opts.has_key?(:nfs_export) && !opts[:nfs_export]
|
||||
if opts.key?(:nfs_export) && !opts[:nfs_export]
|
||||
export_folders.delete(id)
|
||||
end
|
||||
end
|
||||
|
@ -117,7 +117,7 @@ module VagrantPlugins
|
|||
def prepare_folder(machine, opts)
|
||||
opts[:map_uid] = prepare_permission(machine, :uid, opts)
|
||||
opts[:map_gid] = prepare_permission(machine, :gid, opts)
|
||||
opts[:nfs_udp] = true if !opts.has_key?(:nfs_udp)
|
||||
opts[:nfs_udp] = true if !opts.key?(:nfs_udp)
|
||||
opts[:nfs_version] ||= 3
|
||||
|
||||
# We use a CRC32 to generate a 32-bit checksum so that the
|
||||
|
@ -128,11 +128,11 @@ module VagrantPlugins
|
|||
# Prepares the UID/GID settings for a single folder.
|
||||
def prepare_permission(machine, perm, opts)
|
||||
key = "map_#{perm}".to_sym
|
||||
return nil if opts.has_key?(key) && opts[key].nil?
|
||||
return nil if opts.key?(key) && opts[key].nil?
|
||||
|
||||
# The options on the hash get priority, then the default
|
||||
# values
|
||||
value = opts.has_key?(key) ? opts[key] : machine.config.nfs.send(key)
|
||||
value = opts.key?(key) ? opts[key] : machine.config.nfs.send(key)
|
||||
return value if value != :auto
|
||||
|
||||
# Get UID/GID from folder if we've made it this far
|
||||
|
|
|
@ -83,7 +83,7 @@ module VagrantPlugins
|
|||
folders.each do |id, folder_opts|
|
||||
# If we marked this folder to not auto sync, then
|
||||
# don't do it.
|
||||
next if folder_opts.has_key?(:auto) && !folder_opts[:auto]
|
||||
next if folder_opts.key?(:auto) && !folder_opts[:auto]
|
||||
|
||||
hostpath = folder_opts[:hostpath]
|
||||
hostpath = File.expand_path(hostpath, machine.env.root_path)
|
||||
|
|
|
@ -87,6 +87,6 @@ describe Vagrant::Action::Warden do
|
|||
expect { instance.call(data) }.to raise_error(SystemExit)
|
||||
|
||||
# The recover should not have been called
|
||||
expect(data.has_key?(:recover)).not_to be
|
||||
expect(data.key?(:recover)).not_to be
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Vagrant::Util::HashWithIndifferentAccess do
|
|||
it "allows indifferent key lookup" do
|
||||
instance["foo"] = "bar"
|
||||
expect(instance.key?(:foo)).to be
|
||||
expect(instance.has_key?(:foo)).to be
|
||||
expect(instance.key?(:foo)).to be
|
||||
expect(instance.include?(:foo)).to be
|
||||
expect(instance.member?(:foo)).to be
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue