Bug #15240

Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value

Added by Martin Dobrev almost 2 years ago. Updated almost 2 years ago.

Status:Closed
Priority:Normal
Assigned To:Dmitri Dolguikh
Category:DHCP
Target version:-
Difficulty: Bugzilla link:
Found in release:1.11.2 Pull request:https://github.com/theforeman/smart-proxy/pull/423, https://github.com/theforeman/smart-proxy/pull/424
Story points-
Velocity based estimate-
Release1.11.3Release relationshipAuto

Description

Hi,

after upgrading my smart proxy nodes to 1.11.2 and theforeman-foreman_proxy to 2.5.0 I can't use DHCP any more. I'm getting an error on the SP nodes that subnets can't be a non-empty array but I can't really set this parameter via the module. As far as I can see this parameter is introduced in the master branch of the Puppet module.

proxy.log

E, [2016-05-31T12:46:39.160714 #23759] ERROR -- : Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value
E, [2016-05-31T12:47:58.615590 #23904] ERROR -- : Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value

dhcp.yaml

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

# 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]


Related issues

Related to Smart Proxy - Bug #15143: DHCP :subnet: parameter no longer optional Duplicate 05/23/2016
Related to Smart Proxy - Bug #14952: dhcp_isc not respecting the :subnets: settings anymore Closed 05/06/2016

Associated revisions

Revision 222cf178
Added by Dmitri Dolguikh almost 2 years ago

Fixes #15240 - empty arrays no longer trigger validation failures

On 1.8.7 (only there) [].to_s == '',
which lead to presence validator failures.

History

#1 Updated by Dominic Cleal almost 2 years ago

  • Category set to DHCP
  • Release set to 1.11.3

Do you have DEBUG level logs from the smart proxy? It'd be useful to see precisely what it's logging about the settings set.

#2 Updated by Dominic Cleal almost 2 years ago

  • Subject changed from foreman_proxy Puppet module ver. 2.5.0 not compatible with smart_proxy 1.11.2 to Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value

#3 Updated by Dominic Cleal almost 2 years ago

  • Related to Bug #15143: DHCP :subnet: parameter no longer optional added

#4 Updated by Dominic Cleal almost 2 years ago

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

#5 Updated by Martin Dobrev almost 2 years ago

Dominic Cleal wrote:

Do you have DEBUG level logs from the smart proxy? It'd be useful to see precisely what it's logging about the settings set.

cat proxy.log
I, [2016-05-31T13:41:17.382929 #30819]  INFO -- : 'discovery' settings were initialized with default values: :node_port: 8443, :node_scheme: https
I, [2016-05-31T13:41:17.386399 #30819]  INFO -- : Finished initialization of module 'discovery'
I, [2016-05-31T13:41:17.386633 #30819]  INFO -- : 'foreman_proxy' settings were initialized with default values: :enabled: true
I, [2016-05-31T13:41:17.390027 #30819]  INFO -- : Finished initialization of module 'foreman_proxy'
I, [2016-05-31T13:41:17.390715 #30819]  INFO -- : 'dns_nsupdate' settings were initialized with default values: :enabled: false
I, [2016-05-31T13:41:17.397689 #30819]  INFO -- : Finished initialization of module 'dns_nsupdate'
I, [2016-05-31T13:41:17.400295 #30819]  INFO -- : Finished initialization of module 'dns'
I, [2016-05-31T13:41:17.402767 #30819]  INFO -- : Finished initialization of module 'templates'
I, [2016-05-31T13:41:17.405031 #30819]  INFO -- : Finished initialization of module 'tftp'
I, [2016-05-31T13:41:17.405638 #30819]  INFO -- : 'dhcp_isc' settings were initialized with default values: :enabled: false
I, [2016-05-31T13:41:17.414037 #30819]  INFO -- : Finished initialization of module 'dhcp_isc'
I, [2016-05-31T13:41:17.414259 #30819]  INFO -- : 'dhcp' settings were initialized with default values: :subnets: 
E, [2016-05-31T13:41:17.414459 #30819] ERROR -- : Couldn't enable plugin dhcp: Parameter 'subnets' is expected to have a non-empty value
D, [2016-05-31T13:41:17.414507 #30819] DEBUG -- : ["/usr/share/foreman-proxy/lib/proxy/plugin_validators.rb:27:in `validate!'", "/usr/share/foreman-proxy/lib/proxy/pluggable.rb:43: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 `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_plugins'", "/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"]
D, [2016-05-31T13:41:17.416828 #30819] DEBUG -- : Log buffer API initialized, available capacity: 2000/1000
I, [2016-05-31T13:41:17.416942 #30819]  INFO -- : Finished initialization of module 'logs'
I, [2016-05-31T13:41:17.549088 #30821]  INFO -- : WEBrick 1.3.1
I, [2016-05-31T13:41:17.549694 #30821]  INFO -- : WEBrick 1.3.1
I, [2016-05-31T13:41:17.550189 #30821]  INFO -- : ruby 1.8.7 (2013-06-27) [x86_64-linux]
I, [2016-05-31T13:41:17.550389 #30821]  INFO -- : ruby 1.8.7 (2013-06-27) [x86_64-linux]
D, [2016-05-31T13:41:17.554123 #30821] DEBUG -- : TCPServer.new(0.0.0.0, 8443)
D, [2016-05-31T13:41:17.555387 #30821] DEBUG -- : TCPServer.new(0.0.0.0, 8080)
D, [2016-05-31T13:41:17.555750 #30821] DEBUG -- : TCPServer.new(::, 8443)
D, [2016-05-31T13:41:17.555875 #30821] DEBUG -- : TCPServer.new(::, 8080)
W, [2016-05-31T13:41:17.556146 #30821]  WARN -- : TCPServer Error: Address already in use - bind(2)
W, [2016-05-31T13:41:17.556300 #30821]  WARN -- : TCPServer Error: Address already in use - bind(2)
I, [2016-05-31T13:41:17.557972 #30821]  INFO -- : 
Certificate:
    <removed>

D, [2016-05-31T13:41:17.560786 #30821] DEBUG -- : Rack::Handler::WEBrick is mounted on /.
D, [2016-05-31T13:41:17.561279 #30821] DEBUG -- : Rack::Handler::WEBrick is mounted on /.
I, [2016-05-31T13:41:17.561548 #30821]  INFO -- : WEBrick::HTTPServer#start: pid=30821 port=8080
I, [2016-05-31T13:41:17.561677 #30821]  INFO -- : WEBrick::HTTPServer#start: pid=30821 port=8443

#6 Updated by Dominic Cleal almost 2 years ago

Thanks, that's very useful. There's a difference here which is interesting:

I, [2016-05-31T13:41:17.414259 #30819]  INFO -- : 'dhcp' settings were initialized with default values: :subnets:

My test at http://projects.theforeman.org/issues/15143#note-2 logged this instead:

I, [2016-05-24T13:05:59.136996 #23459]  INFO -- : 'dhcp' settings were initialized with default values: :subnets: []

and hence worked. My only guess might be a difference in Ruby versions or monkey patches (e.g. Puppet's) affecting behaviour.

#7 Updated by Dmitri Dolguikh almost 2 years ago

It seems that the issue affects/can only be replicated on ruby 1.8.7.

#8 Updated by Martin Dobrev almost 2 years ago

Dmitri Dolguikh wrote:

It seems that the issue affects/can only be replicated on ruby 1.8.7.

Indeed I see this problem only with CentOS 6.x nodes, Ruby is 1.8.7

#9 Updated by The Foreman Bot almost 2 years ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Dmitri Dolguikh
  • Pull request https://github.com/theforeman/smart-proxy/pull/423 added

#10 Updated by The Foreman Bot almost 2 years ago

  • Pull request https://github.com/theforeman/smart-proxy/pull/424 added

#11 Updated by Josh Gray almost 2 years ago

I am seeing this too on CentOS 6.7 with Ruby 1.8.7

I found a workaround is adding this:
:subnets: [192.168.1.0/255.255.255.0]

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

And restarting the smart proxy service. DHCP is then discovered as a smart proxy feature.

#12 Updated by Anonymous almost 2 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF