Skip to main content

containsOnly

Check that all elements in an array are from an allowlist. Returns true if no other values appear.


Examples

Ensure only root and shadow groups own /etc/gshadow:

["/etc/gshadow"].where(file(_).exists) {
file(_) {
group.name.lines.containsOnly(["root","shadow"])
}
}