items/zfs_dataset: add automatic dependency for all files, directories and git_deploy of a dataset
This commit is contained in:
parent
b3e322ae08
commit
1086ed28c3
6 changed files with 9 additions and 28 deletions
|
@ -14,15 +14,9 @@ for nodename, config in node.metadata.get('backup-server/clients', {}).items():
|
||||||
'content': pubkey,
|
'content': pubkey,
|
||||||
'owner': config['user'],
|
'owner': config['user'],
|
||||||
'mode': '0400',
|
'mode': '0400',
|
||||||
'needs': {
|
|
||||||
'bundle:zfs',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
directories[f'/srv/backups/{nodename}/backups'] = {
|
directories[f'/srv/backups/{nodename}/backups'] = {
|
||||||
'owner': config['user'],
|
'owner': config['user'],
|
||||||
'mode': '0700',
|
'mode': '0700',
|
||||||
'needs': {
|
|
||||||
'bundle:zfs',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,6 @@ defaults = {
|
||||||
'datasets': {
|
'datasets': {
|
||||||
'tank/element-web': {
|
'tank/element-web': {
|
||||||
'mountpoint': '/opt/element-web',
|
'mountpoint': '/opt/element-web',
|
||||||
'needed_by': {
|
|
||||||
'directory:/opt/element-web',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -50,15 +50,9 @@ defaults = {
|
||||||
'tank/gitea': {},
|
'tank/gitea': {},
|
||||||
'tank/gitea/home': {
|
'tank/gitea/home': {
|
||||||
'mountpoint': '/home/git',
|
'mountpoint': '/home/git',
|
||||||
'needed_by': {
|
|
||||||
'directory:/home/git',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
'tank/gitea/var': {
|
'tank/gitea/var': {
|
||||||
'mountpoint': '/var/lib/gitea',
|
'mountpoint': '/var/lib/gitea',
|
||||||
'needed_by': {
|
|
||||||
'directory:/var/lib/gitea',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -139,14 +139,7 @@ for vhost, config in node.metadata.get('nginx/vhosts', {}).items():
|
||||||
}
|
}
|
||||||
|
|
||||||
if not 'webroot' in config:
|
if not 'webroot' in config:
|
||||||
directories[f'/var/www/{vhost}'] = {}
|
directories[f'/var/www/{vhost}'] = config.get('webroot_config', {})
|
||||||
|
|
||||||
if node.has_bundle('zfs'):
|
|
||||||
directories[f'/var/www/{vhost}']['needs'] = {
|
|
||||||
'bundle:zfs',
|
|
||||||
}
|
|
||||||
|
|
||||||
directories[f'/var/www/{vhost}'].update(config.get('webroot_config', {}))
|
|
||||||
|
|
||||||
if config.get('ssl', 'letsencrypt') == 'letsencrypt':
|
if config.get('ssl', 'letsencrypt') == 'letsencrypt':
|
||||||
files[f'/etc/nginx/sites/{vhost}']['needs'].add('action:letsencrypt_ensure-some-certificate_{}'.format(config['domain']))
|
files[f'/etc/nginx/sites/{vhost}']['needs'].add('action:letsencrypt_ensure-some-certificate_{}'.format(config['domain']))
|
||||||
|
|
|
@ -8,11 +8,6 @@ directories = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.has_bundle('zfs'):
|
|
||||||
directories['/srv/scansnap']['needs'] = {
|
|
||||||
'bundle:zfs',
|
|
||||||
}
|
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
'/etc/scanbd/scanbd.conf': {
|
'/etc/scanbd/scanbd.conf': {
|
||||||
'triggers': {
|
'triggers': {
|
||||||
|
|
|
@ -119,6 +119,14 @@ class ZFSDataset(Item):
|
||||||
# XXX Could be optimized by finding the "largest"
|
# XXX Could be optimized by finding the "largest"
|
||||||
# parent only.
|
# parent only.
|
||||||
yield item.id
|
yield item.id
|
||||||
|
elif self.attributes.get('mountpoint'):
|
||||||
|
for item_type in ['directory', 'file', 'git_deploy']:
|
||||||
|
if (
|
||||||
|
item.ITEM_TYPE_NAME == item_type and
|
||||||
|
item.name.startswith('{}:{}'.format(item_type, self.attributes['mountpoint']))
|
||||||
|
):
|
||||||
|
yield item.id
|
||||||
|
|
||||||
|
|
||||||
if not pool_item_found:
|
if not pool_item_found:
|
||||||
raise BundleError(_(
|
raise BundleError(_(
|
||||||
|
|
Loading…
Reference in a new issue