2021-12-29 12:23:07 +00:00
|
|
|
from bundlewrap.exceptions import BundleError
|
|
|
|
from bundlewrap.utils.text import bold, green, yellow
|
|
|
|
from bundlewrap.utils.ui import io
|
|
|
|
|
2020-11-13 11:36:52 +00:00
|
|
|
def test_node(repo, node, **kwargs):
|
2021-02-18 14:21:27 +00:00
|
|
|
if not node.has_bundle('backup-client'):
|
2020-11-13 20:56:15 +00:00
|
|
|
return
|
|
|
|
|
2021-02-18 17:12:25 +00:00
|
|
|
if node.metadata.get('backups/exclude_from_backups', False):
|
2021-12-29 12:23:07 +00:00
|
|
|
io.stderr('{x} {node} exclude_from_backups=True'.format(
|
|
|
|
x=yellow("»"),
|
|
|
|
node=bold(node.name),
|
|
|
|
))
|
2020-11-13 20:56:15 +00:00
|
|
|
return
|
|
|
|
|
2021-12-29 12:23:07 +00:00
|
|
|
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),
|
|
|
|
))
|