Module: Katello::Concerns::SettingExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/katello/concerns/setting_extensions.rb
Instance Method Summary collapse
- #add_organizations_and_locations_if_global_http_proxy ⇒ Object
- #recalculate_errata_status ⇒ Object
- #update_global_proxies ⇒ Object
Instance Method Details
#add_organizations_and_locations_if_global_http_proxy ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/katello/concerns/setting_extensions.rb', line 34 def add_organizations_and_locations_if_global_http_proxy if name == 'content_default_http_proxy' && (::HttpProxy.table_exists? rescue(false)) proxy = HttpProxy.where(name: value).first if proxy proxy.update_attribute(:organizations, Organization.unscoped.all) proxy.update_attribute(:locations, Location.unscoped.all) end end end |
#recalculate_errata_status ⇒ Object
17 18 19 |
# File 'app/models/katello/concerns/setting_extensions.rb', line 17 def recalculate_errata_status ForemanTasks.async_task(Actions::Katello::Host::RecalculateErrataStatus) if saved_change_to_attribute?(:value) && name == 'errata_status_installable' end |
#update_global_proxies ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/katello/concerns/setting_extensions.rb', line 21 def update_global_proxies if saved_change_to_attribute?(:value) && name == 'content_default_http_proxy' repos = ::Katello::Repository.joins(:root).merge(Katello::RootRepository.with_global_proxy).where.not(remote_href: nil).where(library_instance_id: nil) unless repos.empty? ForemanTasks.async_task( ::Actions::BulkAction, ::Actions::Katello::Repository::UpdateHttpProxyDetails, repos.sort_by(&:pulp_id)) end end end |