Support #23327
closedundefined method `network' for "x.x.x.x":String
Description
After upgrading foreman-smartproxy from version 1.16.0 to 1.16.1 via debian package the following error occurs while trying to create a new host:
We are using SmartProxyDhcpInfoblox.
- In debug logging:
undefined method `network' for "x.x.x.x":String
- In webfronted:
Failed to fetch a free IP from proxy <HOSTNAME> (https://<FQDN>:8443): ERF12-8202 [ProxyAPI::ProxyException]: Ungenutzte IP konnte nicht abgerufen werden ([RestClient::BadRequest]: 400 Bad Request) für Proxy https://<FQDN>:8443/dhcp
Any hints?
Files
Updated by Anonymous over 6 years ago
- Status changed from New to Rejected
- Priority changed from High to Normal
Please upgrade to Smart-Proxy version 1.17, which uses a different implementation of "free ip" functionality that shared between several dhcp providers.
Updated by Christian Meißner over 6 years ago
Dmitri Dolguikh wrote:
Please upgrade to Smart-Proxy version 1.17, which uses a different implementation of "free ip" functionality that shared between several dhcp providers.
This should not be the only option. With version 1.16.0 all works fine. But after upgrade to version 1.16.1 the issue come up. Why is a version released, which is not working properly?
In our case an upgrade to 1.17 is not an option because we are running foreman on the host to and foreman upgrade to 1.17 fails because of not working dependencies in the debian packages. All in all it is a mess.
We'll now trying to setup a separate machine with an smart-proxy in version 1.17 to workaround this issue. While the 1.17 debian packages are fixed.
Updated by Christian Meißner over 6 years ago
- Priority changed from Normal to High
I created a foreman proxy machine with foreman-proxy 1.17.0-1, ruby-smart-proxy-dhcp-infoblox 0.0.5 installed. But the result is the same:
E, [2018-04-20T12:35:47.972893 879fba2e] ERROR -- : undefined method `network' for "AAA.BBB.CCC.DDD":String
D, [2018-04-20T12:35:47.972925 879fba2e] DEBUG -- : undefined method `network' for "AAA.BBB.CCC.DDD":String (NoMethodError)
/usr/lib/ruby/vendor_ruby/smart_proxy_dhcp_infoblox/dhcp_infoblox_main.rb:57:in `unused_ip'
/usr/share/foreman-proxy/modules/dhcp/dhcp_api.rb:34:in `block in <class:DhcpApi>'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1611:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1611:in `block in compile!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:975:in `block (3 levels) in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:994:in `route_eval'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:975:in `block (2 levels) in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1015:in `block in process_route'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1013:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1013:in `process_route'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:973:in `block in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:972:in `each'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:972:in `route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1085:in `block in dispatch!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `block in invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1082:in `dispatch!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:907:in `block in call!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `block in invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:907:in `call!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:895:in `call'
/usr/lib/ruby/vendor_ruby/rack/methodoverride.rb:22:in `call'
/usr/lib/ruby/vendor_ruby/rack/commonlogger.rb:33:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:219: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:49:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/base.rb:49: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:13:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/show_exceptions.rb:25:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:182:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:2013:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1487:in `block in call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1787:in `synchronize'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1487:in `call'
/usr/lib/ruby/vendor_ruby/rack/urlmap.rb:66: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:153:in `call'
/usr/lib/ruby/vendor_ruby/rack/handler/webrick.rb:88:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/usr/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
I, [2018-04-20T12:35:47.973823 879fba2e] INFO -- : 10.1.231.7 - - [20/Apr/2018:12:35:47 +0200] "GET /dhcp/AAA.BBB.CCC.DDD/unused_ip HTTP/1.1" 400 52 0.0026
So the bug still exists in 1.17.x.
Christian Meißner wrote:
Dmitri Dolguikh wrote:
Please upgrade to Smart-Proxy version 1.17, which uses a different implementation of "free ip" functionality that shared between several dhcp providers.
This should not be the only option. With version 1.16.0 all works fine. But after upgrade to version 1.16.1 the issue come up. Why is a version released, which is not working properly?
In our case an upgrade to 1.17 is not an option because we are running foreman on the host to and foreman upgrade to 1.17 fails because of not working dependencies in the debian packages. All in all it is a mess.
We'll now trying to setup a separate machine with an smart-proxy in version 1.17 to workaround this issue. While the 1.17 debian packages are fixed.
Updated by Anonymous over 6 years ago
This should not be the only option. With version 1.16.0 all works fine. But after upgrade to version 1.16.1 the issue come up. Why is a version released, which is not working properly?
There were no changes as far as I can tell in smart-proxy. I didn't check the infoblox provider. We do not have infrastructure to test against infoblox appliance; additionally the appliance isn't used by a lot of people, so issues that you experienced will happen. Lastly, there were other issues with infoblox "unused ip" api, hence our switch to a different implementation and my suggestion.
Updated by Anonymous over 6 years ago
I created a foreman proxy machine with foreman-proxy 1.17.0-1, ruby-smart-proxy-dhcp-infoblox 0.0.5 installed
This is a very old version of the infoblox provider: you'll need version 0.0.12 to be able to use 1.17 release.
Updated by Christian Meißner over 6 years ago
Dmitri Dolguikh wrote:
I created a foreman proxy machine with foreman-proxy 1.17.0-1, ruby-smart-proxy-dhcp-infoblox 0.0.5 installed
This is a very old version of the infoblox provider: you'll need version 0.0.12 to be able to use 1.17 release.
Yeah we would be happy to use these version but in package repository we can only find version 0.0.5. And we prefer to install the packages which comes with your deb repo.
Is it possible to provide the newer one via deb.theforeman.org?
Updated by Anonymous over 6 years ago
- Tracker changed from Bug to Support
- Priority changed from High to Normal
Is it possible to provide the newer one via deb.theforeman.org?
Please this question in #theforeman, perhaps someone will be able to help. Alternatively, please consider helping out with packaging. If all else fails, you can install the gem from sources (pls. see http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Smart-Proxy_Plugin for details).
Updated by Christian Meißner over 6 years ago
Dmitri Dolguikh wrote:
Is it possible to provide the newer one via deb.theforeman.org?
Please this question in #theforeman, perhaps someone will be able to help. Alternatively, please consider helping out with packaging. If all else fails, you can install the gem from sources (pls. see http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Smart-Proxy_Plugin for details).
After Upgrade gem to version 0.0.12 we got a error 500.
Did you mean? Rack
RUBY_VERSION (NameError)
/var/lib/gems/2.3.0/gems/rack-2.0.5/lib/rack/handler/webrick.rb:66:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/usr/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Infoblox Support is absolutly broken neither upgrade to 1.17 nor downgrade to 1.15 will work. So How can we fix this. Ipam is mission critical.
Updated by Christian Meißner over 6 years ago
Dmitri Dolguikh wrote:
Is it possible to provide the newer one via deb.theforeman.org?
Please this question in #theforeman, perhaps someone will be able to help. Alternatively, please consider helping out with packaging. If all else fails, you can install the gem from sources (pls. see http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Smart-Proxy_Plugin for details).
After Upgrade gem to version 0.0.12 we got a error 500.
E, [2018-04-24T09:11:02.345655 ] ERROR -- : uninitialized constant Rack::Handler::WEBrick::RACK_VERSION
Did you mean? Rack
RUBY_VERSION (NameError)
/var/lib/gems/2.3.0/gems/rack-2.0.5/lib/rack/handler/webrick.rb:66:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/usr/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Infoblox Support is absolutly broken neither upgrade to 1.17 nor downgrade to 1.15 will work. So How can we fix this. Ipam is mission critical.
Updated by Christian Meißner over 6 years ago
Christian Meißner wrote:
Dmitri Dolguikh wrote:
Is it possible to provide the newer one via deb.theforeman.org?
Please this question in #theforeman, perhaps someone will be able to help. Alternatively, please consider helping out with packaging. If all else fails, you can install the gem from sources (pls. see http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Smart-Proxy_Plugin for details).
After Upgrade gem to version 0.0.12 we got a error 500.
E, [2018-04-24T09:11:02.345655 ] ERROR -- : uninitialized constant Rack::Handler::WEBrick::RACK_VERSION
Did you mean? Rack
RUBY_VERSION (NameError)
/var/lib/gems/2.3.0/gems/rack-2.0.5/lib/rack/handler/webrick.rb:66:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/usr/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'Infoblox Support is absolutly broken neither upgrade to 1.17 nor downgrade to 1.15 will work. So How can we fix this. Ipam is mission critical.
Here it helps to uninstall rack version 2.0.5 to fix the ruby error. But after that the error is still the same with the latest `gem 'smart_proxy_dhcp_infoblox', '0.0.12'`
What now?
Updated by Christian Meißner over 6 years ago
- Tracker changed from Support to Bug
Updated by Anonymous over 6 years ago
- Tracker changed from Bug to Support
Please check what gems are installed on your system: run gem list and then dpkg -l ruby*. In particular, please check if local and system gems contain rack: it looks like the local version of the gem overrides the system one. You may need to remove local gems (other than the infoblox provider and its immediate dependencies) to resolve this issue.
Updated by Christian Meißner over 6 years ago
Dmitri Dolguikh wrote:
Please check what gems are installed on your system: run gem list and then dpkg -l ruby*. In particular, please check if local and system gems contain rack: it looks like the local version of the gem overrides the system one. You may need to remove local gems (other than the infoblox provider and its immediate dependencies) to resolve this issue.
Ok, the rack error is gone as a wrote in http://projects.theforeman.org/issues/23327#note-10. But the unused_ip error is still there with the smart_proxy_dhcp_infoblox version 0.0.12 gem.
But here the gem list
- gem list
- LOCAL GEMS ***
bigdecimal (1.2.8)
bundler (1.11.2)
bundler_ext (0.4.1)
CFPropertyList (2.3.6, 2.2.8)
concurrent-ruby (1.0.5, 1.0.0)
did_you_mean (1.0.0)
facter (2.5.1)
faraday (0.15.0, 0.9.2)
faraday_middleware (0.12.2, 0.10.0)
fast_gettext (1.1.2)
ffi (1.9.23, 1.9.10)
gettext (3.2.9)
gettext-setup (0.30)
gssapi (1.2.0)
hiera (3.4.3)
infoblox (2.0.5, 2.0.0)
io-console (0.4.5)
json (2.1.0, 1.8.3)
json_pure (1.8.6)
locale (2.1.2)
minitest (5.8.4)
molinillo (0.4.3)
multi_json (1.13.1)
multipart-post (2.0.0, 1.2.0)
mustermann (1.0.2)
net-http-persistent (2.9.4)
net-telnet (0.1.1)
power_assert (0.2.7)
psych (2.0.17)
puppet (5.5.1, 4.10.11)
rack (1.6.10, 1.6.4)
rack-protection (2.0.1, 1.5.5, 1.5.3)
rake (12.3.1, 10.5.0)
rake-compiler (1.0.4)
rb-inotify (0.9.10, 0.9.7)
rb-kqueue (0.2.5)
rdoc (4.2.1)
rkerberos (0.1.5, 0.1.3)
rsec (0.4.2)
ruby-augeas (0.5.0)
ruby-libvirt (0.7.1, 0.6.0)
rubyipmi (0.10.0)
sinatra (2.0.1, 1.4.8, 1.4.7)
smart_proxy_dhcp_infoblox (0.0.12)
smart_proxy_dns_infoblox (0.0.6, 0.0.4)
test-unit (3.1.7)
text (1.3.1)
thor (0.19.1)
tilt (2.0.8, 2.0.1)
and hier the system packages
- dpkg -l ruby*|grep ^ii
ii ruby 1:2.3.0+1
ii ruby-augeas 1:0.5.0-3build4
ii ruby-bundler 1.11.2-1
ii ruby-bundler-ext 0.4.1-1
ii ruby-concurrent 1.0.0-1
ii ruby-dev:amd64 1:2.3.0+1
ii ruby-did-you-mean 1.0.0-2
ii ruby-faraday 0.9.2-3
ii ruby-faraday-middleware 0.10.0-1
ii ruby-ffi 1.9.10debian-1build2
ii ruby-gssapi 1.2.0-1
ii ruby-infoblox 2.0.0-1
ii ruby-json 1.8.3-1build4
ii ruby-libvirt 0.6.0-2
ii ruby-minitest 5.8.4-2
ii ruby-molinillo 0.4.3-1
ii ruby-multipart-post 1.2.0-2
ii ruby-net-http-persistent 2.9.4-1
ii ruby-net-telnet 0.1.1-2
ii ruby-power-assert 0.2.7-1
ii ruby-rack 1.6.4-3
ii ruby-rack-protection 1.5.3-2
ii ruby-rb-inotify 0.9.7-1
ii ruby-rkerberos 0.1.3-3
ii ruby-rsec 0.4.2-1
ii ruby-rubyipmi 0.10.0-1
ii ruby-sinatra 1.4.7-3
ii ruby-smart-proxy-dhcp-infoblox 0.0.5-1
ii ruby-smart-proxy-dns-infoblox 0.0.4-1
ii ruby-test-unit 3.1.7-2
ii ruby-thor 0.19.1-2
ii ruby-tilt 2.0.1-2
Updated by Anonymous over 6 years ago
Can you post the debug-level log from the smart-proxy? The log should show the version of the infoblox gem used, is it 0.0.12, or the older one? If so, you'll need to remove the older one from the system ruby gems.
Updated by Christian Meißner over 6 years ago
- File proxy_20180426.log proxy_20180426.log added
Dmitri Dolguikh wrote:
Can you post the debug-level log from the smart-proxy? The log should show the version of the infoblox gem used, is it 0.0.12, or the older one? If so, you'll need to remove the older one from the system ruby gems.
Attached you find our anonymous proxy.log. Unfortunately there are no version numbers shown. But we already removed all old versions from the system as you see here.
bigdecimal (1.2.8)
bundler (1.11.2)
bundler_ext (0.4.1)
CFPropertyList (2.3.6, 2.2.8)
concurrent-ruby (1.0.5, 1.0.0)
did_you_mean (1.0.0)
facter (2.5.1)
faraday (0.15.0, 0.9.2)
faraday_middleware (0.12.2, 0.10.0)
fast_gettext (1.1.2)
ffi (1.9.23, 1.9.10)
gettext (3.2.9)
gettext-setup (0.30)
gssapi (1.2.0)
hiera (3.4.3)
infoblox (2.0.5)
io-console (0.4.5)
json (2.1.0, 1.8.3)
json_pure (1.8.6)
locale (2.1.2)
minitest (5.8.4)
molinillo (0.4.3)
multi_json (1.13.1)
multipart-post (2.0.0, 1.2.0)
mustermann (1.0.2)
net-http-persistent (2.9.4)
net-telnet (0.1.1)
power_assert (0.2.7)
psych (2.0.17)
puppet (5.5.1, 4.10.11)
rack (1.6.10, 1.6.4)
rack-protection (2.0.1, 1.5.5, 1.5.3)
rake (12.3.1, 10.5.0)
rake-compiler (1.0.4)
rb-inotify (0.9.10, 0.9.7)
rb-kqueue (0.2.5)
rdoc (4.2.1)
rkerberos (0.1.5, 0.1.3)
rsec (0.4.2)
ruby-augeas (0.5.0)
ruby-libvirt (0.7.1, 0.6.0)
rubyipmi (0.10.0)
sinatra (2.0.1, 1.4.8, 1.4.7)
smart_proxy_dhcp_infoblox (0.0.12)
smart_proxy_dns_infoblox (0.0.6)
test-unit (3.1.7)
text (1.3.1)
thor (0.19.1)
tilt (2.0.8, 2.0.1)
ii ruby 1:2.3.0+1
ii ruby-augeas 1:0.5.0-3build4
ii ruby-bundler 1.11.2-1
ii ruby-bundler-ext 0.4.1-1
ii ruby-concurrent 1.0.0-1
ii ruby-dev:amd64 1:2.3.0+1
ii ruby-did-you-mean 1.0.0-2
ii ruby-faraday 0.9.2-3
ii ruby-faraday-middleware 0.10.0-1
ii ruby-ffi 1.9.10debian-1build2
ii ruby-gssapi 1.2.0-1
ii ruby-json 1.8.3-1build4
ii ruby-libvirt 0.6.0-2
ii ruby-minitest 5.8.4-2
ii ruby-molinillo 0.4.3-1
ii ruby-multipart-post 1.2.0-2
ii ruby-net-http-persistent 2.9.4-1
ii ruby-net-telnet 0.1.1-2
ii ruby-power-assert 0.2.7-1
ii ruby-rack 1.6.4-3
ii ruby-rack-protection 1.5.3-2
ii ruby-rb-inotify 0.9.7-1
ii ruby-rkerberos 0.1.3-3
ii ruby-rsec 0.4.2-1
ii ruby-rubyipmi 0.10.0-1
ii ruby-sinatra 1.4.7-3
ii ruby-test-unit 3.1.7-2
ii ruby-thor 0.19.1-2
ii ruby-tilt 2.0.1-2
ii ruby2.3 2.3.1-2~16.04.9
ii ruby2.3-dev:amd64 2.3.1-2~16.04.9
ii rubygems-integration 1.10
Updated by Christian Meißner over 6 years ago
Attached you find the tarball created from foreman-debug
Updated by Andreas Grimm over 6 years ago
The solution to the problem is quite easy.
In smart_proxy_dhcp_infoblox/dhcp_infoblox_main.rb the function unused_ip is defined as:
def unused_ip(subnet, _, from_ip_address, to_ip_address)
unused_ips.unused_ip(subnet.network, from_ip_address, to_ip_address)
end
Because Ruby is not type-safe, the variable "subnet" is passed by Sinatra as a string without a problem, but must have been passed as an object in earlier versions (before our upgrade). Changing the function to
def unused_ip(subnet, _, from_ip_address, to_ip_address)
unused_ips.unused_ip(subnet, from_ip_address, to_ip_address)
end
What caused the problem in the first place is beyond my knowledge. Maybe you foreman guys can find the culprit.
Since dealing with unused_ip has changed in newer versions, i don't know if this "change request" is of any value.
Regards
Andreas
Updated by Anonymous over 6 years ago
The log you attached does't show any errors/stack traces. Could you post a snippet containing the complete stacktrace of the error you are seeing?
Updated by Christian Meißner over 6 years ago
- File full_stacktrace_20180427.log full_stacktrace_20180427.log added
- File foreman-debug-297K9.tar.xz foreman-debug-297K9.tar.xz added
Dmitri Dolguikh wrote:
The log you attached does't show any errors/stack traces. Could you post a snippet containing the complete stacktrace of the error you are seeing?
attached you find the full stacktrace and a new debug tarball.
Updated by Christian Meißner over 6 years ago
seems to have something to do with http://projects.theforeman.org/issues/23412
Updated by Anonymous over 6 years ago
seems to have something to do with http://projects.theforeman.org/issues/23412
Indeed, this is exactly the same issue. I released a new version of the gem with the fix.