lib/rundock/builder/target_group_builder.rb in rundock-0.5.4 vs lib/rundock/builder/target_group_builder.rb in rundock-0.5.7

- old
+ new

@@ -6,21 +6,19 @@ DEFAULT_TARGET_GROUP_FILE_PATH = './targetgroup.yml' def build(scenario_targets) targets = {} unless scenario_targets - if @options[:targetgroup] - if FileTest.exist?(@options[:targetgroup]) - targets.merge!(YAML.load_file(@options[:targetgroup]).deep_symbolize_keys) - Logger.info("merged target file #{@options[:targetgroup]}") - elsif FileTest.exist?(DEFAULT_TARGET_GROUP_FILE_PATH) - Logger.warn("targetgroup file is not found. use #{DEFAULT_TARGET_GROUP_FILE_PATH}") - targets.merge!(YAML.load_file(DEFAULT_TARGET_GROUP_FILE_PATH).deep_symbolize_keys) - else - Logger.warn("Targetgroup path is not available. (#{@options[:targetgroup]})") - end + return scenario_targets unless @options[:targetgroup] + + if FileTest.exist?(@options[:targetgroup]) + targets.merge!(YAML.load_file(@options[:targetgroup]).deep_symbolize_keys) + Logger.info("merged target file #{@options[:targetgroup]}") + elsif FileTest.exist?(DEFAULT_TARGET_GROUP_FILE_PATH) + Logger.warn("targetgroup file is not found. use #{DEFAULT_TARGET_GROUP_FILE_PATH}") + targets.merge!(YAML.load_file(DEFAULT_TARGET_GROUP_FILE_PATH).deep_symbolize_keys) else - return scenario_targets + Logger.warn("Targetgroup path is not available. (#{@options[:targetgroup]})") end targets end end