Sha256: fedf54989331514e2f43257211ce1a3b650ac96256aa12d08d4c97f522686589

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

module Actions
  module Katello
    module CapsuleContent
      class UpdateContentCounts < Actions::EntryAction
        def plan(smart_proxy, options = {})
          input[:options] = options
          plan_self(:smart_proxy_id => smart_proxy.id, environment_id: options[:environment_id], content_view_id: options[:content_view_id], repository_id: options[:repository_id])
        end

        def humanized_name
          _("Update Content Counts")
        end

        def run
          smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
          env = find_env(input[:environment_id])
          content_view = find_content_view(input[:content_view_id])
          repository = find_repository(input[:repository_id])
          smart_proxy.update_content_counts!(environment: env,
                                             content_view: content_view,
                                             repository: repository)
        end

        def find_env(environment_id)
          ::Katello::KTEnvironment.find_by(id: environment_id) if environment_id
        end

        def find_content_view(content_view_id)
          ::Katello::ContentView.find_by(id: content_view_id) if content_view_id
        end

        def find_repository(repository_id)
          ::Katello::Repository.find_by(id: repository_id) if repository_id
        end

        def rescue_strategy
          Dynflow::Action::Rescue::Skip
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.15.0 app/lib/actions/katello/capsule_content/update_content_counts.rb
katello-4.15.0.rc2 app/lib/actions/katello/capsule_content/update_content_counts.rb
katello-4.15.0.rc1 app/lib/actions/katello/capsule_content/update_content_counts.rb