Class: Actions::Katello::Host::Update

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/katello/host/update.rb

Instance Method Summary collapse

Instance Method Details

#humanized_nameObject



45
46
47
48
49
50
51
# File 'app/lib/actions/katello/host/update.rb', line 45

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

#plan(host, consumer_params = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/lib/actions/katello/host/update.rb', line 7

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, 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.content_facet && host.content_host
      host.content_host.content_view = host.content_facet.try(:content_view)
      host.content_host.environment = host.content_facet.try(:lifecycle_environment)
      host.content_host.save!
    end

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

#rescue_strategyObject



41
42
43
# File 'app/lib/actions/katello/host/update.rb', line 41

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

#resource_locksObject



37
38
39
# File 'app/lib/actions/katello/host/update.rb', line 37

def resource_locks
  :update
end