Projet

Général

Profil

Révision 18ec6f48

ID18ec6f48f722a41504be0fc693cf4ab9cdbe790b
Parent e5eb7424
Enfant e4c32222, 317b8d01, ed827383, 43566263

Ajouté par tr il y a plus de 4 ans

Fix rulenames which includes an index

The rulename has a regex pattern `[/^[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(\d+)?$/]`
which allows an index at the end of the rulename (with a delimiter).
This is split later with `$data = split($rulename, '
')` but the content
of the index part is never used as a fragment. Therefor the fragment was
defined twice.
This fix will add the index to the fragment name.

Voir les différences:

manifests/rule.pp
19 19
  if $ensure == 'present' {
20 20
    $data = split($rulename, '-')
21 21

  
22
    if $data[2] {
23
      $fragment = "nftables-${table}-chain-${data[0]}-rule-${data[1]}-${data[2]}"
24
    } else {
25
      $fragment = "nftables-${table}-chain-${data[0]}-rule-${data[1]}"
26
    }
27

  
22 28
    concat::fragment{
23
      "nftables-${table}-chain-${data[0]}-rule-${data[1]}":
29
      $fragment:
24 30
        order  => $order,
25 31
        target => "nftables-${table}-chain-${data[0]}",
26 32
    }
27 33

  
28 34
    if $content {
29
      Concat::Fragment["nftables-${table}-chain-${data[0]}-rule-${data[1]}"]{
35
      Concat::Fragment[$fragment]{
30 36
        content => "  ${content}",
31 37
      }
32 38
    } else {
33
      Concat::Fragment["nftables-${table}-chain-${data[0]}-rule-${data[1]}"]{
39
      Concat::Fragment[$fragment]{
34 40
        source => $source,
35 41
      }
36 42
    }

Formats disponibles : Unified diff