[PATCH/foreman 2/7] fixes #1152 - eventful should not include skipped

Signed-off-by: Amos Benari <abenari@redhat.com>
Signed-off-by: Corey Osman <corey@logicminds.biz>

··· From: Amos Benari --- app/models/hostext/search.rb | 2 +- app/models/report.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/hostext/search.rb b/app/models/hostext/search.rb
index aa467ad…7e27832 100644
— a/app/models/hostext/search.rb
+++ b/app/models/hostext/search.rb
@@ -9,7 +9,7 @@ module Hostext
scoped_search :on => :last_report, :complete_value => true
scoped_search :on => :ip, :complete_value => true
scoped_search :on => :enabled, :complete_value => {:true => true, :false => false}, :rename => :‘status.enabled’

  •    scoped_search :on => :puppet_status, :complete_value => {:true => true, :false => false}, :rename => :'status.interesting'
    
  •    scoped_search :on => :puppet_status, :offset => 0, :word_size => Report::BIT_NUM*4, :complete_value => {:true => true, :false => false}, :rename => :'status.interesting'
       scoped_search :on => :puppet_status, :offset => Report::METRIC.index("applied"),         :word_size => Report::BIT_NUM, :rename => :'status.applied'
       scoped_search :on => :puppet_status, :offset => Report::METRIC.index("restarted"),       :word_size => Report::BIT_NUM, :rename => :'status.restarted'
       scoped_search :on => :puppet_status, :offset => Report::METRIC.index("failed"),          :word_size => Report::BIT_NUM, :rename => :'status.failed'
    

diff --git a/app/models/report.rb b/app/models/report.rb
index 6c8d9a6…8fe170b 100644
— a/app/models/report.rb
+++ b/app/models/report.rb
@@ -13,7 +13,7 @@ class Report < ActiveRecord::Base
scoped_search :in => :sources, :on => :value, :rename => :resource

scoped_search :on => :reported_at, :complete_value => true, :default_order => :desc, :rename => :reported

  • scoped_search :on => :status, :complete_value => {:true => true, :false => false}, :rename => :eventful
  • scoped_search :on => :status, :offset => 0, :word_size => 4*BIT_NUM, :complete_value => {:true => true, :false => false}, :rename => :eventful

    scoped_search :on => :status, :offset => METRIC.index(“applied”), :word_size => BIT_NUM, :rename => :applied
    scoped_search :on => :status, :offset => METRIC.index(“restarted”), :word_size => BIT_NUM, :rename => :restarted

    1.7.1

Clicking the number in the Hosts column on the Hardware Models List
(http://foreman/models) will take you to a search for all the matching
models, however, a model such as "PowerEdge R310" will not match because
the search links you to model = PowerEdge R310, without the necessary
quotes.

Signed-off-by: Corey Osman <corey@logicminds.biz>

··· From: Mikael Fridh --- app/views/models/index.html.erb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/app/views/models/index.html.erb b/app/views/models/index.html.erb
index 01caa57…32cc668 100644
— a/app/views/models/index.html.erb
+++ b/app/views/models/index.html.erb
@@ -15,7 +15,7 @@

<%=link_to_if_authorized h(model.name), hash_for_edit_model_path(:id => model)%>
<%=h(model.vendor_class)%>
<%=h(model.hardware_model)%>
  •  <td class="ra"><%= link_to_if model.hosts.any?, model.hosts.count, hosts_path(:search=>"model = #{model.name}") %></td>
    
  •  <td class="ra"><%= link_to_if model.hosts.any?, model.hosts.count, hosts_path(:search=>"model = \"#{model.name}\"") %></td>
     <td class="ra">
       <%= display_link_if_authorized "Destroy", hash_for_model_path(:id => model, :auth_action => :destroy), :confirm => "Delete #{model.name}?", :method => :delete %>
     </td>
    


1.7.1

Signed-off-by: Paul Kelly <paul.ian.kelly@googlemail.com>
Signed-off-by: Corey Osman <corey@logicminds.biz>

··· From: Paul Kelly --- app/models/orchestration.rb | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/app/models/orchestration.rb b/app/models/orchestration.rb
index 192b4db…8c632ec 100644
— a/app/models/orchestration.rb
+++ b/app/models/orchestration.rb
@@ -79,7 +79,8 @@ module Orchestration
# process all pending tasks
q.pending.each do |task|
# if we have failures, we don’t want to process any more tasks

  •    next unless q.failed.empty?
    
  •    break unless q.failed.empty?
    
  •    task.status = "running"
       begin
         task.status = execute({:action => task.action}) ? "completed" : "failed"
    

@@ -88,6 +89,9 @@ module Orchestration
task.status = “conflict”
@record_conflicts << e
failure e.message

  •    rescue RestClient::Exception => e
    
  •      task.status = "failed"
    
  •      failure "#{task.name} task failed with the following error: #{e.response}"
       rescue => e
         task.status = "failed"
         failure "#{task.name} task failed with the following error: #{e}"
    


1.7.1

Signed-off-by: Paul Kelly <paul.ian.kelly@googlemail.com>
Signed-off-by: Corey Osman <corey@logicminds.biz>

··· From: Paul Kelly --- app/models/orchestration/dhcp.rb | 2 +- lib/net/dns.rb | 4 ++-- lib/proxy_api.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/models/orchestration/dhcp.rb b/app/models/orchestration/dhcp.rb
index 7f83fda…ac07ad3 100644
— a/app/models/orchestration/dhcp.rb
+++ b/app/models/orchestration/dhcp.rb
@@ -77,7 +77,7 @@ module Orchestration::DHCP
# trying to guess out tftp next server based on the smart proxy hostname
bs = URI.parse(subnet.tftp.url).host if respond_to?(:tftp?) and tftp?
end

  •  return bs unless bs.blank?
    
  •  return(bs =~/^\d/ ? bs : dns_ptr_record.dns_lookup(bs).ip) unless bs.blank?
     failure "Unable to determine the host's boot server. The DHCP smart proxy failed to provide this information and this subnet is not provided with TFTP services."
    
    rescue => e
    failure "failed to detect boot server: #{e}"
    diff --git a/lib/net/dns.rb b/lib/net/dns.rb
    index 5d78b8d…5184459 100644
    — a/lib/net/dns.rb
    +++ b/lib/net/dns.rb
    @@ -61,12 +61,12 @@ module Net
    raise "Abstract class"
    end
  •  protected
    
  •  def dns_lookup ip_or_name
       DNS.lookup(ip_or_name, proxy, resolver)
     end
    
  •  protected
    
  •  def generate_conflict_error
       logger.warn "Conflicting DNS #{type} record for #{to_s} detected"
       e          = Net::Conflict.new
    

diff --git a/lib/proxy_api.rb b/lib/proxy_api.rb
index 5a7bad7…0cb7842 100644
— a/lib/proxy_api.rb
+++ b/lib/proxy_api.rb
@@ -249,7 +249,7 @@ module ProxyAPI
def bootServer
response = parse get(“serverName”)
if response and response[“serverName”] and !response[“serverName”].blank?

  •    return response["serverName"]
    
  •    return(response["serverName"] =~ /^\d/ ? response["serverName"] : dns_ptr_record.dns_lookup(response["serverName"]).ip)
     end
     false
    
    rescue RestClient::ResourceNotFound

    1.7.1

Signed-off-by: Paul Kelly <paul.ian.kelly@googlemail.com>
Signed-off-by: Corey Osman <corey@logicminds.biz>

··· From: Paul Kelly --- app/models/orchestration/dns.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/orchestration/dns.rb b/app/models/orchestration/dns.rb
index 5435b70…1c91d26 100644
— a/app/models/orchestration/dns.rb
+++ b/app/models/orchestration/dns.rb
@@ -14,12 +14,12 @@ module Orchestration::DNS
end

 def dns_a_record
  •  return unless dns?
    
  •  return unless dns? or @dns_a_record
     @dns_a_record ||= Net::DNS::ARecord.new dns_record_attrs
    

    end

    def dns_ptr_record

  •  return unless dns?
    
  •  return unless dns? or @dns_ptr_record
     @dns_ptr_record ||= Net::DNS::PTRRecord.new dns_record_attrs
    
    end


1.7.1

Signed-off-by: Corey Osman <corey@logicminds.biz>

··· --- app/controllers/bookmarks_controller.rb | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/app/controllers/bookmarks_controller.rb b/app/controllers/bookmarks_controller.rb
index dcd3428…6c42aa4 100644
— a/app/controllers/bookmarks_controller.rb
+++ b/app/controllers/bookmarks_controller.rb
@@ -6,6 +6,7 @@ class BookmarksController < ApplicationController

 respond_to do |format|
   format.html
  •  format.json { render :json => @bookmarks }
    
    end
    end


1.7.1