Sha256: ec07e700e057dd7516a3df58e93d5e8d6d19f4ddd5f21676a5edd8498ad96207

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

module Katello
  module Concerns
    module DockerContainerWizardStateImageExtensions
      extend ActiveSupport::Concern

      included do
        alias_method_chain :image_exists, :katello

        serialize :katello_content, Hash
        validate :katello_content_completed, :if => :katello?
      end

      def image_exists_with_katello
        return true if katello?
        image_exists_without_katello
      end

      def katello_content_completed
        empty_values = katello_content.map do |key, value|
          key if value.blank?
        end
        empty_values.compact!

        return true if empty_values.empty?

        message_mapping = {
          organization_id: _("Organization not set"),
          environment_id: _("Lifecycle Environment not set"),
          content_view_id: _("Content View not set"),
          repository_id: _("Repository not set"),
          tag_id: _("Tag not set")
        }
        empty_values.each do |key|
          errors.add(:katello_content, message_mapping[key])
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
katello-3.5.2 app/models/katello/concerns/docker_container_wizard_state_image_extensions.rb
katello-3.5.1.1 app/models/katello/concerns/docker_container_wizard_state_image_extensions.rb
katello-3.5.1 app/models/katello/concerns/docker_container_wizard_state_image_extensions.rb
katello-3.5.0.1 app/models/katello/concerns/docker_container_wizard_state_image_extensions.rb
katello-3.5.0 app/models/katello/concerns/docker_container_wizard_state_image_extensions.rb