hooks: test zfs metadata consistency
This commit is contained in:
parent
0b4f0e142f
commit
390f18a3a4
3 changed files with 55 additions and 1 deletions
|
@ -1,8 +1,22 @@
|
|||
from bundlewrap.exceptions import BundleError
|
||||
from bundlewrap.utils.text import bold, green, yellow
|
||||
from bundlewrap.utils.ui import io
|
||||
|
||||
def test_node(repo, node, **kwargs):
|
||||
if not node.has_bundle('backup-client'):
|
||||
return
|
||||
|
||||
if node.metadata.get('backups/exclude_from_backups', False):
|
||||
io.stderr('{x} {node} exclude_from_backups=True'.format(
|
||||
x=yellow("»"),
|
||||
node=bold(node.name),
|
||||
))
|
||||
return
|
||||
|
||||
assert len(node.metadata.get('backups/paths', set())) > 0, f'{node.name} has backups configured, but no backup paths defined!'
|
||||
if not len(node.metadata.get('backups/paths', set())):
|
||||
raise BundleError(f'{node.name} has backups configured, but no backup paths defined!')
|
||||
|
||||
io.stdout('{x} {node} backup metadata conforms to standards'.format(
|
||||
x=green("✓"),
|
||||
node=bold(node.name),
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue