bundlewrap/bundles/nfs-server/metadata.py

32 lines
637 B
Python
Raw Normal View History

from bundlewrap.metadata import atomic
2020-11-12 18:59:02 +00:00
defaults = {
'apt': {
'packages': {
'nfs-kernel-server': {}
},
},
}
@metadata_reactor.provides(
'firewall/port_rules',
)
def firewall(metadata):
ips = set()
for share_items in metadata.get('nfs-server/shares', {}).values():
for share_target in share_items:
ips.add(share_target)
return {
'firewall': {
'port_rules': {
'111': atomic(ips),
'111/udp': atomic(ips),
'2049': atomic(ips),
'35295': atomic(ips),
},
},
}