Révision e4c32222
Use concat for table conf generation
This way other components of the module will be able to add extra stuff
to the table definitions like sets.
spec/classes/ip_nat_spec.rb | ||
---|---|---|
10 | 10 |
it { is_expected.to compile } |
11 | 11 |
|
12 | 12 |
it { |
13 |
is_expected.to contain_file('/etc/nftables/puppet/ip-nat.nft').with( |
|
14 |
ensure: 'file', |
|
13 |
is_expected.to contain_concat('nftables-ip-nat').with( |
|
14 |
path: '/etc/nftables/puppet/ip-nat.nft', |
|
15 |
ensure: 'present', |
|
15 | 16 |
owner: 'root', |
16 | 17 |
group: 'root', |
17 | 18 |
mode: '0640', |
... | ... | |
19 | 20 |
} |
20 | 21 |
|
21 | 22 |
it { |
22 |
is_expected.to contain_file('/etc/nftables/puppet/ip6-nat.nft').with( |
|
23 |
ensure: 'file', |
|
23 |
is_expected.to contain_concat__fragment('nftables-ip-nat-header').with( |
|
24 |
target: 'nftables-ip-nat', |
|
25 |
content: %r{^table ip nat \{$}, |
|
26 |
order: '00', |
|
27 |
) |
|
28 |
} |
|
29 |
|
|
30 |
it { |
|
31 |
is_expected.to contain_concat__fragment('nftables-ip-nat-body').with( |
|
32 |
target: 'nftables-ip-nat', |
|
33 |
order: '98', |
|
34 |
) |
|
35 |
} |
|
36 |
|
|
37 |
it { |
|
38 |
is_expected.to contain_concat__fragment('nftables-ip-nat-footer').with( |
|
39 |
target: 'nftables-ip-nat', |
|
40 |
content: %r{^\}$}, |
|
41 |
order: '99', |
|
42 |
) |
|
43 |
} |
|
44 |
|
|
45 |
it { |
|
46 |
is_expected.to contain_concat('nftables-ip6-nat').with( |
|
47 |
path: '/etc/nftables/puppet/ip6-nat.nft', |
|
48 |
ensure: 'present', |
|
24 | 49 |
owner: 'root', |
25 | 50 |
group: 'root', |
26 | 51 |
mode: '0640', |
27 | 52 |
) |
28 | 53 |
} |
29 | 54 |
|
55 |
it { |
|
56 |
is_expected.to contain_concat__fragment('nftables-ip6-nat-header').with( |
|
57 |
target: 'nftables-ip6-nat', |
|
58 |
content: %r{^table ip6 nat \{$}, |
|
59 |
order: '00', |
|
60 |
) |
|
61 |
} |
|
62 |
|
|
63 |
it { |
|
64 |
is_expected.to contain_concat__fragment('nftables-ip6-nat-body').with( |
|
65 |
target: 'nftables-ip6-nat', |
|
66 |
order: '98', |
|
67 |
) |
|
68 |
} |
|
69 |
|
|
70 |
it { |
|
71 |
is_expected.to contain_concat__fragment('nftables-ip6-nat-footer').with( |
|
72 |
target: 'nftables-ip6-nat', |
|
73 |
content: %r{^\}$}, |
|
74 |
order: '99', |
|
75 |
) |
|
76 |
} |
|
77 |
|
|
30 | 78 |
context 'table ip nat chain prerouting' do |
31 | 79 |
it { |
32 | 80 |
is_expected.to contain_concat('nftables-ip-nat-chain-PREROUTING').with( |
Formats disponibles : Unified diff