example42/puppet-network

network::mroute on CentOS 8 not applied until manual reload

olifre opened this issue ยท 13 comments

Expected Behavior

Defining a:resource:

network::mroute { 'eth0':
  routes  => $someroutes,
}

should be applied at runtime / after the Puppet run.

Actual Behavior

/etc/sysconfig/network-scripts/route-eth0 contains the correct configuration, but it is not applied (i.e. does not show up in ip route).
Manually running:

nmcli device reapply eth0

applies the routes.

Steps to Reproduce the Problem

  1. Define a resource as above on CentOS 8.
  2. Don't touch any other restart-worthy network settings.
  3. Observe in ip route that the rules are not applied.

Analysis

network::mroute currently uses $config_file_notify, which on RedHat 8 expands to nmcli connection reload. This does not reload routes.

The reload_command from network::interface, which expands to nmcli device reapply <interface> on CentOS 8, works well.

Pinging @pseiler who has contributed the most correct and complete RHEL 8 support code to this module.

Further testing revealed that on CentOS 8, indeed both commands are needed:

nmcli connection reload
nmcli device reapply <interface>

@olifre: I try to write a patch that fixes the issue next week. I already had a look at this. Putting the exec resource real_reload_command into params.pp and also trigger it should be working. The one thing I do not have a idea how to order the two exec resources. First trigger config_file_notify and then trigger real_reload_command.

@pseiler Thanks!
For the ordering, would this work?

Exec[$config_file_notify] -> Exec[$real_reload_command]

I think that if this appears at any point in the catalogue (which could be inside network::mroute close to the config_file_notify resource) the order should be ensured.

Hi @pseiler ,
just checking in to ask if you had time to look at this?
Thanks and happy new year! ๐Ÿ˜„

Hi @olifre I'm sorry that I haven't messaged you yet.
I'll try to fix this issue the next week. I'm pretty busy with work at the moment.

This should be fixed here: #338

This should be fixed here: #338

Can you elaborate how this should fix the issue with the network::mroute resource?
That resource does not use the $real_reload_command defined in the interface resource.

The issue described here is about adding a network::mroute resource for an already configured interface. As-is, that resource will only trigger $::network::manage_config_file_notify, which resolves to Exec[${service_restart_exec}] which in turn resolves to Exec[$::network::params::service_restart_exec] which does nmcli connection reload on CentOS 8 as described in the original issue report. Notably, this is missing nmcli device reapply eth0, and none of that code is touched in the linked commit, so this unrelated issue is not resolved.

@olifre oops you're right, looked at this too quickly. Please check if #339 solves this issue

@alvagante Many thanks, both for reopening and for the patch! ๐Ÿ‘
I'll give it a go latest beginning of next week, this week is quite packed (and testing network changes is always a bit finicky ;-) ).

I'm sorry it took me that long, but I tested it just now, in a completely fresh install, first done without any network::mroute resource, then adding one to the catalogue.
It applied brilliantly, so the PR indeed fixes the issue ๐Ÿ‘ . Thanks again!

Sorry for not helping in this case. I was pretty busy and didn't find time for it. Thank you very much!

@pseiler No problem, I know how real life and other work can interfere all too well โ€” luckily, #326 solves this issue well :-).