Sha256: a80dae6c3c0bd49e6c32ff67194fb93b44a497f8fb07e4066b3e5304f884b9c9

Contents?: true

Size: 1.5 KB

Versions: 12

Compression:

Stored size: 1.5 KB

Contents

module Actions
  module Katello
    module Host
      class Update < Actions::EntryAction
        middleware.use ::Actions::Middleware::RemoteAction

        def plan(host, consumer_params = nil)
          action_subject host
          plan_self(:hostname => host.name)

          sequence do
            host.content_facet.save! if host.content_facet

            if host.subscription_facet
              if consumer_params
                host.subscription_facet.update_from_consumer_attributes(consumer_params)
              else
                consumer_params = host.subscription_facet.consumer_attributes
              end
              ::Katello::Host::SubscriptionFacet.update_facts(::Host.find(host.id), consumer_params[:facts]) unless consumer_params[:facts].blank?
              host.subscription_facet.save!
              plan_action(::Actions::Candlepin::Consumer::Update, host.subscription_facet.uuid, consumer_params)
            end

            if host.subscription_facet.try(:autoheal)
              plan_action(::Actions::Candlepin::Consumer::AutoAttachSubscriptions, :uuid => host.subscription_facet.uuid)
            end
          end
        end

        def resource_locks
          :update
        end

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
katello-3.3.0.1 app/lib/actions/katello/host/update.rb
katello-3.3.0 app/lib/actions/katello/host/update.rb
katello-3.3.0.rc2 app/lib/actions/katello/host/update.rb
katello-3.3.0.rc1.1 app/lib/actions/katello/host/update.rb
katello-3.3.0.rc1 app/lib/actions/katello/host/update.rb
katello-3.2.1.1 app/lib/actions/katello/host/update.rb
katello-3.2.1 app/lib/actions/katello/host/update.rb
katello-3.2.0 app/lib/actions/katello/host/update.rb
katello-3.2.0.rc3 app/lib/actions/katello/host/update.rb
katello-3.2.0.rc2 app/lib/actions/katello/host/update.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/host/update.rb
katello-3.2.0.rc1 app/lib/actions/katello/host/update.rb