Sha256: 40bf28b9ee61acf1a6fe1e3fb024aa13935c40c64474d519320136c89db9e08b

Contents?: true

Size: 844 Bytes

Versions: 158

Compression:

Stored size: 844 Bytes

Contents

# various user-configurable mappings defined in /etc/katello/mapping.yml

require 'yaml'

module Katello
  module Mapping
    def self.configuration
      return @config if @config
      mapping_file = '/etc/katello/mapping.yml'
      if File.readable?(mapping_file)
        @config = YAML.load_file(mapping_file)
      else
        @config = {}
      end
    end

    class ImageFactoryNaming
      def self.translate(name = '', version = '')
        matched_name = "#{name} #{version}"
        naming = Mapping.configuration['imagefactory_naming'] || {}
        naming.each do |key, values|
          regexp_str = "^#{Regexp.escape(key).gsub('\*', '.*')}$"
          if Regexp.new(regexp_str) =~ matched_name
            return values.map(&:to_s)
          end
        end
        return [name.to_s, version.to_s]
      end
    end
  end
end

Version data entries

158 entries across 158 versions & 1 rubygems

Version Path
katello-3.14.0 app/lib/katello/mapping.rb
katello-3.13.3 app/lib/katello/mapping.rb
katello-3.14.0.rc2 app/lib/katello/mapping.rb
katello-3.13.2 app/lib/katello/mapping.rb
katello-3.14.0.rc1 app/lib/katello/mapping.rb
katello-3.13.1 app/lib/katello/mapping.rb
katello-3.13.0 app/lib/katello/mapping.rb
katello-3.13.0.rc2.1 app/lib/katello/mapping.rb
katello-3.13.0.rc2 app/lib/katello/mapping.rb
katello-3.12.3 app/lib/katello/mapping.rb
katello-3.12.2 app/lib/katello/mapping.rb
katello-3.13.0.rc1 app/lib/katello/mapping.rb
katello-3.12.1 app/lib/katello/mapping.rb
katello-3.11.2 app/lib/katello/mapping.rb
katello-3.10.2 app/lib/katello/mapping.rb
katello-3.12.0 app/lib/katello/mapping.rb
katello-3.12.0.rc2 app/lib/katello/mapping.rb
katello-3.10.1.1 app/lib/katello/mapping.rb
katello-3.12.0.rc1 app/lib/katello/mapping.rb
katello-3.10.1 app/lib/katello/mapping.rb