Deleting a provisionned host, then rediscover and reprovision fails at DHCP

Sorry to ask, but how would I set the proxy logs to DEBUG?

I went into ‘/etc/foreman/settings.yaml’ and set logging to debug, that was already set during the previous run:

# Log settings for the current environment can be adjusted by adding them
# here. For example, if you want to increase the log level.
:logging:
  :level: debug
  :production:
    :type: file
    :layout: multiline_request_pattern

Is there another place to control verbosity of proxy logs?

Also look very closely here at the end, it tries to delete ‘10.45.222.1/10.45.222.100’ and says ‘No record found’ but the later it says ‘Duplicate found’ but at ‘10.45.222.0/10.45.222.100’

2021-05-11T18:49:52 e1307683 [I] Finished DELETE /puppet/ca/autosign/mac00900b5d3416.baremetal.lanner with 404 (1.47 ms)
2021-05-11T18:49:52 e1307683 [I] Started DELETE /puppet/ca/mac00900b5d3416.baremetal.lanner
2021-05-11T18:49:52 e1307683 [I] Finished DELETE /puppet/ca/mac00900b5d3416.baremetal.lanner with 200 (236.89 ms)
2021-05-11T18:50:37 378a6a1e [I] Started GET /dhcp/10.45.222.0
2021-05-11T18:50:37 378a6a1e [I] Finished GET /dhcp/10.45.222.0 with 200 (1.21 ms)
2021-05-11T18:58:17 e8ff124b [I] Started POST /dynflow/tasks/status
2021-05-11T18:58:17 e8ff124b [I] Finished POST /dynflow/tasks/status with 200 (29.02 ms)
2021-05-11T23:11:57 78e879e4 [I] Started GET /tftp/serverName
2021-05-11T23:11:57 78e879e4 [I] Finished GET /tftp/serverName with 200 (1.26 ms)
2021-05-11T23:11:57 78e879e4 [I] Started GET /dhcp/10.45.222.1/mac/00:90:0b:5d:34:16
2021-05-11T23:11:57 78e879e4 [E] No DHCP record for MAC 10.45.222.1/00:90:0b:5d:34:16 found
2021-05-11T23:11:57 78e879e4 [W] Error details for No DHCP record for MAC 10.45.222.1/00:90:0b:5d:34:16 found: <Exception>: No DHCP record for MAC 10.45.222.1/00:90:0b:5d:34:16 found
2021-05-11T23:11:57 78e879e4 [W] No DHCP record for MAC 10.45.222.1/00:90:0b:5d:34:16 found: <Exception>: No DHCP record for MAC 10.45.222.1/00:90:0b:5d:34:16 found
2021-05-11T23:11:57 78e879e4 [I] Finished GET /dhcp/10.45.222.1/mac/00:90:0b:5d:34:16 with 404 (1.49 ms)
2021-05-11T23:11:57 78e879e4 [I] Started GET /dhcp/10.45.222.1/ip/10.45.222.100
2021-05-11T23:11:57 78e879e4 [E] No DHCP records for IP 10.45.222.1/10.45.222.100 found
2021-05-11T23:11:57 78e879e4 [W] Error details for No DHCP records for IP 10.45.222.1/10.45.222.100 found: <Exception>: No DHCP records for IP 10.45.222.1/10.45.222.100 found
2021-05-11T23:11:57 78e879e4 [W] No DHCP records for IP 10.45.222.1/10.45.222.100 found: <Exception>: No DHCP records for IP 10.45.222.1/10.45.222.100 found
2021-05-11T23:11:57 78e879e4 [I] Finished GET /dhcp/10.45.222.1/ip/10.45.222.100 with 404 (1.13 ms)
2021-05-11T23:11:58 78e879e4 [I] Started POST /dhcp/10.45.222.1
2021-05-11T23:11:58 78e879e4 [W] Request to create a conflicting DHCP record
2021-05-11T23:11:58 78e879e4 [E] Record 10.45.222.0/10.45.222.100 already exists
2021-05-11T23:11:58 78e879e4 [W] Error details for Record 10.45.222.0/10.45.222.100 already exists: <Proxy::DHCP::Collision>: Record 10.45.222.0/10.45.222.100 already exists

Like I mentioned before, I created the subnet and put IP Address 10.45.222.1 in the field because I thought I had to put the local IP on the Foreman host dedicated to the subnet.

If when creating the subnet in ‘Infrastructure->Subnet’ you actually have to put the ‘base IP’ for the subnet, in my case that would be ‘10.45.222.0’ since it is a /24, then maybe that could explain why sometimes it looks for the DHCP leased IPs in ‘10.45.222.1’ and other times it looks for them using ‘10.45.222.0’.

That could happen for example if some code uses the actual input of the subnet as a base IP and other code actually uses the value that I put in the install config for DHCP:

  --foreman-proxy-dhcp=true \
  --foreman-proxy-dhcp-interface="eth1" \
  --foreman-proxy-dhcp-option-domain="baremetal.lanner" \
  --foreman-proxy-dhcp-listen-on="both" \
  --foreman-proxy-dhcp-network "10.45.222.0" \
  --foreman-proxy-dhcp-netmask "255.255.255.0" \
  --foreman-proxy-dhcp-range "10.45.222.10 10.45.222.99" \
  --foreman-proxy-dhcp-subnets "10.45.222.0/24" \

That was it!

Now when I delete the ‘Deleted’ section gets added to dhcpd.leases:

[root@foreman lanner]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5

server-duid "\000\001\000\001(%\201\357RT\000\000s\266";

lease 10.45.222.100 {
  starts 2 2021/05/11 20:29:02;
  ends 3 2021/05/12 08:29:02;
  cltt 2 2021/05/11 20:29:02;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:90:0b:5d:34:16;
  set vendor-string = "PXEClient:Arch:00000:UNDI:002001";
}
lease 10.45.222.100 {
  starts 2 2021/05/11 20:31:06;
  ends 3 2021/05/12 08:31:06;
  cltt 2 2021/05/11 20:31:06;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:90:0b:5d:34:16;
}
host blade6.baremetal.lanner {
  dynamic;
  hardware ethernet 00:90:0b:5d:34:16;
  fixed-address 10.45.222.100;
        supersede server.filename = "pxelinux.0";
        supersede server.next-server = 0a:2d:de:01;
        supersede host-name = "blade6.baremetal.lanner";
}
host blade6.baremetal.lanner {
  dynamic;
  deleted;
}

Now I can discover and provision without going into the dhcpd.leases file, but only if I use a different hostname.

I choose hostname that are significant to the physical node being deployed, so if I have to redeploy I need to use the same hostname.

This is the content of dhcpd.leases after the whole ‘discover->provision->delete->discover->provision’ steps:

root@foreman lanner]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5

server-duid "\000\001\000\001(%\201\357RT\000\000s\266";

lease 10.45.222.100 {
  starts 2 2021/05/11 20:29:02;
  ends 3 2021/05/12 08:29:02;
  cltt 2 2021/05/11 20:29:02;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:90:0b:5d:34:16;
  set vendor-string = "PXEClient:Arch:00000:UNDI:002001";
}
lease 10.45.222.100 {
  starts 2 2021/05/11 20:31:06;
  ends 3 2021/05/12 08:31:06;
  cltt 2 2021/05/11 20:31:06;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:90:0b:5d:34:16;
}
host blade6.baremetal.lanner {
  dynamic;
  hardware ethernet 00:90:0b:5d:34:16;
  fixed-address 10.45.222.100;
        supersede server.filename = "pxelinux.0";
        supersede server.next-server = 0a:2d:de:01;
        supersede host-name = "blade6.baremetal.lanner";
}
host blade6.baremetal.lanner {
  dynamic;
  deleted;
}
lease 10.45.222.100 {
  starts 2 2021/05/11 21:00:40;
  ends 3 2021/05/12 09:00:40;
  cltt 2 2021/05/11 21:00:40;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:90:0b:5d:34:16;
  set vendor-string = "PXEClient:Arch:00000:UNDI:002001";
}
lease 10.45.222.100 {
  starts 2 2021/05/11 21:02:53;
  ends 3 2021/05/12 09:02:53;
  cltt 2 2021/05/11 21:02:53;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:90:0b:5d:34:16;
}
host mac00900b5d3416.baremetal.lanner {
  dynamic;
  hardware ethernet 00:90:0b:5d:34:16;
  fixed-address 10.45.222.100;
        supersede server.filename = "pxelinux.0";
        supersede server.next-server = 0a:2d:de:01;
        supersede host-name = "mac00900b5d3416.baremetal.lanner";
}

The previous hostname ‘host blade6.baremetal.lanner’ is only part of the ‘deleted’ section before provisioning the second time, but if I used the same hostname ‘blade6’ it would no deploy.

This is what I get in Production.log when I try to provision with the same name as before a delete:

2021-05-11T17:35:52 [I|app|c998e081] Processing by Api::V2::DiscoveredHostsController#update as JSON
2021-05-11T17:35:52 [I|app|c998e081]   Parameters: {"discovered_host"=>{"name"=>"Blade6", "mac"=>"00:90:0b:5d:34:16", "hostgroup_id"=>1, "build"=>1, "enabled"=>1, "managed"=>1}, "apiv"=>"v2", "id"=>"13"}
2021-05-11T17:35:53 [W|app|c998e081] Not queueing Host::Managed: ["Name has already been taken"]
2021-05-11T17:35:53 [W|app|c998e081] Not queueing Host::Managed: ["Name has already been taken"]
2021-05-11T17:35:53 [W|app|c998e081] Not queueing Host::Managed: ["Name has already been taken"]
2021-05-11T17:35:53 [W|app|c998e081] Not queueing Discovery reboot: Name has already been taken
2021-05-11T17:35:53 [W|app|c998e081] Action failed
2021-05-11T17:35:53 [I|app|c998e081] Backtrace for 'Action failed' error (RuntimeError): resource have no errors
 c998e081 | /usr/share/foreman/app/controllers/api/base_controller.rb:147:in `process_resource_error'
 c998e081 | /usr/share/foreman/app/controllers/api/base_controller.rb:167:in `process_response'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-17.0.0/app/controllers/api/v2/discovered_hosts_controller.rb:92:in `update'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb:195:in `process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
 c998e081 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 c998e081 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 c998e081 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:139:in `run_callbacks'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/callbacks.rb:41:in `process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `block in instrument'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `instrument'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb:136:in `process'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/rendering.rb:39:in `process'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal.rb:190:in `dispatch'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal.rb:254:in `dispatch'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:48:in `serve'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:49:in `block in serve'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:in `each'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:in `serve'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.0/lib/katello/middleware/event_daemon.rb:10:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-dsl-2.3.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 c998e081 | /usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/conditional_get.rb:40:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 c998e081 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/cookies.rb:648:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:37:in `call_app'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:28:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 c998e081 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/request_id.rb:27:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.0.0/lib/katello/prevent_json_parsing.rb:12:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/engine.rb:527:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/railtie.rb:190:in `public_send'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/railtie.rb:190:in `method_missing'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.1.1/lib/puma/configuration.rb:246:in `call'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.1.1/lib/puma/request.rb:76:in `block in handle_request'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.1.1/lib/puma/thread_pool.rb:337:in `with_force_shutdown'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.1.1/lib/puma/request.rb:75:in `handle_request'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.1.1/lib/puma/server.rb:431:in `process_client'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.1.1/lib/puma/thread_pool.rb:145:in `block in spawn_thread'
 c998e081 | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2021-05-11T17:35:53 [I|app|c998e081]   Rendering api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout
2021-05-11T17:35:53 [I|app|c998e081]   Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (Duration: 7.9ms | Allocations: 6235)
2021-05-11T17:35:53 [I|app|c998e081] Completed 500 Internal Server Error in 469ms (Views: 14.6ms | ActiveRecord: 36.1ms | Allocations: 102222)

I can’t figure out how to call the dns proxy to get it’s entries similar to what you can do with dhcp:

DHCP call:
curl -s https://foreman.noviflow.lan:9090/dhcp/10.45.222.0 --cert /etc/foreman-proxy/foreman_ssl_cert.pem --key /etc/foreman-proxy/foreman_ssl_key.pem

Tried for DNS:

Always get ‘Requested url was not found’

My ‘baremetal.lanner’ zone does not have any entries:

[root@foreman lanner]# cat /var/named/dynamic/db.baremetal.lanner
$ORIGIN .
$TTL 10800      ; 3 hours
baremetal.lanner        IN SOA  foreman.noviflow.lan. root.baremetal.lanner. (
                                19         ; serial
                                86400      ; refresh (1 day)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                3600       ; minimum (1 hour)
                                )
                        NS      foreman.noviflow.lan.

It seems like I get the ‘Name’ error only when I try to provision using the PUT ‘https://{{foreman_hostname}}/api/v2/discovered_hosts/13’ API with body:

{
“discovered_host”: {
“name”: “Blade6”,
“mac”: “00:90:0b:5d:34:16”,
“hostgroup_id”: 1,
“build”: 1,
“enabled”: 1,
“managed”: 1
}
}

If I choose ‘Provision’ in the UI on the discovered host just selecting the ‘HostGroup’ it succeeds in launching provisioning.

Ok well I found out why.
The call GET ‘api/v2/hosts/’ still returned the host 'blade6.baremetal.lanner even though it was not shown in the UI.

I sent a request to DELETE ‘api/v2/hosts/11’ and then the GET call did not show it anymore, I was then able to call PUT ‘/api/v2/discovered_hosts/14’ to provision.

I will do some tests to see if it was a leftover when subnet was not properly configured or if it happens again.

This was obviously a leftover from the previous bad configuration, now I can do the whole process of delete->discover->provision with the same hostname without any errors.

Thank you very much for your help!

Maybe a note for improvement, in the Subnet configuration form there is no Tooltip on the ‘IP Address’ field, it could says “Base subnet IP” or some equivalent or actually have some validation once the prefix is put in so that the subnet base IP must have empty bytes after the subnet mask.

What made me think I had to put the IP of my interface to that subnet was that it was called “IP Address”. It seems really obvious now that it should of been the base IP of the subnet, but it was pretty hard to diagnose since almost everything was working.

Thanks again for all your help, certainly wont be the last…

I saw that on the screenshot and I thought it should not make a harm. Boy I was wrong, what a mess. Good catch.

Well, there is not much we can do, in the docs we have “put a subnet address”. I think telling “do not put router address there” does not the docs any better :slight_smile:

https://docs.theforeman.org/nightly/Provisioning_Guide/index-foreman-el.html#Configuring_Networking-Adding_a_Subnet_to_the_Satellite_Server

I am not sure what you mean by base IP, but subnet address always ends with a bit zero (so for netmask 8, 16 and 24 there is also zero in decimal).

Yeah, hostnames are shared across organizations, so if you created a host in a different/or none/ organization you would not be allowed to create the same hostname. Switch to Any Organization and delete all the leftovers.

Long case, this one. Well, we are here to help. Good luck.