diff --git a/lib/vagrant/config/v1/base.rb b/lib/vagrant/config/v1/base.rb index 6b69dabe8..228e4223f 100644 --- a/lib/vagrant/config/v1/base.rb +++ b/lib/vagrant/config/v1/base.rb @@ -5,11 +5,6 @@ module Vagrant # from this class but this class provides useful helpers that config # classes may wish to use. class Base - # This is a useful default to use for attributes, and the built-in - # merge for this class will use this as a marker that a value is - # unset (versus just being explicitly set to `nil`) - UNSET_VALUE = Object.new - # Merge another configuration object into this one. This assumes that # the other object is the same class as this one. # diff --git a/plugins/kernel/config/nfs.rb b/plugins/kernel/config/nfs.rb index b347e55ae..8c570390f 100644 --- a/plugins/kernel/config/nfs.rb +++ b/plugins/kernel/config/nfs.rb @@ -5,11 +5,6 @@ module VagrantPlugins class NFSConfig < Vagrant::Config::V1::Base attr_accessor :map_uid attr_accessor :map_gid - - def initialize - @map_uid = UNSET_VALUE - @map_gid = UNSET_VALUE - end end end end diff --git a/plugins/kernel/config/package.rb b/plugins/kernel/config/package.rb index a9b47f7d6..4713c2a8a 100644 --- a/plugins/kernel/config/package.rb +++ b/plugins/kernel/config/package.rb @@ -4,10 +4,6 @@ module VagrantPlugins module Kernel class PackageConfig < Vagrant::Config::V1::Base attr_accessor :name - - def initialize - @name = UNSET_VALUE - end end end end diff --git a/plugins/kernel/config/ssh.rb b/plugins/kernel/config/ssh.rb index be6c3aec6..3f50fb2bb 100644 --- a/plugins/kernel/config/ssh.rb +++ b/plugins/kernel/config/ssh.rb @@ -15,29 +15,13 @@ module VagrantPlugins attr_accessor :forward_x11 attr_accessor :shell - def initialize - @username = UNSET_VALUE - @password = UNSET_VALUE - @host = UNSET_VALUE - @port = UNSET_VALUE - @guest_port = UNSET_VALUE - @max_tries = UNSET_VALUE - @timeout = UNSET_VALUE - @private_key_path = UNSET_VALUE - @forward_agent = UNSET_VALUE - @forward_x11 = UNSET_VALUE - @shell = UNSET_VALUE - end - def validate(env, errors) [:username, :host, :max_tries, :timeout].each do |field| value = instance_variable_get("@#{field}".to_sym) - if value == UNSET_VALUE || !value - errors.add(I18n.t("vagrant.config.common.error_empty", :field => field)) - end + errors.add(I18n.t("vagrant.config.common.error_empty", :field => field)) if !value end - if private_key_path && private_key_path != UNSET_VALUE && !File.file?(File.expand_path(private_key_path, env.root_path)) + if private_key_path && !File.file?(File.expand_path(private_key_path, env.root_path)) errors.add(I18n.t("vagrant.config.ssh.private_key_missing", :path => private_key_path)) end end diff --git a/plugins/kernel/config/vagrant.rb b/plugins/kernel/config/vagrant.rb index 57a96120d..10dac641f 100644 --- a/plugins/kernel/config/vagrant.rb +++ b/plugins/kernel/config/vagrant.rb @@ -5,11 +5,6 @@ module VagrantPlugins class VagrantConfig < Vagrant::Config::V1::Base attr_accessor :dotfile_name attr_accessor :host - - def initialize - @dotfile_name = UNSET_VALUE - @host = UNSET_VALUE - end end end end