Page MenuHomePhabricator
Paste P42721

(An Untitled Masterwork)
ActivePublic

Authored by jbond on Dec 16 2022, 2:42 PM.
Tags
None
Referenced Files
F35870222: raw-paste-data.txt
Dec 16 2022, 2:42 PM
Subscribers
None
# this is a different way of using directtion string mention in other comment
$_direction = ($direction == 'in').bool2str('s','d')
$proto_str = $proto.then |$x| { "proto ${proto}" }
$port_str = $port.then |$x| { "${_direction}port ${port}" }
$addr_str = $addr.then |$x| { "${_direction}addr ${addr}" }
$match_str = $match_dscp.then |$x| { "mod dscp dscp-class ${match_dscp}" }
$dcsp = ferm::qos2dscp($qos)
$rule = "${proto_str} ${port_str} ${addr_str} ${match_str} SCP set-dscp-class ${dcsp};"
ferm::rule { $title: # will probably need a better title
ensure => present,
domain => $domain, # we shuld make the other patch i mentioned directly to ferm::rule
table => 'mangle',
chain => 'OUTPUT',
desc => $desc,
prio => $prio,
}