Sha256: 3974ece88d3832658f0a3363fba14667ac3169af9f853902e9d1c2aa17b2c05e

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

#
# Copyright 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

module Katello
  class ContentViewHistory < Katello::Model
    include Glue::ElasticSearch::ContentViewHistory if Katello.config.use_elasticsearch

    belongs_to :environment, :class_name => "Katello::KTEnvironment", :inverse_of => :content_view_histories,
                             :foreign_key => :katello_environment_id
    belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion", :foreign_key => :katello_content_view_version_id, :inverse_of => :history
    belongs_to :task, :class_name => "ForemanTasks::Task::DynflowTask", :foreign_key => :task_id

    IN_PROGRESS = 'in progress'
    FAILED = 'failed'
    SUCCESSFUL = 'successful'
    STATUSES = [IN_PROGRESS, FAILED, SUCCESSFUL]

    validates_lengths_from_database
    validates :status, :inclusion => {:in          => STATUSES,
                                      :allow_blank => false}

    scope :active, where(:status => IN_PROGRESS)
    alias_method :version, :content_view_version

    def content_view
      self.content_view_version.try(:content_view)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katello-2.2.2 app/models/katello/content_view_history.rb