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-4.0.3 app/lib/katello/mapping.rb
katello-3.18.5 app/lib/katello/mapping.rb
katello-4.0.2.1 app/lib/katello/mapping.rb
katello-4.0.2 app/lib/katello/mapping.rb
katello-3.18.4 app/lib/katello/mapping.rb
katello-4.0.1.2 app/lib/katello/mapping.rb
katello-3.18.3.1 app/lib/katello/mapping.rb
katello-4.0.1.1 app/lib/katello/mapping.rb
katello-3.18.3 app/lib/katello/mapping.rb
katello-4.0.1 app/lib/katello/mapping.rb
katello-4.0.0 app/lib/katello/mapping.rb
katello-4.0.0.rc3.1 app/lib/katello/mapping.rb
katello-4.0.0.rc3 app/lib/katello/mapping.rb
katello-3.18.2.1 app/lib/katello/mapping.rb
katello-3.18.2 app/lib/katello/mapping.rb
katello-3.17.3 app/lib/katello/mapping.rb
katello-4.0.0.rc2 app/lib/katello/mapping.rb
katello-3.18.1.1 app/lib/katello/mapping.rb
katello-3.17.2 app/lib/katello/mapping.rb
katello-4.0.0.rc1 app/lib/katello/mapping.rb