Mentions légales du service

Skip to content

network_monitoring: make sure 'interfaces' always exist

Philippe Virouleau requested to merge fix-interfaces into master

When running rake gen:puppet:network_monitoring on master with up to date puppet and platforms/production repos I ran into the following error:

$ rake gen:puppet:network_monitoring 
rake aborted!
NoMethodError: undefined method `find' for nil:NilClass
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:70:in `block (4 levels) in generate_puppet_network_monitoring'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:64:in `each'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:64:in `block (3 levels) in generate_puppet_network_monitoring'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:61:in `each'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:61:in `block (2 levels) in generate_puppet_network_monitoring'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:30:in `each'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:30:in `block in generate_puppet_network_monitoring'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:17:in `each'
/home/fifi/dev/reference-repository/lib/refrepo/gen/puppet/network_monitoring.rb:17:in `generate_puppet_network_monitoring'
/home/fifi/dev/reference-repository/Rakefile:222:in `block (4 levels) in <top (required)>'
Tasks: TOP => gen:puppet:network_monitoring
(See full trace by running task with --trace)

A quick byebug inspection gave the following net_hosts_eq:

(byebug) net_hosts_eq
{"name"=>"sw-estats.toulouse.grid5000.fr", "address"=>"172.17.127.252", "has_ospf"=>false, "disabled_checks"=>["cpu_load", "hardware_health"]}

I'm not sure if this is the appropriate fix, but making sure interfaces always exist (at least with an empty array) seems to make the generation succeed.

Merge request reports

Loading