Class: Actions::ForemanProbing::UpdateProbingFacet

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/update_probing_facet.rb

Instance Method Summary collapse

Instance Method Details

#rescue_strategyObject



22
23
24
# File 'app/lib/actions/update_probing_facet.rb', line 22

def rescue_strategy
  Dynflow::Action::Rescue::Skip
end

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/lib/actions/update_probing_facet.rb', line 7

def run
  data = input[:parsed_scan]
  if data.key? :host_id
    host = Host.find(data[:host_id])
    host.probing_facet ||= ::ForemanProbing::ProbingFacet.new
    host.probing_facet.status = data['facts'].fetch('status', {}).fetch('state', 'down')

    %w(tcp udp).each do |protocol|
      update_ports protocol, host.probing_facet
    end

    host.probing_facet.save!
  end
end