bundles/dhcpd: remove some .get()
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
ad569f073e
commit
d5bca495e0
2 changed files with 5 additions and 4 deletions
|
@ -2,7 +2,7 @@ files = {
|
|||
'/etc/dhcp/dhcpd.conf': {
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
'dhcp_config': node.metadata.get('dhcpd'),
|
||||
'dhcp_config': node.metadata['dhcpd'],
|
||||
},
|
||||
'needs': {
|
||||
'pkg_apt:isc-dhcp-server'
|
||||
|
@ -14,7 +14,8 @@ files = {
|
|||
'/etc/default/isc-dhcp-server': {
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
'listen_interfaces': node.metadata.get('dhcpd', {}).get('listen_interfaces'),
|
||||
# Set by our own metadata reactor. Guaranteed to exist.
|
||||
'listen_interfaces': node.metadata['dhcpd']['listen_interfaces'],
|
||||
},
|
||||
'needs': {
|
||||
'pkg_apt:isc-dhcp-server'
|
||||
|
|
|
@ -28,7 +28,7 @@ def get_static_allocations(metadata):
|
|||
def get_listen_interfaces(metadata):
|
||||
listen_interfaces = []
|
||||
for identfier, subnet in node.metadata.get('dhcpd/subnets', {}).items():
|
||||
listen_interfaces.append(subnet.get('interface'))
|
||||
listen_interfaces.append(subnet['interface'])
|
||||
|
||||
return {
|
||||
'dhcpd': {
|
||||
|
@ -41,7 +41,7 @@ def get_listen_interfaces(metadata):
|
|||
def iptables(metadata):
|
||||
iptables = set()
|
||||
for identfier, subnet in node.metadata.get('dhcpd/subnets', {}).items():
|
||||
iptables.add('iptables -A INPUT -i {} -p udp --dport 67:68 -j ACCEPT'.format(subnet.get('interface')))
|
||||
iptables.add('iptables -A INPUT -i {} -p udp --dport 67:68 -j ACCEPT'.format(subnet['interface']))
|
||||
|
||||
return {
|
||||
'iptables': {
|
||||
|
|
Loading…
Reference in a new issue