Defined Type: interface::clsact

Defined in:
modules/interface/manifests/clsact.pp

Overview

SPDX-License-Identifier: Apache-2.0 Add clsact qdisc to any existent interface

Parameters:

  • interface (String)
  • ensure (Wmflib::Ensure) (defaults to: 'present')


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'modules/interface/manifests/clsact.pp', line 3

define interface::clsact(
    String $interface,
    Wmflib::Ensure $ensure = 'present',
) {
    $tc_add_cmd = "/usr/sbin/tc qdisc add dev ${interface} clsact"
    $tc_del_cmd = "/usr/sbin/tc qdisc del dev ${interface} clsact"

    interface::post_up_command { "clsact_${interface}":
        ensure    => $ensure,
        interface => $interface,
        command   => $tc_add_cmd,
    }

    if $ensure == 'absent' {
        exec { $tc_del_cmd:
            onlyif => "/usr/sbin/tc qdisc show dev ${interface} | grep -q clsact",
        }
    } else {
        # Add clsact manually as well
        exec { $tc_add_cmd:
            unless => "/usr/sbin/tc qdisc show dev ${interface} | grep -q clsact",
        }
    }
}