file_block_present
Ensure that a text block is present in a specific location.
⚙️ Compatible targets: Linux
Parameters
Name | Documentation |
---|---|
path | File name to edit (absolute path on the target node). This parameter is required. |
block | Block(s) to add in the file. This parameter is required. |
Outcome conditions
You need to replace ${path}
with its actual canonified value.
- ✅ Ok:
file_block_present_${path}_ok
- ☑️ Already compliant:
file_block_present_${path}_kept
- 🟨 Repaired:
file_block_present_${path}_repaired
- ☑️ Already compliant:
- ❌ Error:
file_block_present_${path}_error
Example
method: file_block_present
params:
path: VALUE
block: VALUE
Documentation
Ensure that a text block is present in the target file. If the block is not found, it will be added at the end of the file.
Examples:
Given a file with the following content:
apple
pear
banana
Applying the method with the block:
pear
orange
Will result in the following content:
apple
pear
banana
pear
orange