Skip to content
Snippets Groups Projects
Unverified Commit 739d1194 authored by Alessandro Franceschi's avatar Alessandro Franceschi
Browse files

Fix #326 and set for network::mroute per interface reload by default

parent 1c8349a8
Branches
Tags
No related merge requests found
...@@ -42,10 +42,23 @@ ...@@ -42,10 +42,23 @@
# [*config_file_notify*] # [*config_file_notify*]
# String. Optional. Default: 'class_default' # String. Optional. Default: 'class_default'
# Defines the notify argument of the created file. # Defines the notify argument of the created file.
# The default special value implies the same behaviour of the main class # The default special value uses the combination of the restart_all_nic and
# configuration file. Set to undef to remove any notify, or set # reload_command options. Set to undef to remove any notify, or set
# the name(s) of the resources to notify # the name(s) of the resources to notify
# #
# [*restart_all_nic*]
# Boolean. Default: false
# Manages the way to apply interface creation/modification:
# - If true, will trigger a restart of all network interfaces
# - If false, will only start/restart this specific interface
#
# [*reload_command*]
# String. Default: $::operatingsystem ? {
# 'CumulusLinux' => 'ifreload -a',
# default => "ifdown ${interface}; ifup ${interface}",
# }
# Defines the command(s) that will be used to reload a nic when restart_all_nic
# is set to false
# #
# === Actions: # === Actions:
# #
...@@ -62,6 +75,8 @@ define network::mroute ( ...@@ -62,6 +75,8 @@ define network::mroute (
$routes, $routes,
$interface = $name, $interface = $name,
$config_file_notify = 'class_default', $config_file_notify = 'class_default',
$restart_all_nic = false,
$reload_command = undef,
$ensure = 'present', $ensure = 'present',
$route_up_template = undef, $route_up_template = undef,
$route_down_template = undef, $route_down_template = undef,
...@@ -71,9 +86,30 @@ define network::mroute ( ...@@ -71,9 +86,30 @@ define network::mroute (
validate_hash($routes) validate_hash($routes)
include ::network include ::network
$real_reload_command = $reload_command ? {
undef => $::operatingsystem ? {
'CumulusLinux' => 'ifreload -a',
'RedHat' => $::operatingsystemmajrelease ? {
'8' => "/usr/bin/nmcli con reload ; /usr/bin/nmcli device reapply ${interface}",
default => "ifdown ${interface} --force ; ifup ${interface}",
},
default => "ifdown ${interface} --force ; ifup ${interface}",
},
default => $reload_command,
}
if $restart_all_nic == false and $::kernel == 'Linux' {
exec { "network_restart_${name}":
command => $real_reload_command,
path => '/sbin:/bin:/usr/sbin:/usr/bin',
refreshonly => true,
}
$network_notify = "Exec[network_restart_${name}]"
} else {
$network_notify = $network::manage_config_file_notify
}
$real_config_file_notify = $config_file_notify ? { $real_config_file_notify = $config_file_notify ? {
'class_default' => $::network::manage_config_file_notify, 'class_default' => $network_notify,
default => $config_file_notify, default => $config_file_notify,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment