If cloud config file has netmask as follows:
address: 150.0.0.5
netmask: 255.255.255.0 (dotted netmask)
Then cloud-init should convert this into CIDR
as follows:
address: 150.0.0.5/24
Change-Id: I4aa6ae02cbe0539b7dede667a09f66c7598c9045
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6868
Tested-by: michellew <michellew@vmware.com>
Reviewed-by: Dweep Advani <dadvani@vmware.com>
| ... | ... |
@@ -2,7 +2,7 @@ |
| 2 | 2 |
|
| 3 | 3 |
Name: cloud-init |
| 4 | 4 |
Version: 0.7.9 |
| 5 |
-Release: 14%{?dist}
|
|
| 5 |
+Release: 15%{?dist}
|
|
| 6 | 6 |
Summary: Cloud instance init scripts |
| 7 | 7 |
Group: System Environment/Base |
| 8 | 8 |
License: GPLv3 |
| ... | ... |
@@ -138,6 +138,8 @@ rm -rf $RPM_BUILD_ROOT |
| 138 | 138 |
|
| 139 | 139 |
|
| 140 | 140 |
%changelog |
| 141 |
+* Thu Mar 14 2019 Ajay Kaher <akaher@vmware.com> 0.7.9-15 |
|
| 142 |
+- Fix netmask conversion from dotted to cidr |
|
| 141 | 143 |
* Wed Feb 28 2018 Anish Swaminathan <anishs@vmware.com> 0.7.9-14 |
| 142 | 144 |
- Add support for systemd constructs for azure DS |
| 143 | 145 |
* Mon Oct 16 2017 Vinay Kulkarni <kulakrniv@vmware.com> 0.7.9-13 |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
diff -rupN cloud-init-0.7.9/cloudinit/distros/photon.py cloud-init-0.7.9-new/cloudinit/distros/photon.py |
| 2 |
-+++ cloud-init-0.7.9-new/cloudinit/distros/photon.py 2017-05-15 05:13:49.156848344 -0700 |
|
| 3 |
-@@ -0,0 +1,319 @@ |
|
| 2 |
+--- cloud-init-0.7.9/cloudinit/distros/photon.py 1970-01-01 05:30:00.000000000 +0530 |
|
| 3 |
+@@ -0,0 +1,320 @@ |
|
| 4 | 4 |
+# vi: ts=4 expandtab |
| 5 | 5 |
+# |
| 6 | 6 |
+# Copyright (C) 2017 VMware Inc. |
| ... | ... |
@@ -16,6 +16,7 @@ diff -rupN cloud-init-0.7.9/cloudinit/distros/photon.py cloud-init-0.7.9-new/clo |
| 16 | 16 |
+from cloudinit import util |
| 17 | 17 |
+from cloudinit.distros import net_util |
| 18 | 18 |
+from cloudinit.distros.parsers.hostname import HostnameConf |
| 19 |
++from cloudinit.net.network_state import mask2cidr |
|
| 19 | 20 |
+ |
| 20 | 21 |
+from cloudinit.settings import PER_INSTANCE |
| 21 | 22 |
+ |
| ... | ... |
@@ -80,7 +81,7 @@ diff -rupN cloud-init-0.7.9/cloudinit/distros/photon.py cloud-init-0.7.9-new/clo |
| 80 | 80 |
+ if info.get('address'):
|
| 81 | 81 |
+ net_cfg['Address'] = "%s" % (info.get('address'))
|
| 82 | 82 |
+ if info.get('netmask'):
|
| 83 |
-+ net_cfg['Address'] += "/%s" % (info.get('netmask'))
|
|
| 83 |
++ net_cfg['Address'] += "/%s" % (mask2cidr(info.get('netmask')))
|
|
| 84 | 84 |
+ if info.get('gateway'):
|
| 85 | 85 |
+ net_cfg['Gateway'] = info.get('gateway')
|
| 86 | 86 |
+ if info.get('dns-nameservers'):
|