← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~pengpengs/cloud-init:fix/vmware-gosc-fail-with-staticIP-and-no-gateway into cloud-init:master

 

Pengpeng Sun has proposed merging ~pengpengs/cloud-init:fix/vmware-gosc-fail-with-staticIP-and-no-gateway into cloud-init:master.

Commit message:
Fix an issue when do VMware customization on a VM with static IPv4 and without gateway.

The issue is when customize a VM with static IPv4 and without gateway, it will still extend route list and will loop a gateways list which is None.
This fix is to make sure when no gateway is here, it will not extend route list.

LP: #1766538

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1766538 in cloud-init (Ubuntu): "network customization with cloud-init does not work on Ubuntu18.04 Beta2 Server"
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1766538

For more details, see:
https://code.launchpad.net/~pengpengs/cloud-init/+git/cloud-init/+merge/353303
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~pengpengs/cloud-init:fix/vmware-gosc-fail-with-staticIP-and-no-gateway into cloud-init:master.
diff --git a/cloudinit/sources/helpers/vmware/imc/config_nic.py b/cloudinit/sources/helpers/vmware/imc/config_nic.py
index 3ef8c62..e1890e2 100644
--- a/cloudinit/sources/helpers/vmware/imc/config_nic.py
+++ b/cloudinit/sources/helpers/vmware/imc/config_nic.py
@@ -164,7 +164,7 @@ class NicConfigurator(object):
             return ([subnet], route_list)
 
         # Add routes if there is no primary nic
-        if not self._primaryNic:
+        if not self._primaryNic and v4.gateways:
             route_list.extend(self.gen_ipv4_route(nic,
                                                   v4.gateways,
                                                   v4.netmask))

Follow ups