Get rid of the UNSET_VALUE stuff, save it for v2
This commit is contained in:
parent
b38fb5e974
commit
a62e859231
|
@ -5,11 +5,6 @@ module Vagrant
|
||||||
# from this class but this class provides useful helpers that config
|
# from this class but this class provides useful helpers that config
|
||||||
# classes may wish to use.
|
# classes may wish to use.
|
||||||
class Base
|
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
|
# Merge another configuration object into this one. This assumes that
|
||||||
# the other object is the same class as this one.
|
# the other object is the same class as this one.
|
||||||
#
|
#
|
||||||
|
|
|
@ -5,11 +5,6 @@ module VagrantPlugins
|
||||||
class NFSConfig < Vagrant::Config::V1::Base
|
class NFSConfig < Vagrant::Config::V1::Base
|
||||||
attr_accessor :map_uid
|
attr_accessor :map_uid
|
||||||
attr_accessor :map_gid
|
attr_accessor :map_gid
|
||||||
|
|
||||||
def initialize
|
|
||||||
@map_uid = UNSET_VALUE
|
|
||||||
@map_gid = UNSET_VALUE
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,10 +4,6 @@ module VagrantPlugins
|
||||||
module Kernel
|
module Kernel
|
||||||
class PackageConfig < Vagrant::Config::V1::Base
|
class PackageConfig < Vagrant::Config::V1::Base
|
||||||
attr_accessor :name
|
attr_accessor :name
|
||||||
|
|
||||||
def initialize
|
|
||||||
@name = UNSET_VALUE
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,29 +15,13 @@ module VagrantPlugins
|
||||||
attr_accessor :forward_x11
|
attr_accessor :forward_x11
|
||||||
attr_accessor :shell
|
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)
|
def validate(env, errors)
|
||||||
[:username, :host, :max_tries, :timeout].each do |field|
|
[:username, :host, :max_tries, :timeout].each do |field|
|
||||||
value = instance_variable_get("@#{field}".to_sym)
|
value = instance_variable_get("@#{field}".to_sym)
|
||||||
if value == UNSET_VALUE || !value
|
errors.add(I18n.t("vagrant.config.common.error_empty", :field => field)) if !value
|
||||||
errors.add(I18n.t("vagrant.config.common.error_empty", :field => field))
|
|
||||||
end
|
|
||||||
end
|
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))
|
errors.add(I18n.t("vagrant.config.ssh.private_key_missing", :path => private_key_path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,11 +5,6 @@ module VagrantPlugins
|
||||||
class VagrantConfig < Vagrant::Config::V1::Base
|
class VagrantConfig < Vagrant::Config::V1::Base
|
||||||
attr_accessor :dotfile_name
|
attr_accessor :dotfile_name
|
||||||
attr_accessor :host
|
attr_accessor :host
|
||||||
|
|
||||||
def initialize
|
|
||||||
@dotfile_name = UNSET_VALUE
|
|
||||||
@host = UNSET_VALUE
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue