Project

General

Profile

Bug #15143

DHCP :subnet: parameter no longer optional

Added by Finke Lamein about 4 years ago. Updated about 4 years ago.

Status:
Duplicate
Priority:
Low
Assignee:
-
Category:
DHCP
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

since version 1.11.x the :subnet: definition in foreman-proxy dhcp settings is no longer optional.

Below config was migrated during one of the earlier updates:

~]# cat /etc/foreman-proxy/settings.d/dhcp.yml 
--- 
:enabled: https
:use_provider: dhcp_isc

Default config from package:
---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: false

# valid providers:
#   - dhcp_isc (ISC dhcp server)
#   - dhcp_native_ms (Microsoft native implementation)
#   - dhcp_virsh (simple implementation for libvirt)
#:use_provider: dhcp_isc
#:server: 127.0.0.1
# subnets restricts the subnets queried to a subset, to reduce the query time.
#:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]

~]# grep -i debug /etc/foreman-proxy/settings.yml
# WARN, DEBUG, ERROR, FATAL, INFO, UNKNOWN
:log_level: DEBUG

Restart foreman-proxy:
D, [2016-05-23T16:13:23.489289 #3599] DEBUG -- : Rack::Handler::WEBrick is mounted on /.
I, [2016-05-23T16:13:23.489498 #3599]  INFO -- : WEBrick::HTTPServer#start: pid=3599 port=8443
I, [2016-05-23T16:13:39.642464 #3748]  INFO -- : Finished initialization of module 'discovery'
I, [2016-05-23T16:13:39.642736 #3748]  INFO -- : 'foreman_proxy' settings were initialized with default values: :enabled: true
I, [2016-05-23T16:13:39.664302 #3748]  INFO -- : Finished initialization of module 'foreman_proxy'
I, [2016-05-23T16:13:39.666929 #3748]  INFO -- : Finished initialization of module 'tftp'
I, [2016-05-23T16:13:39.667440 #3748]  INFO -- : 'dhcp_isc' settings were initialized with default values: :enabled: false, :omapi_port: 7911
I, [2016-05-23T16:13:39.677621 #3748]  INFO -- : Finished initialization of module 'dhcp_isc'
I, [2016-05-23T16:13:39.677894 #3748]  INFO -- : 'dhcp' settings were initialized with default values: :server: 127.0.0.1, :subnets: 
E, [2016-05-23T16:13:39.678106 #3748] ERROR -- : Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value

Adding to /etc/foreman-proxy/settings.d/dhcp.yml:

:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]

Restart foreman-proxy:

I, [2016-05-23T16:16:09.881216 #4578]  INFO -- : 'dhcp' settings were initialized with default values: :server: 127.0.0.1
I, [2016-05-23T16:16:09.896015 #4578]  INFO -- : Finished initialization of module 'dhcp'

The manual isn't very clear on this:

All available subnets will be loaded and can be managed by default, but this can have a performance penalty. If only some subnets are used, specify them as follows in network_address/network_mask notation:

:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]

Related issues

Related to Smart Proxy - Bug #14952: dhcp_isc not respecting the :subnets: settings anymoreClosed2016-05-06
Related to Smart Proxy - Bug #15240: Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty valueClosed2016-05-31

History

#1 Updated by Dominic Cleal about 4 years ago

  • Project changed from Foreman to Smart Proxy
  • Description updated (diff)
  • Category changed from DHCP to DHCP
  • Legacy Backlogs Release (now unused) set to 159

#2 Updated by Dominic Cleal about 4 years ago

  • Status changed from New to Feedback

I can't reproduce this with the example file, only by adding an empty subnets parameter to the config.

With:

---
# Enable DHCP management
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true

# valid providers:
#   - dhcp_isc (ISC dhcp server)
#   - dhcp_native_ms (Microsoft native implementation)
#   - dhcp_virsh (simple implementation for libvirt)
:use_provider: dhcp_isc
:server: 127.0.0.1
# subnets restricts the subnets queried to a subset, to reduce the query time.
#:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]

The server starts fine:

I, [2016-05-24T13:05:59.120879 #23459]  INFO -- : 'dhcp_isc' settings were initialized with default values: :enabled: false
I, [2016-05-24T13:05:59.136856 #23459]  INFO -- : Finished initialization of module 'dhcp_isc'
I, [2016-05-24T13:05:59.136996 #23459]  INFO -- : 'dhcp' settings were initialized with default values: :subnets: []
I, [2016-05-24T13:05:59.139348 #23459]  INFO -- : Finished initialization of module 'dhcp'

It also logs that the default value of [] is used, which isn't in the bug report, so I think what was actually in the config file was probably this:

# subnets restricts the subnets queried to a subset, to reduce the query time.
#:subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]
:subnets:

causing:

I, [2016-05-24T13:06:22.812063 #23494]  INFO -- : 'dhcp_isc' settings were initialized with default values: :enabled: false
I, [2016-05-24T13:06:22.827937 #23494]  INFO -- : Finished initialization of module 'dhcp_isc'
E, [2016-05-24T13:06:22.828134 #23494] ERROR -- : Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value
D, [2016-05-24T13:06:22.828165 #23494] DEBUG -- : ["/usr/share/foreman-proxy/lib/proxy/plugin_validators.rb:27:in `validate!'", "/usr/share/foreman-proxy/lib/proxy/pluggable.rb:43:in `block in execute_validators'", "/usr/share/foreman-proxy/lib/proxy/pluggable.rb:43:in `
each'", "/usr/share/foreman-proxy/lib/proxy/pluggable.rb:43:in `execute_validators'", "/usr/share/foreman-proxy/lib/proxy/pluggable.rb:38:in `validate!'", "/usr/share/foreman-proxy/lib/proxy/plugin.rb:132:in `validate!'", "/usr/share/foreman-proxy/lib/proxy/plugin.rb:150
:in `configure_plugin'", "/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:31:in `block in configure_plugins'", "/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:29:in `each'", "/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:29:in `configure_plu
gins'", "/usr/share/foreman-proxy/lib/proxy/plugin_initializer.rb:5:in `initialize_plugins'", "/usr/share/foreman-proxy/lib/launcher.rb:114:in `configure_plugins'", "/usr/share/foreman-proxy/lib/launcher.rb:124:in `launch'", "/usr/share/foreman-proxy/bin/smart-proxy:6:in
 `<main>'"]

The setting is optional, in that it doesn't have to be specified, but if it is present in the config then it must be set to a value.

(Edit: to be clear, this is a change in behaviour, but I think it's working reasonably and correctly. The default config appears to work fine, it's only if the setting is there but not properly set.)

#3 Updated by Dominic Cleal about 4 years ago

  • Legacy Backlogs Release (now unused) deleted (159)

#4 Updated by Dominic Cleal about 4 years ago

  • Related to Bug #14952: dhcp_isc not respecting the :subnets: settings anymore added

#5 Updated by Dominic Cleal about 4 years ago

  • Related to Bug #15240: Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value added

#6 Updated by Dominic Cleal about 4 years ago

  • Status changed from Feedback to Duplicate

#15240 has narrowed down the problem to affecting only Ruby 1.8.7 installations (I used something much newer above), we'll track a fix under that ticket instead. Thanks for the report!

Also available in: Atom PDF