36 lines
795 B
Python
36 lines
795 B
Python
from bundlewrap.metadata import atomic
|
|
|
|
defaults = {
|
|
'apt': {
|
|
'packages': {
|
|
'nfs-server': {
|
|
'needed_by': {
|
|
'svc_systemd:nfs-kernel-server',
|
|
'action:nfs_reload_shares',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
@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),
|
|
},
|
|
},
|
|
}
|