Sha256: a8c1fc02435faa7ba6137e7238c9f05fe03543fb33fe34b3d859df0584d82ea2

Contents?: true

Size: 1.53 KB

Versions: 28

Compression:

Stored size: 1.53 KB

Contents

module Actions
  module Pulp3
    module Repository
      class Sync < Pulp3::AbstractAsyncTask
        include Helpers::Presenter

        def plan(repo, smart_proxy, options = {})
          plan_self(:repo_id => repo.id, :smart_proxy_id => smart_proxy.id, :options => options)
        end

        def invoke_external_task
          repo = ::Katello::Repository.find(input[:repo_id])
          output[:pulp_tasks] = repo.backend_service(::SmartProxy.unscoped.find(input[:smart_proxy_id])).sync
        end

        def external_task=(tasks)
          output[:create_version] = true
          super
        end

        def finalize
          check_error_details
        end

        def check_error_details
          output[:pulp_tasks].each do |pulp_task|
            error_details = pulp_task.try(:[], "error")
            if error_details && !error_details.nil?
              fail _("An error occurred during the sync \n%{error_message}") % {:error_message => error_details}
            end
          end
        end

        def run_progress
          presenter.progress
        end

        def run_progress_weight
          10
        end

        def presenter
          Presenters::ContentUnitPresenter.new(self)
        end

        def rescue_strategy_for_self
          # There are various reasons the syncing fails, not all of them are
          # fatal: when fail on syncing, we continue with the task ending up
          # in the warning state, but not locking further syncs
          Dynflow::Action::Rescue::Skip
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
katello-3.17.0.rc1 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc5.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc5 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc4.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.3.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.3 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc4 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc3.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.2 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc3 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc2.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc2 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.1.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc1.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.16.0.rc1 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.0.1 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.0 app/lib/actions/pulp3/repository/sync.rb
katello-3.15.0.rc2 app/lib/actions/pulp3/repository/sync.rb