Sha256: 26e884f043c20a16b98b8b8f91748e22bacc6c5de65280357d4bff7a4419fad5

Contents?: true

Size: 1.29 KB

Versions: 10

Compression:

Stored size: 1.29 KB

Contents

module Actions
  module Katello
    module Host
      class UploadPackageProfile < Actions::EntryAction
        middleware.use Actions::Middleware::KeepCurrentUser

        def plan(host, profile_string)
          action_subject host

          sequence do
            plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
            plan_action(GenerateApplicability, [host])
          end
        end

        def humanized_name
          if input.try(:[], :hostname)
            _("Package Profile Update for %s") % input[:hostname]
          else
            _('Package Profile Update')
          end
        end

        def resource_locks
          :link
        end

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

        def run
          host = ::Host.find(input[:host_id])
          profile = JSON.parse(input[:profile_string])
          #free the huge string from the memory
          input[:profile_string] = 'TRIMMED'.freeze

          ::Katello::Pulp::Consumer.new(host.content_facet.uuid).upload_package_profile(profile) if host.content_facet.uuid
          simple_packages = profile.map { |item| ::Katello::Pulp::SimplePackage.new(item) }
          host.import_package_profile(simple_packages)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-3.5.2 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.6.0.rc1 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.5.1.1 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.5.1 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.5.0.1 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.5.0 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.5.0.rc2 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.5.0.rc1 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.4.5 app/lib/actions/katello/host/upload_package_profile.rb
katello-3.4.4 app/lib/actions/katello/host/upload_package_profile.rb