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,
|
||||
'owner': config['user'],
|
||||
'mode': '0400',
|
||||
'needs': {
|
||||
'bundle:zfs',
|
||||
},
|
||||
}
|
||||
|
||||
directories[f'/srv/backups/{nodename}/backups'] = {
|
||||
'owner': config['user'],
|
||||
'mode': '0700',
|
||||
'needs': {
|
||||
'bundle:zfs',
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,9 +3,6 @@ defaults = {
|
|||
'datasets': {
|
||||
'tank/element-web': {
|
||||
'mountpoint': '/opt/element-web',
|
||||
'needed_by': {
|
||||
'directory:/opt/element-web',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -50,15 +50,9 @@ defaults = {
|
|||
'tank/gitea': {},
|
||||
'tank/gitea/home': {
|
||||
'mountpoint': '/home/git',
|
||||
'needed_by': {
|
||||
'directory:/home/git',
|
||||
},
|
||||
},
|
||||
'tank/gitea/var': {
|
||||
'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:
|
||||
directories[f'/var/www/{vhost}'] = {}
|
||||
|
||||
if node.has_bundle('zfs'):
|
||||
directories[f'/var/www/{vhost}']['needs'] = {
|
||||
'bundle:zfs',
|
||||
}
|
||||
|
||||
directories[f'/var/www/{vhost}'].update(config.get('webroot_config', {}))
|
||||
directories[f'/var/www/{vhost}'] = config.get('webroot_config', {})
|
||||
|
||||
if config.get('ssl', 'letsencrypt') == 'letsencrypt':
|
||||
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 = {
|
||||
'/etc/scanbd/scanbd.conf': {
|
||||
'triggers': {
|
||||
|
|
|
@ -119,6 +119,14 @@ class ZFSDataset(Item):
|
|||
# XXX Could be optimized by finding the "largest"
|
||||
# parent only.
|
||||
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:
|
||||
raise BundleError(_(
|
||||
|
|
Loading…
Reference in a new issue