Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DuplicateError while parsing ifcfg-ethX #2541

Closed
ubuntu-server-builder opened this issue May 10, 2023 · 4 comments
Closed

DuplicateError while parsing ifcfg-ethX #2541

ubuntu-server-builder opened this issue May 10, 2023 · 4 comments
Labels
launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1448594

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2019-02-20T11:06:00.983679+00:00
date_created = 2015-04-26T05:32:30.406553+00:00
date_fix_committed = None
date_fix_released = None
id = 1448594
importance = undecided
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1448594
milestone = None
owner = rparikh
owner_name = Roopak Parikh
private = False
status = wont_fix
submitter = rparikh
submitter_name = Roopak Parikh
tags = []
duplicates = []

Launchpad user Roopak Parikh(rparikh) wrote on 2015-04-26T05:32:30.406553+00:00

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):#12 File "/usr/lib/python2.6/site-packages/cloudinit/sources/init.py", line 243, in find_source#012 if s.get_data():#12 File "/usr/lib/python2.6/site-packages/cloudinit/sources/DataSourceConfigDrive.py", line 212, in get_data#012 self.helper.on_first_boot(results)#12 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'])#12 File "/usr/lib/python2.6/site-packages/cloudinit/distros/init.py", line 116, in apply_network#012 dev_names = self._write_network(settings)#12 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)#12 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)#12 File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel_util.py", line 153, in read_sysconfig_file#012 return (exists, SysConf(contents))#12 File "/usr/lib/python2.6/site-packages/cloudinit/distros/parsers/sys_conf.py", line 60, in init#12 write_empty_values=True)#12 File "/usr/lib/python2.6/site-packages/configobj.py", line 1219, in init#12 self._load(infile, configspec)#12 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.

@ubuntu-server-builder ubuntu-server-builder added the launchpad Migrated from Launchpad label May 10, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Roopak Parikh(rparikh) wrote on 2015-04-26T05:32:30.406553+00:00

Launchpad attachments: Screenshot for the ifcfg-ethX file

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Dan Watkins(oddbloke) wrote on 2019-02-19T16:11:13.845557+00:00

Hi Roopak,

Sorry we haven't go to this before, but we are doing bug triage now. Is this still an issue you're seeing?

Thanks!

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Roopak Parikh(rparikh) wrote on 2019-02-19T17:56:46.817671+00:00

I haven't looked at the code in the last few years, so not sure if this is fixed or not. Since no one else has complained and it was observed on the 6.x CentOS, I am ok to close it as stale entry and may not be applicable anymore.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Dan Watkins(oddbloke) wrote on 2019-02-20T11:05:53.691197+00:00

Thanks Roopak!

@ubuntu-server-builder ubuntu-server-builder closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant