Skip to content

Commit c58a0d5

Browse files
author
Kevin Paulisse
committed
Add absent filter documentation
1 parent 2e39081 commit c58a0d5

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

doc/advanced-filter.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,66 @@ Please note that there are other options to ignore specified diffs, including:
99

1010
Here is the list of available filters and an explanation of each:
1111

12+
- [Absent file](/doc/advanced-filter.md#absent-file) - Ignore parameter changes of a file that is declared to be absent
1213
- [YAML](/doc/advanced-filter.md#yaml) - Ignore whitespace/comment differences if YAML parses to the same object
1314

15+
## Absent File
16+
17+
#### Usage
18+
19+
```
20+
--filters AbsentFile
21+
```
22+
23+
#### Description
24+
25+
When the `AbsentFile` filter is enabled, if any file is `ensure => absent` in the *new* catalog, then changes to any other parameters will be suppressed.
26+
27+
Consider that a file resource is declared as follows in two catalogs:
28+
29+
```
30+
# Old catalog
31+
file { '/etc/some-file':
32+
ensure => present,
33+
owner => 'root',
34+
group => 'nobody',
35+
content => 'my content here',
36+
}
37+
38+
# New catalog
39+
file { '/etc/some-file':
40+
ensure => absent,
41+
owner => 'bob',
42+
}
43+
```
44+
45+
Since the practical effect of the new catalog will be to remove the file, it doesn't matter that the owner of the (non-existent) file has changed from 'root' to 'bob', or that the content has changed from a string to undefined.
46+
47+
Now consider the default output without the filter:
48+
49+
```
50+
File[/etc/some-file] =>
51+
parameters =>
52+
ensure =>
53+
- present
54+
+ absent
55+
owner =>
56+
- root
57+
+ bob
58+
content =>
59+
- my content here
60+
```
61+
62+
And the output with `--filter AbsentFile`:
63+
64+
```
65+
File[/etc/some-file] =>
66+
parameters =>
67+
ensure =>
68+
- present
69+
+ absent
70+
```
71+
1472
## YAML
1573

1674
#### Usage

0 commit comments

Comments
 (0)