7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'modules/netconsole/manifests/client.pp', line 7
class netconsole::client (
Wmflib::Ensure $ensure = present,
Optional[String] $dev_name = undef,
Optional[Stdlib::IP::Address::V4] $local_ip = undef,
Optional[Stdlib::IP::Address::V4] $remote_ip = undef,
Optional[Stdlib::MAC] $remote_mac = undef,
) {
kmod::module { 'netconsole':
ensure => $ensure,
}
if $ensure == present {
file { '/sys/kernel/config/netconsole/target1':
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
require => Kmod::Module['netconsole'],
}
# Parameters need to be set before enabling the module. Otherwise,
# setting them fails with the following error: netconsole: target
# (target1) is enabled, disable to update parameters. Set priority
# accordingly.
sysfs::parameters { 'netconsole-params':
values => {
'kernel/config/netconsole/target1/dev_name' => $dev_name,
'kernel/config/netconsole/target1/local_ip' => $local_ip,
'kernel/config/netconsole/target1/remote_ip' => $remote_ip,
'kernel/config/netconsole/target1/remote_mac' => $remote_mac,
},
require => File['/sys/kernel/config/netconsole/target1'],
priority => 60,
}
sysfs::parameters { 'netconsole-enable':
require => Sysfs::Parameters['netconsole-params'],
priority => 70,
values => {
'kernel/config/netconsole/target1/enabled' => '1',
}
}
} else {
# netconsole needs to be disabled via sysfs before attempting module
# removal
sysfs::parameters { 'netconsole-enable':
before => Kmod::Module['netconsole'],
priority => 70,
values => {
'kernel/config/netconsole/target1/enabled' => '0',
},
}
# The configuration directory needs to be removed after the target has
# been disabled and before removing the kernel module.
file { '/sys/kernel/config/netconsole/target1':
ensure => absent,
require => Sysfs::Parameters['netconsole-enable'],
before => Kmod::Module['netconsole'],
backup => false,
force => true,
}
}
}
|