Disable NetworkManager by default
Add the possibility to use NetworkManager or not, but disabled by default.
It is not recommended because it leads to unpredictable behaviour.
Change-Id: I8e080fd5e4ceac9e2e26dafdf50e7f11fb6c8f04
Closes-bug: #1538757
(cherry picked from commit 3f732b2426
)
This commit is contained in:
parent
af8b5f7b3d
commit
0b2294dc58
|
@ -25,6 +25,12 @@
|
|||
# (optional) Enables to disable hotplug system temporarily during network configuration
|
||||
# Defaults to true
|
||||
#
|
||||
# [*network_manager*]
|
||||
# (optional) Specify whether to use NetworkManager or not.
|
||||
# It is not recommended to use NetworkManager and this module because it leads
|
||||
# to unpredictable behaviour
|
||||
# Defaults to false
|
||||
|
||||
class l23network (
|
||||
$ensure_package = 'present',
|
||||
$use_lnx = true,
|
||||
|
@ -39,6 +45,7 @@ class l23network (
|
|||
$ovs_datapath_package_name = undef,
|
||||
$ovs_common_package_name = undef,
|
||||
$disable_hotplug = true,
|
||||
$network_manager = false,
|
||||
){
|
||||
|
||||
include stdlib
|
||||
|
@ -91,6 +98,24 @@ class l23network (
|
|||
Anchor['l23network::l2::init'] -> Anchor['l23network::init']
|
||||
anchor { 'l23network::init': }
|
||||
|
||||
unless $network_manager {
|
||||
package{$::l23network::params::network_manager_name:
|
||||
ensure => 'purged',
|
||||
}
|
||||
Package[$::l23network::params::network_manager_name] -> Anchor['l23network::init']
|
||||
|
||||
# It is not enough to just remove package, we have to stop the service as well.
|
||||
# Because SystemD continues running the service after package removing,
|
||||
# with Upstart - all is ok.
|
||||
if $::l23_os =~ /(?i:redhat7|centos7)/ {
|
||||
service{$::l23network::params::network_manager_name:
|
||||
ensure => 'stopped',
|
||||
}
|
||||
Package[$::l23network::params::network_manager_name] ~> Service[$::l23network::params::network_manager_name]
|
||||
Service[$::l23network::params::network_manager_name] -> Anchor['l23network::init']
|
||||
}
|
||||
}
|
||||
|
||||
if $disable_hotplug {
|
||||
disable_hotplug { 'global':
|
||||
ensure => 'present',
|
||||
|
|
|
@ -16,6 +16,7 @@ class l23network::params {
|
|||
$ovs_datapath_package_name = 'openvswitch-datapath-dkms'
|
||||
$ovs_common_package_name = 'openvswitch-switch'
|
||||
$ovs_kern_module_name = 'openvswitch'
|
||||
$network_manager_name = 'network-manager'
|
||||
$extra_tools = 'iputils-arping'
|
||||
}
|
||||
/(?i:redhat|centos)/: {
|
||||
|
@ -30,6 +31,7 @@ class l23network::params {
|
|||
$ovs_datapath_package_name = 'kmod-openvswitch'
|
||||
$ovs_common_package_name = 'openvswitch'
|
||||
$ovs_kern_module_name = 'openvswitch'
|
||||
$network_manager_name = 'NetworkManager'
|
||||
$extra_tools = 'iputils'
|
||||
}
|
||||
/(?i)darwin/: {
|
||||
|
|
|
@ -2,8 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe 'l23network', :type => :class do
|
||||
|
||||
context 'default init of l23network module' do
|
||||
# let(:title) { 'empty network scheme' }
|
||||
context 'default init of l23network module(Ubuntu)' do
|
||||
let(:facts) { {
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
|
@ -25,6 +24,7 @@ describe 'l23network', :type => :class do
|
|||
should contain_package('ethtool').with_ensure('present')
|
||||
should contain_package('ifenslave').with_ensure('present')
|
||||
should contain_package('vlan').with_ensure('present')
|
||||
should contain_package('network-manager').with_ensure('purged')
|
||||
should contain_anchor('l23network::l2::init').that_comes_before('Anchor[l23network::init]')
|
||||
should contain_anchor('l23network::l2::init').that_requires('Package[vlan]')
|
||||
should contain_anchor('l23network::l2::init').that_requires('Package[ifenslave]')
|
||||
|
@ -32,6 +32,62 @@ describe 'l23network', :type => :class do
|
|||
end
|
||||
end
|
||||
|
||||
context 'default init of l23network module(CentOS6)' do
|
||||
let(:facts) { {
|
||||
:operatingsystem => 'CentOS',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'centos6',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
} }
|
||||
|
||||
before(:each) do
|
||||
puppet_debug_override()
|
||||
end
|
||||
|
||||
it do
|
||||
should compile.with_all_deps
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_package('bridge-utils').with_ensure('present')
|
||||
should contain_package('ethtool').with_ensure('present')
|
||||
should_not contain_package('ifenslave').with_ensure('present')
|
||||
should_not contain_package('vlan').with_ensure('present')
|
||||
should contain_package('NetworkManager').with_ensure('purged')
|
||||
should_not contain_service('NetworkManager').with_ensure('stopped')
|
||||
should contain_anchor('l23network::l2::init').that_comes_before('Anchor[l23network::init]')
|
||||
should contain_anchor('l23network::l2::init').that_requires('Package[ethtool]')
|
||||
end
|
||||
end
|
||||
|
||||
context 'default init of l23network module(CentOS7/RHEL7)' do
|
||||
let(:facts) { {
|
||||
:operatingsystem => 'CentOS',
|
||||
:kernel => 'Linux',
|
||||
:l23_os => 'centos7',
|
||||
:l3_fqdn_hostname => 'stupid_hostname',
|
||||
} }
|
||||
|
||||
before(:each) do
|
||||
puppet_debug_override()
|
||||
end
|
||||
|
||||
it do
|
||||
should compile.with_all_deps
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_package('bridge-utils').with_ensure('present')
|
||||
should contain_package('ethtool').with_ensure('present')
|
||||
should_not contain_package('ifenslave').with_ensure('present')
|
||||
should_not contain_package('vlan').with_ensure('present')
|
||||
should contain_package('NetworkManager').with_ensure('purged')
|
||||
should contain_service('NetworkManager').with_ensure('stopped')
|
||||
should contain_anchor('l23network::l2::init').that_comes_before('Anchor[l23network::init]')
|
||||
should contain_anchor('l23network::l2::init').that_requires('Package[ethtool]')
|
||||
end
|
||||
end
|
||||
|
||||
context 'init l23network module with enabled OVS' do
|
||||
#let(:title) { 'empty network scheme' }
|
||||
let(:facts) { {
|
||||
|
|
Loading…
Reference in New Issue