yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #32390
[Bug 1448594] [NEW] DuplicateError while parsing ifcfg-ethX
Public bug reported:
I have a VirtualMachine image (Scientific Linux 6.4) which has a static IP address assigned to it. Using Openstack and using 'config-drive' we tried to boot a new VirtualMachine from that image, config-drive, the ISO contains a new 'static-ip' address. Cloud-init recognizes that and tries to read the existing /etc/sysconfig/network-scripts/ifcfg-eth0 and fails with the following error:
---
Apr 24 18:04:13 rparikh-sl6-w-cloud-init [CLOUDINIT] util.py[DEBUG]:
Getting data from <class
'cloudinit.sources.DataSourceConfigDrive.DataSourceConfigDrive'>
failed#012Traceback (most recent call last):#012 File
"/usr/lib/python2.6/site-packages/cloudinit/sources/__init__.py", line
243, in find_source#012 if s.get_data():#012 File
"/usr/lib/python2.6/site-
packages/cloudinit/sources/DataSourceConfigDrive.py", line 212, in
get_data#012 self.helper.on_first_boot(results)#012 File
"/usr/lib/python2.6/site-
packages/cloudinit/sources/DataSourceConfigDrive.py", line 54, in
on_first_boot#012
self.distro.apply_network(data['network_config'])#012 File
"/usr/lib/python2.6/site-packages/cloudinit/distros/__init__.py", line
116, in apply_network#012 dev_names =
self._write_network(settings)#012 File "/usr/lib/python2.6/site-
packages/cloudinit/distros/rhel.py", line 85, in _write_network#012
rhel_util.update_sysconfig_file(net_fn, net_cfg)#012 File
"/usr/lib/python2.6/site-packages/cloudinit/distros/rhel_util.py", line
125, in update_sysconfig_file#012 (exists, contents) =
read_sysconfig_file(fn)#012 File "/usr/lib/python2.6/site-
packages/cloudinit/distros/rhel_util.py", line 153, in
read_sysconfig_file#012 return (exists, SysConf(contents))#012 File
"/usr/lib/python2.6/site-
packages/cloudinit/distros/parsers/sys_conf.py", line 60, in
__init__#012 write_empty_values=True)#012 File "/usr/lib/python2.6
/site-packages/configobj.py", line 1219, in __init__#012
self._load(infile, configspec)#012 File "/usr/lib/python2.6/site-
packages/configobj.py", line 1302, in _load#012 raise
error#012DuplicateError: Duplicate keyword name at line 24.
-----
The problem seems to be duplicate keys in the ifcfg-eth0, we can try and
fix this image, but there are probably others with the same settings and
in general I would assume parsing should be resilient to these failures.
In addition I am not sure if I understand the logic behind reading the
current ifcfg and modifying it, we should be able to simplify it by
overwriting (a backup can be taken for debugging purposes) the ifcfg
file.
Attached is a screenshot with contents of the ifcfg file.
** Affects: cloud-init
Importance: Undecided
Status: New
** Attachment added: "Screenshot for the ifcfg-ethX file"
https://bugs.launchpad.net/bugs/1448594/+attachment/4384372/+files/Screen%20Shot%202015-04-25%20at%2010.21.41%20PM.png
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1448594
Title:
DuplicateError while parsing ifcfg-ethX
Status in Init scripts for use on cloud images:
New
Bug description:
I have a VirtualMachine image (Scientific Linux 6.4) which has a static IP address assigned to it. Using Openstack and using 'config-drive' we tried to boot a new VirtualMachine from that image, config-drive, the ISO contains a new 'static-ip' address. Cloud-init recognizes that and tries to read the existing /etc/sysconfig/network-scripts/ifcfg-eth0 and fails with the following error:
---
Apr 24 18:04:13 rparikh-sl6-w-cloud-init [CLOUDINIT] util.py[DEBUG]:
Getting data from <class
'cloudinit.sources.DataSourceConfigDrive.DataSourceConfigDrive'>
failed#012Traceback (most recent call last):#012 File
"/usr/lib/python2.6/site-packages/cloudinit/sources/__init__.py", line
243, in find_source#012 if s.get_data():#012 File
"/usr/lib/python2.6/site-
packages/cloudinit/sources/DataSourceConfigDrive.py", line 212, in
get_data#012 self.helper.on_first_boot(results)#012 File
"/usr/lib/python2.6/site-
packages/cloudinit/sources/DataSourceConfigDrive.py", line 54, in
on_first_boot#012
self.distro.apply_network(data['network_config'])#012 File
"/usr/lib/python2.6/site-packages/cloudinit/distros/__init__.py", line
116, in apply_network#012 dev_names =
self._write_network(settings)#012 File "/usr/lib/python2.6/site-
packages/cloudinit/distros/rhel.py", line 85, in _write_network#012
rhel_util.update_sysconfig_file(net_fn, net_cfg)#012 File
"/usr/lib/python2.6/site-packages/cloudinit/distros/rhel_util.py",
line 125, in update_sysconfig_file#012 (exists, contents) =
read_sysconfig_file(fn)#012 File "/usr/lib/python2.6/site-
packages/cloudinit/distros/rhel_util.py", line 153, in
read_sysconfig_file#012 return (exists, SysConf(contents))#012
File "/usr/lib/python2.6/site-
packages/cloudinit/distros/parsers/sys_conf.py", line 60, in
__init__#012 write_empty_values=True)#012 File "/usr/lib/python2.6
/site-packages/configobj.py", line 1219, in __init__#012
self._load(infile, configspec)#012 File "/usr/lib/python2.6/site-
packages/configobj.py", line 1302, in _load#012 raise
error#012DuplicateError: Duplicate keyword name at line 24.
-----
The problem seems to be duplicate keys in the ifcfg-eth0, we can try
and fix this image, but there are probably others with the same
settings and in general I would assume parsing should be resilient to
these failures. In addition I am not sure if I understand the logic
behind reading the current ifcfg and modifying it, we should be able
to simplify it by overwriting (a backup can be taken for debugging
purposes) the ifcfg file.
Attached is a screenshot with contents of the ifcfg file.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1448594/+subscriptions
Follow ups
References