Sha256: 0188c75141d1b43449e8e525940b183e4e897b37833b2d0f7c175981e19f6ef5
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module DockerContainerWizardStates class Image < ApplicationRecord self.table_name_prefix = 'docker_container_wizard_states_' belongs_to :wizard_state, :class_name => 'DockerContainerWizardState', :foreign_key => :docker_container_wizard_state_id delegate :compute_resource_id, :to => :wizard_state delegate :compute_resource, :to => :wizard_state validates :tag, :presence => true validates :repository_name, :presence => true validate :image_exists def name "#{repository_name}:#{tag}" end def registry_api if registry_id DockerRegistry.find(registry_id).api else Service::RegistryApi.docker_hub end end def sources [compute_resource, registry_api] end def image_search_service ForemanDocker::ImageSearch.new(*sources) end def image_exists return true if image_search_service.available?(name) error_msg = _("Container image %{image_name} is not available.") % { image_name: "#{name}", } errors.add(:image, error_msg) end end end
Version data entries
3 entries across 3 versions & 1 rubygems