get_ipv4_addr fails if interface has no addresses

Bug #1342448 reported by Ellen Hui
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Undecided
Ellen Hui

Bug Description

Jul 16 08:04:19 localhost systemd-nspawn[2643]: 2014-07-16 08:04:19.798 2644 INFO ironic_python_agent.agent [-] starting heartbeater
Jul 16 08:04:19 localhost systemd-nspawn[2643]: Exception in thread Thread-1:
Jul 16 08:04:19 localhost systemd-nspawn[2643]: Traceback (most recent call last):
Jul 16 08:04:19 localhost systemd-nspawn[2643]: File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
Jul 16 08:04:19 localhost systemd-nspawn[2643]: self.run()
Jul 16 08:04:19 localhost systemd-nspawn[2643]: File "/usr/local/lib/python2.7/dist-packages/ironic_python_agent/agent.py", line 73, in run
Jul 16 08:04:19 localhost systemd-nspawn[2643]: self.agent.set_agent_advertise_addr()
Jul 16 08:04:19 localhost systemd-nspawn[2643]: File "/usr/local/lib/python2.7/dist-packages/ironic_python_agent/agent.py", line 160, in set_agent_advertise_addr
Jul 16 08:04:19 localhost systemd-nspawn[2643]: found_ip = self.hardware.get_ipv4_addr(iface)
Jul 16 08:04:19 localhost systemd-nspawn[2643]: File "/usr/local/lib/python2.7/dist-packages/ironic_python_agent/hardware.py", line 177, in get_ipv4_addr
Jul 16 08:04:19 localhost systemd-nspawn[2643]: return addrs[netifaces.AF_INET][0]['addr']
Jul 16 08:04:19 localhost systemd-nspawn[2643]: KeyError: 2

ValueError and IndexError are caught and behave sanely, but not KeyError.

Ellen Hui (ellen-hui)
Changed in ironic:
assignee: nobody → Ellen Hui (ellen-hui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (master)

Fix proposed to branch: master
Review: https://review.openstack.org/107213

Changed in ironic:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (master)

Reviewed: https://review.openstack.org/107213
Committed: https://git.openstack.org/cgit/openstack/ironic-python-agent/commit/?id=5e1aa0a8f81f7ed2b7f50686ded439692ad739ad
Submitter: Jenkins
Branch: master

commit 5e1aa0a8f81f7ed2b7f50686ded439692ad739ad
Author: Ellen Hui <email address hidden>
Date: Wed Jul 16 00:28:22 2014 +0000

    Fix no IP on interface error

    Finding an IPv4 address to advertise fails and crashes if the
    interface exists but has no valid IPs. This can be fixed by
    adding KeyError to the exceptions caught.

    Change-Id: I60204427ec5201696d02c5c26f4b43a00d794413
    Closes-Bug: #1342448

Changed in ironic:
status: In Progress → Fix Committed
Changed in ironic:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: juno-2 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.