This fixes the access to a non-exisiting key.
There is another bug that is causing this in LCM (bug 1431).
Change-Id: Ied80beb56657ead95eefa9ed967eca84e623f9c3
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
"ip_version": "IPv4" if "v4" in ip_profile.get("ip-version", "ipv4") else "IPv6",
"subnet_address": ip_profile.get("subnet-address"),
"gateway_address": ip_profile.get("gateway-address"),
"ip_version": "IPv4" if "v4" in ip_profile.get("ip-version", "ipv4") else "IPv6",
"subnet_address": ip_profile.get("subnet-address"),
"gateway_address": ip_profile.get("gateway-address"),
- "dhcp_enabled": ip_profile["dhcp-params"].get("enabled", True),
- "dhcp_start_address": ip_profile["dhcp-params"].get("start-address"),
- "dhcp_count": ip_profile["dhcp-params"].get("count"),
-
+ "dhcp_enabled": ip_profile["dhcp-params"].get("enabled", True)
+ if "dhcp_params" in ip_profile else False,
+ "dhcp_start_address": ip_profile["dhcp-params"].get("start-address")
+ if "dhcp_params" in ip_profile else None,
+ "dhcp_count": ip_profile["dhcp-params"].get("count") if "dhcp_params" in ip_profile else None,
}
if ip_profile.get("dns-server"):
ro_ip_profile["dns_address"] = ";".join([v["address"] for v in ip_profile["dns-server"]])
}
if ip_profile.get("dns-server"):
ro_ip_profile["dns_address"] = ";".join([v["address"] for v in ip_profile["dns-server"]])