Update trigger classes with comments
This commit is contained in:
parent
e7274f1b6c
commit
a5d8cc1caa
|
@ -1,5 +1,4 @@
|
|||
require "vagrant"
|
||||
|
||||
require File.expand_path("../vm_trigger", __FILE__)
|
||||
|
||||
module VagrantPlugins
|
||||
|
@ -48,6 +47,7 @@ module VagrantPlugins
|
|||
# and the rest are commands for the trigger
|
||||
blk = command.pop
|
||||
else
|
||||
# TODO:
|
||||
# No config block given at all, validation step should throw error?
|
||||
end
|
||||
|
||||
|
@ -71,6 +71,7 @@ module VagrantPlugins
|
|||
# and the rest are commands for the trigger
|
||||
blk = command.pop
|
||||
else
|
||||
# TODO:
|
||||
# No config block given at all, validation step should throw error?
|
||||
end
|
||||
|
||||
|
@ -148,9 +149,8 @@ module VagrantPlugins
|
|||
end
|
||||
end
|
||||
|
||||
# Iterates over all defined triggers and finalizes their config objects
|
||||
def finalize!
|
||||
# read through configured settings blocks and set their values
|
||||
# and then set up action hooks here?
|
||||
if !@_before_triggers.empty?
|
||||
@_before_triggers.map { |t| t.finalize! }
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
require 'log4r'
|
||||
|
||||
require Vagrant.source_root.join('plugins/provisioners/shell/config')
|
||||
|
||||
module VagrantPlugins
|
||||
module Kernel_V2
|
||||
# Represents a single configured provisioner for a VM.
|
||||
class VagrantConfigTrigger < Vagrant.plugin("2", :config)
|
||||
# Defaults
|
||||
DEFAULT_ON_ERROR = :halt
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
@ -68,7 +68,6 @@ module VagrantPlugins
|
|||
|
||||
def initialize(command)
|
||||
@logger = Log4r::Logger.new("vagrant::config::vm::trigger::config")
|
||||
#@logger.debug("Trigger defined: #{name}")
|
||||
|
||||
@name = UNSET_VALUE
|
||||
@info = UNSET_VALUE
|
||||
|
@ -82,10 +81,13 @@ module VagrantPlugins
|
|||
# Internal options
|
||||
@id = SecureRandom.uuid
|
||||
@command = command.to_sym
|
||||
|
||||
@logger.debug("Trigger defined for command: #{command}")
|
||||
end
|
||||
|
||||
def finalize!
|
||||
# Ensure all config options are set to nil if untouched by user
|
||||
# Ensure all config options are set to nil or default value if untouched
|
||||
# by user
|
||||
@name = nil if @name == UNSET_VALUE
|
||||
@info = nil if @info == UNSET_VALUE
|
||||
@warn = nil if @warn == UNSET_VALUE
|
||||
|
|
Loading…
Reference in New Issue