Project

General

Profile

Actions

Bug #19939

closed

foreman discovery Unable to assign subnet, primary interface is missing IP address (RuntimeError) when locations enabled and host is in non default location

Added by Luke Alexander almost 7 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Discovery plugin
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

We are running foreman version 1.14.3 with smart proxies at the same version in different locations - we want to use discovery but get the ERF42-1064 error, however each smart proxy has a correct domain/subnet assigned and the hosts being built are within that subnet

At the moment the hosts are using a dhcp server not managed by foreman.

Once the new host appears in discovered hosts in the web ui, the facts appear to be missing but when clicking on the host the facts look present and correct.

If the node is selected and 'Assign Location' is selected from the drop down 'Select Action' then the next time the node reports the facts it will say it has been successful.

What I'm unsure about is why this is not happening automatically - have I misconfigured something or is this a bug?

Some logs from proxy and server:

On the proxy:

D, [2017-06-06T11:09:25.694478 ] DEBUG -- : Rack::Handler::WEBrick is invoked.
E, [2017-06-06T11:09:25.951305 ] ERROR -- : Discovery failed, code 422, reason: ERF42-1064 [Foreman::Exception]: Unable to assign subnet, primary interface is missing IP address
D, [2017-06-06T11:09:25.951454 ] DEBUG -- : Discovery failed, code 422, reason: ERF42-1064 [Foreman::Exception]: Unable to assign subnet, primary interface is missing IP address (RuntimeError)
/usr/lib/ruby/vendor_ruby/smart_proxy_discovery/discovery_main.rb:20:in `create_discovered_host'
/usr/lib/ruby/vendor_ruby/smart_proxy_discovery/discovery_api.rb:38:in `block in <class:InboundApi>'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1603:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1603:in `block in compile!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:966:in `[]'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:966:in `block (3 levels) in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:985:in `route_eval'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:966:in `block (2 levels) in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1006:in `block in process_route'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1004:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1004:in `process_route'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:964:in `block in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:963:in `each'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:963:in `route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1076:in `block in dispatch!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1058:in `block in invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1058:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1058:in `invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1073:in `dispatch!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:898:in `block in call!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1058:in `block in invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1058:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1058:in `invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:898:in `call!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:886:in `call'
/usr/lib/ruby/vendor_ruby/rack/commonlogger.rb:33:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:217:in `call'
/usr/share/foreman-proxy/lib/proxy/log.rb:109:in `call'
/usr/share/foreman-proxy/lib/proxy/request_id_middleware.rb:9:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/xss_header.rb:18:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/path_traversal.rb:16:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/json_csrf.rb:18:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/base.rb:50:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/base.rb:50:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/frame_options.rb:31:in `call'
/usr/lib/ruby/vendor_ruby/rack/nulllogger.rb:9:in `call'
/usr/lib/ruby/vendor_ruby/rack/head.rb:11:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/show_exceptions.rb:21:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:180:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:2014:in `call'
/usr/lib/ruby/vendor_ruby/smart_proxy_discovery/discovery_api.rb:12:in `call'
/usr/lib/ruby/vendor_ruby/rack/builder.rb:138:in `call'
/usr/lib/ruby/vendor_ruby/rack/urlmap.rb:65:in `block in call'
/usr/lib/ruby/vendor_ruby/rack/urlmap.rb:50:in `each'
/usr/lib/ruby/vendor_ruby/rack/urlmap.rb:50:in `call'
/usr/lib/ruby/vendor_ruby/rack/builder.rb:138:in `call'
/usr/lib/ruby/vendor_ruby/rack/handler/webrick.rb:60:in `service'
/usr/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/usr/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/usr/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
I, [2017-06-06T11:09:25.952070 ] INFO -- : 10.2.2.77 - - [06/Jun/2017 11:09:25] "POST /discovery/create HTTP/1.1" 500 133 0.2545

D, [2017-06-06T11:09:25.952594 ] DEBUG -- : close: 10.2.2.77:57356

On the foreman server:

2017-06-06T11:22:47 d4107f2d [app] [I] Import facts for 'mac5254004529a9' completed. Added: 0, Updated: 0, Deleted 0 facts
2017-06-06T11:22:47 d4107f2d [app] [W] Host discovery failed, facts: {"lib"=>"/usr/share/fdi/facts:/opt/extension/facts", "hostname"=>"fdi", "hardwareisa"=>"x86_64", "gid"=>"root", "fqdn"=>"fdi.example.net", "network_eth0"=>"10.2.2.0", "network_lo"=>"127.0.0.0", "virtual"=>"kvm", "is_virtual"=>true, "macaddress"=>"52:54:00:45:29:a9", "domain"=>"example.net", "memorysize"=>"3.86 GB", "memorysize_mb"=>"3951.80", "processors"=>{"models"=>["QEMU Virtual CPU version 1.1.2", "QEMU Virtual CPU version 1.1.2", "QEMU Virtual CPU version 1.1.2", "QEMU Virtual CPU version 1.1.2"], "count"=>4, "physicalcount"=>4}, "ipaddress"=>"10.2.2.77", "architecture"=>"x86_64", "blockdevice_vda_size"=>10737418240, "blockdevice_vda_vendor"=>"0x1af4", "blockdevices"=>"vda", "selinux"=>false, "facterversion"=>"2.4.1", "hardwaremodel"=>"x86_64", "bios_vendor"=>"Bochs", "bios_version"=>"Bochs", "bios_release_date"=>"01/01/2007", "manufacturer"=>"Bochs", "productname"=>"Bochs", "serialnumber"=>"Not Specified", "uuid"=>"8E844645-D413-6CC9-E721-FB8C9437F824", "type"=>"Other", "uniqueid"=>"020a4d02", "os"=>{"name"=>"CentOS", "family"=>"RedHat", "release"=>{"major"=>"7", "minor"=>"3", "full"=>"7.3.1611"}}, "id"=>"root", "ps"=>"ps -ef", "processor0"=>"QEMU Virtual CPU version 1.1.2", "processor1"=>"QEMU Virtual CPU version 1.1.2", "processor2"=>"QEMU Virtual CPU version 1.1.2", "processor3"=>"QEMU Virtual CPU version 1.1.2", "processorcount"=>4, "dhcp_servers"=>{"system"=>"10.2.2.2", "eth0"=>"10.2.2.2"}, "netmask"=>"255.255.255.0", "physicalprocessorcount"=>4, "interfaces"=>"eth0,lo", "ipaddress_eth0"=>"10.2.2.77", "macaddress_eth0"=>"52:54:00:45:29:a9", "netmask_eth0"=>"255.255.255.0", "mtu_eth0"=>1500, "ipaddress_lo"=>"127.0.0.1", "netmask_lo"=>"255.0.0.0", "mtu_lo"=>65536, "discovery_version"=>"3.3.1", "discovery_release"=>"20170323.1", "discovery_bootif"=>"52:54:00:45:29:a9", "discovery_bootip"=>"10.2.2.77", "link_eth0"=>"true", "link_lo"=>"true", "lldp_neighbor_chassisid_eth0"=>"00:1b:21:91:da:48", "lldp_neighbor_sysname_eth0"=>"freezer.example.net", "lldp_neighbor_mngaddr_ipv4_eth0"=>"10.2.2.15", "discovery_proxy_uri"=>"https://foreman-proxy.example.net:8443", "discovery_proxy_type"=>"proxy"}
2017-06-06T11:22:47 d4107f2d [app] [I] Completed 422 Unprocessable Entity in 211ms (Views: 0.4ms | ActiveRecord: 39.4ms)

Actions #1

Updated by Luke Alexander almost 7 years ago

  • Subject changed from foreman discovery Unable to assign subnet, primary interface is missing IP address (RuntimeError) to foreman discovery Unable to assign subnet, primary interface is missing IP address (RuntimeError) when locations enabled and host is in non default location

Some further digging revealed this to be a problem with discovery when locations are enabled and the host being discovered is not in the default location (as set in Discovered settings)

I'm not sure why the location can't be calculated from the subnet fact returned when provisioning?

Actions #2

Updated by Lukas Zapletal over 6 years ago

Hello, location should be calculated the same way as organizations now, check it out. We are going improve this area hopefully soon.

Actions #3

Updated by Lukas Zapletal over 6 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF