diff --git a/packstack/modules/common.py b/packstack/modules/common.py index 0a95cbbba..a608a4045 100644 --- a/packstack/modules/common.py +++ b/packstack/modules/common.py @@ -77,12 +77,13 @@ def cidr_to_ifname(cidr, host, config): for interface in info['interfaces'].split(','): interface = interface.strip() - ipaddr = info['ipaddress_{}'.format(interface)] - netmask = info['netmask_{}'.format(interface)] - subnet_b = netaddr.IPNetwork('{ipaddr}/{netmask}'.format(**locals())) - if subnet_a == subnet_b: - translated.append(interface) - break + ipaddr = info.get('ipaddress_{}'.format(interface)) + netmask = info.get('netmask_{}'.format(interface)) + if ipaddr and netmask: + subnet_b = netaddr.IPNetwork('{ipaddr}/{netmask}'.format(**locals())) + if subnet_a == subnet_b: + translated.append(interface) + break result.append(':'.join(translated)) return ','.join(result) diff --git a/packstack/puppet/modules/packstack/lib/puppet/parser/functions/force_interface.rb b/packstack/puppet/modules/packstack/lib/puppet/parser/functions/force_interface.rb index a52556b3a..a958b9dbb 100644 --- a/packstack/puppet/modules/packstack/lib/puppet/parser/functions/force_interface.rb +++ b/packstack/puppet/modules/packstack/lib/puppet/parser/functions/force_interface.rb @@ -30,6 +30,9 @@ module Puppet::Parser::Functions lookupvar('interfaces').split(',').each do |interface| interface.strip! ifaddr = lookupvar("ipaddress_#{interface}") + if ifaddr == nil + next + end ifcidr = IPAddr.new ifaddr if cidr.include?(ifcidr) translated.push(interface)