voxpupuli / puppet-network

Types and providers to manage network interfaces
https://forge.puppet.com/puppet/network
Apache License 2.0
66 stars 108 forks source link

network_route Error on CentOS #66

Closed christophmerz closed 2 years ago

christophmerz commented 10 years ago

The first run of network_route on CentOS create a file in /etc/sysconfig/network-scripts with name route-eth0 with some comments and all routes I set in the manifest. The 2nd run of the puppet agent brings Notice: /Stage[main]/Servernetz::Routen/Network_route[10.0.38.0]/ensure: created Error: /Stage[main]/Servernetz::Routen/Network_route[10.0.38.0]: Could not evaluate: undefined method `[]' for nil:NilClass This for all routes and nothing changes in the file. This behave is not, if the file does not exists or if there only comments in the file. Any Idea? plugin module 0.4.1 CentOs 6.5 x86_64 Puppet 3.4.2 rubyversion 1.8.7

Regards CMe

g0xA52A2A commented 10 years ago

I also get this behavior. When performing a noop run I see that it thinks the interface value is wrong.

Notice: /Stage[main]/Network::Ethernet/Network_route[10.10.64.0/22]/interface: current_value eth4, should be eth0 (noop)

And sometimes it thinks eth10 is the current value, which does not exist on my machine.

Notice: /Stage[main]/Network::Ethernet/Network_route[10.10.64.0/22]/interface: current_value eth10, should be eth0 (noop)

Adding the --debug flag doesn't add anything too helpful as it just shows 'Prefetching redhat resources for network_route'.

Interestingly I see the following files are present. Not sure how they got there most likely from a misconfiguration in our ENC (this is a new deploy for us).

head -n 1 /etc/sysconfig/network-scripts/route*
==> /etc/sysconfig/network-scripts/route-eth10 <==
# HEADER: This file is is being managed by puppet. Changes to

==> /etc/sysconfig/network-scripts/route-eth4 <==
# HEADER: This file is is being managed by puppet. Changes to

I would assume this is the cause of the issue mentioned here https://github.com/adrienthebo/puppet-network/issues/64

To resolve this I think it should be a case of telling puppet that these files are fully managed by puppet and should be purged. As to whether this should be the module default behavior is a decision for the maintainer.

jdetroy commented 9 years ago

Hello, I've bumped into an issue today where I can't modify or delete an existing route_config. The stack trace of the puppet agent run is below

 puppet agent -t --trace
Info: Retrieving pluginfacts
Info: Retrieving plugin
....
Info: Loading facts in /var/lib/puppet/lib/facter/fact1.rb
Info: Loading facts in /var/lib/puppet/lib/facter/fact2.rb
Info: Caching catalog for host.example.com
Info: Applying configuration version '1436794390'
Notice: /Stage[main]/Routeconfig::Dmz/Network_route[10.208.0.0/12]/ensure: created
Error: /Stage[main]/Routeconfig::Dmz/Network_route[10.208.0.0/12]: Could not evaluate: undefined method `[]' for nil:NilClass
/var/lib/puppet/lib/puppet/provider/network_route/redhat.rb:20:in `select_file'
/var/lib/puppet/lib/puppetx/filemapper.rb:228:in `collect_providers_for_file'
/var/lib/puppet/lib/puppetx/filemapper.rb:227:in `select'
/var/lib/puppet/lib/puppetx/filemapper.rb:227:in `collect_providers_for_file'
/var/lib/puppet/lib/puppetx/filemapper.rb:257:in `flush_file'
/var/lib/puppet/lib/puppetx/filemapper.rb:49:in `flush'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:977:in `flush'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:24:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:174:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:187:in `eval_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:117:in `call'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:117:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:327:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:326:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:117:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/graph/relationship_graph.rb:118:in `traverse'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:108:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:167:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/util/log.rb:149:in `with_destination'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/report.rb:112:in `as_logging_destination'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:166:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:117:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:161:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:116:in `apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:191:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:20:in `lock'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:117:in `with_client'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:44:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:82:in `run_in_fork'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:43:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `call'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `controlled_run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:41:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:355:in `onetime'
/usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:321:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:371:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:477:in `plugin_hook'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:371:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:479:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:371:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:137:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:91:in `execute'
/usr/bin/puppet:8

I'm not sure it's related to this issue or another

jdetroy commented 9 years ago

Forgot to mention puppet-3.6.2-1.el6.noarch CentOS release 6.6 (Final) ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

rski commented 8 years ago

Bah, I'm running into this as well in CentOS 7, and the worst is that this fails with the second RedHat example in the README. I might look into it ~soonish

rski commented 8 years ago

A way to reproduce this:

This makes me think that there is something fishy going on when getting existing route-[dev] files

rski commented 8 years ago

Here's the line that blows up: https://github.com/voxpupuli/puppet-network/blob/master/lib/puppet/provider/network_route/redhat.rb#L22 I'll work on this a bit today