Add validation method and todo
This commit is contained in:
parent
b82b33d204
commit
e05437ddf2
|
@ -4,6 +4,9 @@ module VagrantPlugins
|
||||||
module Kernel_V2
|
module Kernel_V2
|
||||||
# Represents a single configured provisioner for a VM.
|
# Represents a single configured provisioner for a VM.
|
||||||
class VagrantConfigProvisioner
|
class VagrantConfigProvisioner
|
||||||
|
# Defaults
|
||||||
|
VALID_BEFORE_AFTER_TYPES = [:each, :all].freeze
|
||||||
|
|
||||||
# Unique name for this provisioner
|
# Unique name for this provisioner
|
||||||
#
|
#
|
||||||
# @return [String]
|
# @return [String]
|
||||||
|
@ -102,6 +105,25 @@ module VagrantPlugins
|
||||||
@config.finalize!
|
@config.finalize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: This isn't being called
|
||||||
|
#
|
||||||
|
# @return [Array] array of strings of error messages from config option validation
|
||||||
|
def validate(machine)
|
||||||
|
errors = _detected_errors
|
||||||
|
|
||||||
|
if @before
|
||||||
|
if @before.is_a?(Symbol) && !VALID_BEFORE_AFTER_TYPES.include?(@before)
|
||||||
|
errors << "Before symbol is not a valid symbol"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if @after
|
||||||
|
if @after.is_a?(Symbol) && !VALID_BEFORE_AFTER_TYPES.include?(@after)
|
||||||
|
errors << "After symbol is not a valid symbol"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Returns whether the provisioner used was invalid or not. A provisioner
|
# Returns whether the provisioner used was invalid or not. A provisioner
|
||||||
# is invalid if it can't be found.
|
# is invalid if it can't be found.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue