Class: ForemanDiscovery::ImportHooks::SubnetAndTaxonomy

Inherits:
ForemanDiscovery::ImportHook show all
Defined in:
app/services/foreman_discovery/import_hooks/subnet_and_taxonomy.rb

Instance Attribute Summary

Attributes inherited from ForemanDiscovery::ImportHook

#facts, #host

Instance Method Summary collapse

Methods inherited from ForemanDiscovery::ImportHook

#initialize

Constructor Details

This class inherits a constructor from ForemanDiscovery::ImportHook

Instance Method Details

#after_populateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/foreman_discovery/import_hooks/subnet_and_taxonomy.rb', line 5

def after_populate
  primary_ip = host.primary_interface.ip
  primary_ip6 = host.primary_interface.ip6

  unless primary_ip || primary_ip6
    logger.warn "Unable to assign subnet - reboot trigger may not be possible, primary interface is missing IP address"
    return
  end

  # set subnet
  set_subnets(primary_ip, primary_ip6)
  # set location and organization
  set_location
  set_organization
end