Class: Actions::ForemanProbing::PerformScan

Inherits:
EntryAction
  • Object
show all
Includes:
Helpers::WithContinuousOutput, Helpers::WithDelegatedAction
Defined in:
app/lib/actions/perform_scan.rb

Instance Method Summary collapse

Instance Method Details

#plan(scan, ports, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/lib/actions/perform_scan.rb', line 10

def plan(scan, ports, options = {})
  options[:subnet_discovery] = true if scan.targeting.is_a? ::ForemanProbing::Targeting::SubnetDiscovery
  scanned = plan_delegated_action(scan.smart_proxy, 'ForemanProbingCore::Actions::UseProbe',
                                  :targets => scan.targeting.targets,
                                  :scan_type => scan.scan_type,
                                  :ports => ports,
                                  :options => options)
  plan_action(CreateSubnets, :proxy_id => scan.smart_proxy_id, :scan => scanned.output) if scan.targeting.is_a? ::ForemanProbing::Targeting::SubnetDiscovery
  plan_action(::Actions::ForemanProbing::ProcessScan,
              :scan_id  => scan.id,
              :scan     => scanned.output,
              :proxy_id => scan.smart_proxy_id,
              :options  => options)
end