Module: Katello::Concerns::HostManagedExtensions
- Extended by:
- ActiveSupport::Concern
- Includes:
- ForemanTasks::Concerns::ActionSubject, KatelloUrlsHelper
- Defined in:
- app/models/katello/concerns/host_managed_extensions.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#host, #subscription_manager_configuration_url
Class Method Details
.available_locks ⇒ Object
42
43
44
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 42
def self.available_locks
[:update]
end
|
Instance Method Details
#content_and_puppet_match? ⇒ Boolean
76
77
78
79
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 76
def content_and_puppet_match?
content_facet && content_facet.content_view_id == environment.try(:content_view).try(:id) &&
content_facet.lifecycle_environment_id == self.environment.try(:lifecycle_environment).try(:id)
end
|
#content_and_puppet_matched? ⇒ Boolean
71
72
73
74
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 71
def content_and_puppet_matched?
content_facet && content_facet.content_view_id_was == environment.try(:content_view).try(:id) &&
content_facet.lifecycle_environment_id_was == self.environment.try(:lifecycle_environment).try(:id)
end
|
#correct_puppet_environment ⇒ Object
64
65
66
67
68
69
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 64
def correct_puppet_environment
if content_and_puppet_matched?
new_environment = content_facet.content_view.puppet_env(content_facet.lifecycle_environment).try(:puppet_environment)
self.environment = new_environment if new_environment
end
end
|
#errata_status ⇒ Object
107
108
109
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 107
def errata_status
@errata_status ||= get_status(::Katello::ErrataStatus).status
end
|
#errata_status_label(options = {}) ⇒ Object
111
112
113
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 111
def errata_status_label(options = {})
@errata_status_label ||= get_status(::Katello::ErrataStatus).to_label(options)
end
|
#import_package_profile(simple_packages) ⇒ Object
91
92
93
94
95
96
97
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 91
def import_package_profile(simple_packages)
self.installed_packages.where("nvra not in (?)", simple_packages.map(&:nvra)).destroy_all
existing_nvras = self.installed_packages.pluck(:nvra)
simple_packages.each do |simple_package|
self.installed_packages.create!(:name => simple_package.name, :nvra => simple_package.nvra) unless existing_nvras.include?(simple_package.nvra)
end
end
|
#info_with_katello ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 52
def info_with_katello
info = info_without_katello
info['parameters']['kt_env'] = self.lifecycle_environment.try(:label)
info['parameters']['kt_cv'] = self.content_view.try(:label)
info['parameters']['lifecycle_environment'] = self.lifecycle_environment.try(:label)
info['parameters']['content_view'] = self.content_view.try(:label)
if self.content_facet.present?
info['parameters']['kickstart_repository'] = self.content_facet.kickstart_repository.try(:label)
end
info
end
|
#rhsm_organization_label ⇒ Object
38
39
40
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 38
def rhsm_organization_label
self.organization.label
end
|
#set_hostgroup_defaults_with_katello_attributes ⇒ Object
81
82
83
84
85
86
87
88
89
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 81
def set_hostgroup_defaults_with_katello_attributes
if hostgroup.present?
if content_facet.present?
self.content_facet.kickstart_repository_id ||= hostgroup.inherited_kickstart_repository_id
end
assign_hostgroup_attributes(%w(content_source_id content_view_id lifecycle_environment_id))
end
set_hostgroup_defaults_without_katello_attributes
end
|
#smart_proxy_ids_with_katello ⇒ Object
46
47
48
49
50
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 46
def smart_proxy_ids_with_katello
ids = smart_proxy_ids_without_katello
ids << content_source_id
ids.uniq.compact
end
|
#subscription_status ⇒ Object
99
100
101
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 99
def subscription_status
@subscription_status ||= get_status(::Katello::SubscriptionStatus).status
end
|
#subscription_status_label(options = {}) ⇒ Object
103
104
105
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 103
def subscription_status_label(options = {})
@subscription_status_label ||= get_status(::Katello::SubscriptionStatus).to_label(options)
end
|
34
35
36
|
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 34
def validate_media_with_capsule?
(content_source_id.blank? || (content_facet && content_facet.kickstart_repository.blank?)) && validate_media_without_capsule?
end
|