[PATCH/foreman 1/2] Fix the scopes so they behave as expected

Signed-off-by: Tim Speetjens <tim.speetjens@gmail.com>

··· --- app/models/host.rb | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/app/models/host.rb b/app/models/host.rb
index f3a040e…dab5307 100644
— a/app/models/host.rb
+++ b/app/models/host.rb
@@ -44,8 +44,8 @@ class Host < Puppet::Rails::Host
}

named_scope :with_error, { :conditions => "(puppet_status > 0) and

  • ((puppet_status >> #{BIT_NUM*METRIC.index(“failed”)} & #{MAX}) != 0) or
  • ((puppet_status >> #{BIT_NUM*METRIC.index(“failed_restarts”)} &
    #{MAX}) != 0)"
  • ( ((puppet_status >> #{BIT_NUM*METRIC.index(“failed”)} & #{MAX}) != 0) or
  • ((puppet_status >> #{BIT_NUM*METRIC.index(“failed_restarts”)} &
    #{MAX}) != 0) )"
    }

named_scope :without_error, { :conditions =>
@@ -54,12 +54,12 @@ class Host < Puppet::Rails::Host
}

named_scope :with_changes, { :conditions => "(puppet_status > 0) and

  • ((puppet_status >> #{BIT_NUM*METRIC.index(“applied”)} & #{MAX}) != 0) or
  • ((puppet_status >> #{BIT_NUM*METRIC.index(“restarted”)} & #{MAX}) != 0)"
  • ( ((puppet_status >> #{BIT_NUM*METRIC.index(“applied”)} & #{MAX}) != 0) or
  • ((puppet_status >> #{BIT_NUM*METRIC.index(“restarted”)} & #{MAX}) != 0) )"
    }

named_scope :without_changes, { :conditions =>

  • "((puppet_status >> #{BIT_NUM*METRIC.index(“applied”)} & #{MAX}) = 0) or
  • “((puppet_status >> #{BIT_NUMMETRIC.index(“applied”)} & #{MAX}) = 0) and
    ((puppet_status >> #{BIT_NUM
    METRIC.index(“restarted”)} & #{MAX}) = 0)”
    }


1.7.2.5