Skip to content

Commit ae03d70

Browse files
committed
cleanup unnecessary v2 code block
1 parent 02c8b8d commit ae03d70

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

cloudinit/sources/DataSourceOracle.py

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -384,42 +384,41 @@ def _add_network_config_from_opc_imds(self, set_primary: bool = False):
384384
else:
385385
network = ipaddress.ip_network(vnic_dict["subnetCidrBlock"])
386386

387-
if self._network_config["version"] == 1:
388-
if is_primary:
389-
if is_ipv6_only:
390-
subnets = [{"type": "dhcp6"}]
391-
else:
392-
subnets = [{"type": "dhcp"}]
387+
if is_primary:
388+
if is_ipv6_only:
389+
subnets = [{"type": "dhcp6"}]
393390
else:
394-
subnets = []
395-
if vnic_dict.get("privateIp"):
396-
subnets.append(
397-
{
398-
"type": "static",
399-
"address": (
400-
f"{vnic_dict['privateIp']}/"
401-
f"{network.prefixlen}"
402-
),
403-
}
404-
)
405-
if vnic_dict.get("ipv6Addresses"):
406-
subnets.append(
407-
{
408-
"type": "static",
409-
"address": (
410-
f"{vnic_dict['ipv6Addresses'][0]}/"
411-
f"{network.prefixlen}"
412-
),
413-
}
414-
)
415-
interface_config = {
416-
"name": name,
417-
"type": "physical",
418-
"mac_address": mac_address,
419-
"mtu": MTU,
420-
"subnets": subnets,
421-
}
422-
self._network_config["config"].append(interface_config)
391+
subnets = [{"type": "dhcp"}]
392+
else:
393+
subnets = []
394+
if vnic_dict.get("privateIp"):
395+
subnets.append(
396+
{
397+
"type": "static",
398+
"address": (
399+
f"{vnic_dict['privateIp']}/"
400+
f"{network.prefixlen}"
401+
),
402+
}
403+
)
404+
if vnic_dict.get("ipv6Addresses"):
405+
subnets.append(
406+
{
407+
"type": "static",
408+
"address": (
409+
f"{vnic_dict['ipv6Addresses'][0]}/"
410+
f"{network.prefixlen}"
411+
),
412+
}
413+
)
414+
interface_config = {
415+
"name": name,
416+
"type": "physical",
417+
"mac_address": mac_address,
418+
"mtu": MTU,
419+
"subnets": subnets,
420+
}
421+
self._network_config["config"].append(interface_config)
423422

424423

425424
class DataSourceOracleNet(DataSourceOracle):

0 commit comments

Comments
 (0)