Code updates based on PR feedback

This commit is contained in:
Brian Cain 2018-04-24 10:04:40 -07:00
parent 1eabd0901e
commit a9be56b356
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
2 changed files with 10 additions and 10 deletions

View File

@ -17,9 +17,9 @@ module Vagrant
# This class is responsible for setting up basic triggers that were
# defined inside a Vagrantfile.
#
# @param [Object] env Vagrant environment
# @param [Object] config Trigger configuration
# @param [Object] machine Active Machine
# @param [Vagrant::Environment] env Vagrant environment
# @param [Kernel_V2::TriggerConfig] config Trigger configuration
# @param [Vagrant::Machine] machine Active Machine
def initialize(env, config, machine)
@env = env
@config = config
@ -91,7 +91,7 @@ module Vagrant
index = triggers.index(trigger) unless match == true
end
if !index.nil?
if index
@logger.debug("Trigger #{trigger.id} will be ignored for #{guest_name}")
triggers.delete_at(index)
end
@ -109,7 +109,7 @@ module Vagrant
triggers.each do |trigger|
@logger.debug("Running trigger #{trigger.id}...")
if !trigger.name.nil?
if trigger.name
@machine.ui.info(I18n.t("vagrant.trigger.fire_with_name",
name: trigger.name))
else

View File

@ -101,12 +101,12 @@ module VagrantPlugins
# but can be set as a single String or Symbol
#
# Guests are stored internally as strings
if !@only_on.nil?
if @only_on
@only_on = Array(@only_on)
end
# Commands must be stored internally as symbols
if !@ignore.nil?
if @ignore
@ignore = Array(@ignore)
@ignore.map! { |i| i.to_sym }
end
@ -172,15 +172,15 @@ module VagrantPlugins
errors.concat errorz["shell provisioner"] if !errorz.empty?
end
if !@name.nil? && !@name.is_a?(String)
if @name && !@name.is_a?(String)
errors << I18n.t("vagrant.config.triggers.name_bad_type", cmd: @command)
end
if !@info.nil? && !@info.is_a?(String)
if @info && !@info.is_a?(String)
errors << I18n.t("vagrant.config.triggers.info_bad_type", cmd: @command)
end
if !@warn.nil? && !@warn.is_a?(String)
if @warn && !@warn.is_a?(String)
errors << I18n.t("vagrant.config.triggers.warn_bad_type", cmd: @command)
end