Class: Actions::Katello::Host::UpdateReleaseVersion

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

Instance Method Summary collapse

Instance Method Details

#humanized_nameObject



19
20
21
22
23
24
25
# File 'app/lib/actions/katello/host/update_release_version.rb', line 19

def humanized_name
  if input.try(:[], :hostname).nil?
    _("Update release version for host")
  else
    _("Update release version for host %s") % input[:hostname]
  end
end

#plan(host, release_version) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/lib/actions/katello/host/update_release_version.rb', line 5

def plan(host, release_version)
  plan_self(:hostname => host.name)
  if host.content_facet && host.subscription_facet
    if release_version.present? && !host.content_facet.available_releases.include?(release_version)
      fail _("Host %{name} cannot be assigned release version %{release_version}.") % { :name => host.name, :release_version => release_version }
    else
      host.subscription_facet.release_version = release_version
    end
    host.update_candlepin_associations
  else
    fail _("Host %s has not been registered with subscription-manager.") % host.name
  end
end