Last active
October 12, 2016 20:32
-
-
Save tchellomello/c5d98dd2d8582d3987a968e0a98037c0 to your computer and use it in GitHub Desktop.
Hotfix bz#1374038
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/content_facet_host_extensions.rb.orig 2016-10-10 16:46:52.578790963 -0400 | |
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/content_facet_host_extensions.rb 2016-10-10 16:48:10.677468395 -0400 | |
@@ -23,11 +23,11 @@ | |
has_many :applicable_errata, :through => :content_facet | |
scoped_search :in => :content_view, :on => :name, :complete_value => true, :rename => :content_view | |
- scoped_search :in => :content_facet, :on => :content_view_id, :rename => :content_view_id | |
+ scoped_search :in => :content_facet, :on => :content_view_id, :rename => :content_view_id, :only_explicit => true | |
scoped_search :in => :lifecycle_environment, :on => :name, :complete_value => true, :rename => :lifecycle_environment | |
- scoped_search :in => :content_facet, :on => :lifecycle_environment_id, :rename => :lifecycle_environment_id | |
- scoped_search :in => :applicable_errata, :on => :errata_id, :rename => :applicable_errata, :complete_value => true, :ext_method => :find_by_applicable_errata | |
- scoped_search :in => :applicable_errata, :on => :errata_id, :rename => :installable_errata, :complete_value => true, :ext_method => :find_by_installable_errata | |
+ scoped_search :in => :content_facet, :on => :lifecycle_environment_id, :rename => :lifecycle_environment_id, :only_explicit => true | |
+ scoped_search :in => :applicable_errata, :on => :errata_id, :rename => :applicable_errata, :complete_value => true, :ext_method => :find_by_applicable_errata, :only_explicit => true | |
+ scoped_search :in => :applicable_errata, :on => :errata_id, :rename => :installable_errata, :complete_value => true, :ext_method => :find_by_installable_errata, :only_explicit => true | |
accepts_nested_attributes_for :content_facet, :reject_if => proc { |attributes| attributes['content_view_id'].blank? && attributes['lifecycle_environment_id'].blank? } | |
attr_accessible :content_facet_attributes | |
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/host_managed_extensions.rb.orig 2016-09-21 15:49:40.000000000 -0400 | |
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/host_managed_extensions.rb 2016-10-10 16:49:07.049679174 -0400 | |
@@ -23,11 +23,11 @@ | |
before_save :correct_puppet_environment | |
scoped_search :in => :content_source, :on => :name, :complete_value => true, :rename => :content_source | |
- scoped_search :in => :host_collections, :on => :id, :complete_value => false, :rename => :host_collection_id | |
+ scoped_search :in => :host_collections, :on => :id, :complete_value => false, :rename => :host_collection_id, :only_explicit => true | |
scoped_search :in => :host_collections, :on => :name, :complete_value => true, :rename => :host_collection | |
- scoped_search :in => :installed_packages, :on => :nvra, :complete_value => true, :rename => :installed_package | |
- scoped_search :in => :installed_packages, :on => :name, :complete_value => true, :rename => :installed_package_name | |
- | |
+ scoped_search :in => :installed_packages, :on => :nvra, :complete_value => true, :rename => :installed_package, :only_explicit => true | |
+ scoped_search :in => :installed_packages, :on => :name, :complete_value => true, :rename => :installed_package_name, :only_explicit => true | |
+ | |
attr_accessible :content_source_id, :host_collection_ids | |
end | |
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/subscription_facet_host_extensions.rb.orig 2016-10-10 16:49:14.689843277 -0400 | |
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/concerns/subscription_facet_host_extensions.rb 2016-10-10 16:49:43.129454117 -0400 | |
@@ -23,8 +23,8 @@ | |
scoped_search :on => :release_version, :in => :subscription_facet, :complete_value => true | |
scoped_search :on => :autoheal, :in => :subscription_facet, :complete_value => true | |
scoped_search :on => :service_level, :in => :subscription_facet, :complete_value => true | |
- scoped_search :on => :last_checkin, :in => :subscription_facet, :complete_value => true | |
- scoped_search :on => :registered_at, :in => :subscription_facet, :rename => :registered_at | |
+ scoped_search :on => :last_checkin, :in => :subscription_facet, :complete_value => true, :only_explicit => true | |
+ scoped_search :on => :registered_at, :in => :subscription_facet, :rename => :registered_at, :only_explicit => true | |
scoped_search :on => :uuid, :in => :subscription_facet, :rename => :subscription_uuid | |
end | |
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/views/dashboard/_errata_widget.html.erb.orig 2016-10-10 16:50:02.482869796 -0400 | |
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/views/dashboard/_errata_widget.html.erb 2016-10-10 16:50:20.584258582 -0400 | |
@@ -4,7 +4,7 @@ | |
<% organizations = Organization.current.present? ? [Organization.current] : User.current.allowed_organizations %> | |
<% hosts = ::Host::Managed.authorized("view_hosts") %> | |
-<% errata = Katello::Erratum.applicable_to_hosts(hosts).order('updated desc').limit(6) %> | |
+<% errata = Katello::Erratum.applicable_to_hosts_dashboard(hosts) %> | |
<% if errata.empty? %> | |
<p class="ca"><%= _("There are no errata that need to be applied to registered content hosts.") %></p> | |
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/erratum.rb.orig 2016-10-10 16:50:44.738777380 -0400 | |
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.80/app/models/katello/erratum.rb 2016-10-10 16:51:46.864111722 -0400 | |
@@ -50,6 +50,13 @@ | |
where("#{Katello::Host::ContentFacet.table_name}.host_id" => hosts).uniq | |
end | |
+ def self.applicable_to_hosts_dashboard(hosts) | |
+ self.joins(:content_facets). | |
+ where("#{Katello::Host::ContentFacet.table_name}.host_id" => hosts). | |
+ select("DISTINCT ON (#{self.table_name}.updated, #{self.table_name}.id) #{self.table_name}.*"). | |
+ order("#{self.table_name}.updated desc").limit(6) | |
+ end | |
+ | |
def <=>(other) | |
return self.errata_id <=> other.errata_id | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment