Sha256: a8a6afb0d9cf8352786252dbd359cfcebd2fc4499dbbb0bbff7877447ba8ef69

Contents?: true

Size: 900 Bytes

Versions: 20

Compression:

Stored size: 900 Bytes

Contents

require 'yaml'

module Rundock
  module Builder
    class TargetGroupBuilder < Base
      DEFAULT_TARGET_GROUP_FILE_PATH = './targetgroup.yml'

      def build(scenario_targets)
        targets = {} unless scenario_targets

        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
          Logger.warn("Targetgroup path is not available. (#{@options[:targetgroup]})")
        end

        targets
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rundock-1.2.1 lib/rundock/builder/target_group_builder.rb
rundock-1.2.0 lib/rundock/builder/target_group_builder.rb
rundock-1.1.7 lib/rundock/builder/target_group_builder.rb
rundock-1.1.6 lib/rundock/builder/target_group_builder.rb
rundock-1.1.5 lib/rundock/builder/target_group_builder.rb
rundock-1.1.4 lib/rundock/builder/target_group_builder.rb
rundock-1.1.3 lib/rundock/builder/target_group_builder.rb
rundock-1.1.2 lib/rundock/builder/target_group_builder.rb
rundock-1.1.1 lib/rundock/builder/target_group_builder.rb
rundock-1.1.0 lib/rundock/builder/target_group_builder.rb
rundock-1.0.8 lib/rundock/builder/target_group_builder.rb
rundock-1.0.7 lib/rundock/builder/target_group_builder.rb
rundock-1.0.6 lib/rundock/builder/target_group_builder.rb
rundock-1.0.5 lib/rundock/builder/target_group_builder.rb
rundock-1.0.4 lib/rundock/builder/target_group_builder.rb
rundock-1.0.2 lib/rundock/builder/target_group_builder.rb
rundock-1.0.1 lib/rundock/builder/target_group_builder.rb
rundock-1.0.0 lib/rundock/builder/target_group_builder.rb
rundock-0.5.8 lib/rundock/builder/target_group_builder.rb
rundock-0.5.7 lib/rundock/builder/target_group_builder.rb