Comment 1 for bug 1684349

Andreas Karis (akaris) wrote :

With the above modification of 'print subnets', I ran this twice:

[root@rhel2 ~]# vi /usr/lib/python2.7/site-packages/cloudinit/net/network_state.py
[root@rhel2 ~]# rm -Rf /var/lib/cloud/data/* ; cloud-init --force init
Cloud-init v. 0.7.9 running 'init' at Fri, 21 Apr 2017 20:59:09 +0000. Up 101437.95 seconds.
ci-info: +++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++
ci-info: +---------+------+--------------+---------------+-------+-------------------+
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +---------+------+--------------+---------------+-------+-------------------+
ci-info: | eth0:0: | True | 192.168.0.11 | 255.255.255.0 | . | fa:16:3e:cc:06:c3 |
ci-info: | eth1: | True | . | . | . | fa:16:3e:8a:1f:f4 |
ci-info: | eth1: | True | . | . | d | fa:16:3e:8a:1f:f4 |
ci-info: | eth2: | True | . | . | . | fa:16:3e:78:c2:39 |
ci-info: | eth2: | True | . | . | d | fa:16:3e:78:c2:39 |
ci-info: | eth0: | True | . | . | . | fa:16:3e:cc:06:c3 |
ci-info: | eth0: | True | . | . | d | fa:16:3e:cc:06:c3 |
ci-info: | eth3: | True | . | . | . | fa:16:3e:3b:76:55 |
ci-info: | eth3: | True | . | . | d | fa:16:3e:3b:76:55 |
ci-info: | lo: | True | 127.0.0.1 | 255.0.0.0 | . | . |
ci-info: | lo: | True | . | . | d | . |
ci-info: | eth2:0: | True | 10.0.0.106 | 255.255.255.0 | . | fa:16:3e:78:c2:39 |
ci-info: +---------+------+--------------+---------------+-------+-------------------+
ci-info: ++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: | 0 | 0.0.0.0 | 10.0.0.250 | 0.0.0.0 | eth2 | UG |
ci-info: | 1 | 10.0.0.0 | 0.0.0.0 | 255.255.255.0 | eth2 | U |
ci-info: | 2 | 192.168.0.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
[{u'routes': [{u'netmask': u'0.0.0.0', u'network': u'0.0.0.0', u'gateway': u'192.168.0.1'}], u'netmask': u'255.255.255.0', u'type': 'static', 'ipv4': True, 'address': u'192.168.0.11'}, {u'routes': [{u'netmask': u'::', u'network': u'::', u'gateway': u'2000:192:168::1'}], u'netmask': u'ffff:ffff:ffff:ffff::', 'address': u'2000:192:168::5', u'type': 'static', 'ipv6': True}]
[{u'routes': [{u'netmask': u'::', u'network': u'::', u'gateway': u'2000:172:20::1'}], u'netmask': u'ffff:ffff:ffff:ffff::', 'address': u'2000:172:20::4', u'type': 'static', 'ipv6': True}]
[{u'routes': [{u'netmask': u'0.0.0.0', u'network': u'0.0.0.0', u'gateway': u'10.0.0.250'}], u'netmask': u'255.255.255.0', u'type': 'static', 'ipv4': True, 'address': u'10.0.0.106'}, {u'routes': [{u'netmask': u'::', u'network': u'::', u'gateway': u'2000:10::250'}], u'netmask': u'ffff:ffff:ffff:ffff::', 'address': u'2000:10::1', u'type': 'static', 'ipv6': True}]
[{u'type': 'dhcp4'}, {u'routes': [{u'netmask': u'::', u'network': u'::', u'gateway': u'2000:10::250'}], u'netmask': u'ffff:ffff:ffff:ffff::', 'address': u'2000:123::2', u'type': 'static', 'ipv6': True}]
[root@rhel2 ~]# rm -Rf /var/lib/cloud/data/* ; cloud-init --force init
Cloud-init v. 0.7.9 running 'init' at Fri, 21 Apr 2017 20:59:34 +0000. Up 101463.22 seconds.
ci-info: +++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++
ci-info: +---------+------+--------------+---------------+-------+-------------------+
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +---------+------+--------------+---------------+-------+-------------------+
ci-info: | eth0:0: | True | 192.168.0.11 | 255.255.255.0 | . | fa:16:3e:cc:06:c3 |
ci-info: | eth1: | True | . | . | . | fa:16:3e:8a:1f:f4 |
ci-info: | eth1: | True | . | . | d | fa:16:3e:8a:1f:f4 |
ci-info: | eth2: | True | . | . | . | fa:16:3e:78:c2:39 |
ci-info: | eth2: | True | . | . | d | fa:16:3e:78:c2:39 |
ci-info: | eth0: | True | . | . | . | fa:16:3e:cc:06:c3 |
ci-info: | eth0: | True | . | . | d | fa:16:3e:cc:06:c3 |
ci-info: | eth3: | True | . | . | . | fa:16:3e:3b:76:55 |
ci-info: | eth3: | True | . | . | d | fa:16:3e:3b:76:55 |
ci-info: | lo: | True | 127.0.0.1 | 255.0.0.0 | . | . |
ci-info: | lo: | True | . | . | d | . |
ci-info: | eth2:0: | True | 10.0.0.106 | 255.255.255.0 | . | fa:16:3e:78:c2:39 |
ci-info: +---------+------+--------------+---------------+-------+-------------------+
ci-info: ++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
ci-info: | 0 | 0.0.0.0 | 10.0.0.250 | 0.0.0.0 | eth2 | UG |
ci-info: | 1 | 10.0.0.0 | 0.0.0.0 | 255.255.255.0 | eth2 | U |
ci-info: | 2 | 192.168.0.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
2017-04-21 16:59:34,937 - util.py[WARNING]: failed stage init
failed run of stage init
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 513, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 269, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 641, in apply_network_config
    return self.distro.apply_network_config(netcfg, bring_up=bring_up)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/__init__.py", line 150, in apply_network_config
    dev_names = self._write_network_config(netconfig)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/rhel.py", line 59, in _write_network_config
    ns = parse_net_config_data(netconfig)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 32, in parse_net_config_data
    nsi.parse_config(skip_broken=skip_broken)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 205, in parse_config
    handler(self, command)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 78, in decorator
    return func(self, command, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 239, in handle_physical
    subnet['netmask'] = mask2cidr(subnet['netmask'])
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 439, in mask2cidr
    if ':' in mask:
TypeError: argument of type 'int' is not iterable
------------------------------------------------------------
[{u'routes': [{u'netmask': u'0.0.0.0', u'network': u'0.0.0.0', u'gateway': u'192.168.0.1'}], u'netmask': u'255.255.255.0', u'type': 'static', 'ipv4': True, 'address': u'192.168.0.11'}, {u'routes': [{u'netmask': 0, u'network': u'::', u'gateway': u'2000:192:168::1'}], u'netmask': 64, 'ipv6': True, u'type': 'static', 'address': u'2000:192:168::5'}]
[root@rhel2 ~]#

Note that the netmask changed:
 u'ffff:ffff:ffff:ffff::', 'address': u'2000:192:168::5'
vs
u'netmask': 64, 'ipv6': True, u'type': 'static', 'address': u'2000:192:168::5'