Project

General

Profile

Actions

Bug #13217

closed

Discovery Rules order by name, not priority

Added by Steve Parker almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Urgent
Category:
Image
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Discovery rules are processed in order of :name, not :priority.

A simple fix is in line 9 of foreman_discovery-4.0.0/app/controllers/concerns/foreman/controller/discovered_extensions.rb:

-    DiscoveryRule.where(:enabled => true).reorder(:priority).each do |rule|
+    DiscoveryRule.where(:enabled => true).order(:priority).each do |rule|

I don't know for sure, but think it could be related to foreman_discovery-4.0.0/app/models/discovery_rule.rb, which sets: order("discover_rules.name") around line 29:

  # with proc support, default_scope can no longer be chained
  # include all default scoping here
  default_scope lambda {
                  with_taxonomy_scope do
                    order("discovery_rules.name")
                  end
                }


Related issues 1 (0 open1 closed)

Related to Discovery - Bug #12765: Inconsistent rule ordering in the UIClosedLukas Zapletal12/10/2015Actions
Actions

Also available in: Atom PDF