Projet

Général

Profil

Révision 11bf7237

ID11bf7237333a685ccc629e0b2536a34c79a4e217
Parent 78f22811
Enfant b09d43bf

Ajouté par Steve Traylen il y a plus de 4 ans

lint_fix results

Voir les différences:

manifests/set.pp
1 1
# manage a named set
2
define nftables::set(
2
define nftables::set (
3 3
  Enum['present','absent']
4
    $ensure = 'present',
4
  $ensure = 'present',
5 5
  Pattern[/^[-a-zA-Z0-9_]+$/]
6
    $setname = $title,
6
  $setname = $title,
7 7
  Pattern[/^\d\d$/]
8
    $order = '10',
8
  $order = '10',
9 9
  Optional[Enum['ipv4_addr', 'ipv6_addr', 'ether_addr', 'inet_proto', 'inet_service', 'mark']]
10
    $type = undef,
10
  $type = undef,
11 11
  String
12
    $table = 'inet-filter',
12
  $table = 'inet-filter',
13 13
  Array[Enum['constant', 'dynamic', 'interval', 'timeout'], 0, 4]
14
    $flags = [],
14
  $flags = [],
15 15
  Optional[Integer]
16
    $timeout = undef,
16
  $timeout = undef,
17 17
  Optional[Integer]
18
    $gc_interval = undef,
18
  $gc_interval = undef,
19 19
  Optional[Array[String]]
20
    $elements = undef,
20
  $elements = undef,
21 21
  Optional[Integer]
22
    $size = undef,
22
  $size = undef,
23 23
  Optional[Enum['performance', 'memory']]
24
    $policy = undef,
24
  $policy = undef,
25 25
  Boolean
26
    $auto_merge = false,
26
  $auto_merge = false,
27 27
  Optional[String]
28
    $content = undef,
28
  $content = undef,
29 29
  Optional[Variant[String,Array[String,1]]]
30
    $source = undef,
31
){
32

  
30
  $source = undef,
31
) {
33 32
  if $size and $elements {
34 33
    if length($elements) > $size {
35 34
      fail("Max size of set ${setname} of ${size} is not being respected")
......
37 36
  }
38 37

  
39 38
  if $ensure == 'present' {
40
    concat::fragment{
39
    concat::fragment {
41 40
      "nftables-${table}-set-${setname}":
42 41
        order  => $order,
43 42
        target => "nftables-${table}",
44 43
    }
45 44

  
46 45
    if $content {
47
      Concat::Fragment["nftables-${table}-set-${setname}"]{
46
      Concat::Fragment["nftables-${table}-set-${setname}"] {
48 47
        content => "  ${content}",
49 48
      }
50 49
    } elsif $source {
51
      Concat::Fragment["nftables-${table}-set-${setname}"]{
50
      Concat::Fragment["nftables-${table}-set-${setname}"] {
52 51
        source => $source,
53 52
      }
54 53
    } else {
55 54
      if $type == undef {
56 55
        fail('The way the resource is configured must have a type set')
57 56
      }
58
      Concat::Fragment["nftables-${table}-set-${setname}"]{
57
      Concat::Fragment["nftables-${table}-set-${setname}"] {
59 58
        content => epp('nftables/set.epp',
60 59
          {
61 60
            'name'        => $setname,

Formats disponibles : Unified diff