Ensure that network.device type exists before using it

When passing an empty external network definition for the
undercloud, it was failing because it was assuming to have values
and a device type. Check if that exists before using it

Change-Id: I6b573485d373219d257b8c34a252d8490a4c09a0
Fixes-Bug: #1720796
This commit is contained in:
Yolanda Robla 2017-10-02 15:44:44 +02:00 committed by yolanda.robla
parent 5e1463d84a
commit 580c8ab543
1 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ echo "Please use 'single-nic-vlans' and 'bond-with-vlans'"
{% endif %}
{% for name, network in (undercloud_networks|default({})).items() if name == 'external' %}
{% if not overcloud_ipv6|bool and network.device_type == 'ovs' %}
{% if not overcloud_ipv6|bool and network.device_type is defined and network.device_type == 'ovs' %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-vlan{{ network.tag }}
DEVICE=vlan{{ network.tag }}
ONBOOT=yes
@ -62,7 +62,7 @@ EOF'
sudo ifup ifcfg-vlan{{ network.tag }}
{% elif network.device_type == 'ethernet' %}
{% elif network.device_type is defined and network.device_type == 'ethernet' %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-{{ network.device_name }}
DEVICE={{ network.device_name }}