pyudev 0.18 changed exception for from_device_file, breaking backward compatibility (and IPA unit tests)

Bug #1522756 reported by Dmitry Tantsur
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ironic-python-agent
Fix Released
Critical
Dmitry Tantsur

Bug Description

Unit tests for IPA are now failing with:

FAIL: ironic_python_agent.tests.unit.test_hardware.TestGenericHardwareManager.test_get_os_install_device
2015-12-03 17:24:22.826 | tags: worker-3
2015-12-03 17:24:22.827 | ----------------------------------------------------------------------
2015-12-03 17:24:22.827 | Empty attachments:
2015-12-03 17:24:22.827 | stderr
2015-12-03 17:24:22.827 | stdout
2015-12-03 17:24:22.827 |
2015-12-03 17:24:22.827 | Traceback (most recent call last):
2015-12-03 17:24:22.827 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
2015-12-03 17:24:22.827 | return func(*args, **keywargs)
2015-12-03 17:24:22.827 | File "ironic_python_agent/tests/unit/test_hardware.py", line 289, in test_get_os_install_device
2015-12-03 17:24:22.827 | self.assertEqual(self.hardware.get_os_install_device(), '/dev/sdb')
2015-12-03 17:24:22.827 | File "ironic_python_agent/hardware.py", line 434, in get_os_install_device
2015-12-03 17:24:22.827 | block_devices = self.list_block_devices()
2015-12-03 17:24:22.828 | File "ironic_python_agent/hardware.py", line 431, in list_block_devices
2015-12-03 17:24:22.828 | return list_all_block_devices()
2015-12-03 17:24:22.828 | File "ironic_python_agent/hardware.py", line 94, in list_all_block_devices
2015-12-03 17:24:22.828 | udev = pyudev.Device.from_device_file(context, name)
2015-12-03 17:24:22.828 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/pyudev/device/_device.py", line 413, in from_device_file
2015-12-03 17:24:22.828 | return Devices.from_device_file(context, filename)
2015-12-03 17:24:22.828 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/pyudev/device/_device.py", line 221, in from_device_file
2015-12-03 17:24:22.828 | raise DeviceNotFoundByFileError(err)
2015-12-03 17:24:22.828 | pyudev.device._errors.DeviceNotFoundByFileError: [Errno 2] No such file or directory: '/dev/sda'
2015-12-03 17:24:22.828 | ======================================================================
2015-12-03 17:24:22.828 | FAIL: ironic_python_agent.tests.unit.test_hardware.TestGenericHardwareManager.test_get_os_install_device_fails
2015-12-03 17:24:22.829 | tags: worker-7
2015-12-03 17:24:22.829 | ----------------------------------------------------------------------
2015-12-03 17:24:22.829 | Empty attachments:
2015-12-03 17:24:22.829 | stderr
2015-12-03 17:24:22.829 | stdout
2015-12-03 17:24:22.829 |
2015-12-03 17:24:22.829 | Traceback (most recent call last):
2015-12-03 17:24:22.829 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
2015-12-03 17:24:22.829 | return func(*args, **keywargs)
2015-12-03 17:24:22.829 | File "ironic_python_agent/tests/unit/test_hardware.py", line 299, in test_get_os_install_device_fails
2015-12-03 17:24:22.829 | self.hardware.get_os_install_device)
2015-12-03 17:24:23.036 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 422, in assertRaises
2015-12-03 17:24:23.036 | self.assertThat(our_callable, matcher)
2015-12-03 17:24:23.036 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
2015-12-03 17:24:23.037 | mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
2015-12-03 17:24:23.037 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 483, in _matchHelper
2015-12-03 17:24:23.037 | mismatch = matcher.match(matchee)
2015-12-03 17:24:23.037 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 108, in match
2015-12-03 17:24:23.037 | mismatch = self.exception_matcher.match(exc_info)
2015-12-03 17:24:23.037 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line 62, in match
2015-12-03 17:24:23.037 | mismatch = matcher.match(matchee)
2015-12-03 17:24:23.037 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 414, in match
2015-12-03 17:24:23.037 | reraise(*matchee)
2015-12-03 17:24:23.037 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 101, in match
2015-12-03 17:24:23.037 | result = matchee()
2015-12-03 17:24:23.038 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 969, in __call__
2015-12-03 17:24:23.038 | return self._callable_object(*self._args, **self._kwargs)
2015-12-03 17:24:23.038 | File "ironic_python_agent/hardware.py", line 434, in get_os_install_device
2015-12-03 17:24:23.038 | block_devices = self.list_block_devices()
2015-12-03 17:24:23.038 | File "ironic_python_agent/hardware.py", line 431, in list_block_devices
2015-12-03 17:24:23.038 | return list_all_block_devices()
2015-12-03 17:24:23.038 | File "ironic_python_agent/hardware.py", line 94, in list_all_block_devices
2015-12-03 17:24:23.038 | udev = pyudev.Device.from_device_file(context, name)
2015-12-03 17:24:23.038 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/pyudev/device/_device.py", line 413, in from_device_file
2015-12-03 17:24:23.038 | return Devices.from_device_file(context, filename)
2015-12-03 17:24:23.038 | File "/home/jenkins/workspace/gate-ironic-python-agent-python27/.tox/py27/local/lib/python2.7/site-packages/pyudev/device/_device.py", line 221, in from_device_file
2015-12-03 17:24:23.038 | raise DeviceNotFoundByFileError(err)
2015-12-03 17:24:23.039 | pyudev.device._errors.DeviceNotFoundByFileError: [Errno 2] No such file or directory: '/dev/sda'
2015-12-03 17:24:23.039 | Ran 224 tests in 0.327s
2015-12-03 17:24:23.039 | FAILED (id=0, failures=2)

http://logs.openstack.org/61/234861/21/gate/gate-ironic-python-agent-python27/c6b795b/console.html

Revision history for this message
Dmitry Tantsur (divius) wrote :

Seems like now pygudev raises DeviceNotFoundByFileError instead of (EnvironmentError, ValueError) that we catch

Changed in ironic-python-agent:
assignee: nobody → Dmitry Tantsur (divius)
Dmitry Tantsur (divius)
description: updated
summary: - Unit tests fail with DeviceNotFoundByFileError: [Errno 2] No such file
- or directory: '/dev/sda'
+ pyudev 0.18 changed raises exception for from_device_file, breaking
+ backward compatibility
Revision history for this message
Dmitry Tantsur (divius) wrote : Re: pyudev 0.18 changed raises exception for from_device_file, breaking backward compatibility
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/253454

Changed in ironic-python-agent:
status: Confirmed → In Progress
Revision history for this message
Dmitry Tantsur (divius) wrote : Re: pyudev 0.18 changed raises exception for from_device_file, breaking backward compatibility
Dmitry Tantsur (divius)
Changed in ironic-python-agent:
importance: High → Critical
status: In Progress → Triaged
summary: - pyudev 0.18 changed raises exception for from_device_file, breaking
- backward compatibility
+ pyudev 0.18 changed exception for from_device_file, breaking backward
+ compatibility (and IPA unit tests)
Changed in ironic-python-agent:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (master)

Reviewed: https://review.openstack.org/253454
Committed: https://git.openstack.org/cgit/openstack/ironic-python-agent/commit/?id=2fc6ce22f8b531d33bb3d7f7876dd42276231797
Submitter: Jenkins
Branch: master

commit 2fc6ce22f8b531d33bb3d7f7876dd42276231797
Author: Dmitry Tantsur <email address hidden>
Date: Fri Dec 4 12:33:07 2015 +0100

    pyudev exception has changed for from_device_file

    Now pyudev raises DeviceNotFoundByFileError which does not inherit
    from EnvironmentError, so our 'except' block in hardware.py no longer
    catch the exception. It broke unit tests, but it can also potentially
    break the deploy.

    This patch updates hardware.py to catch both old a new exceptions.

    Change-Id: Iaefd6089f6f766a241054d8e132b2f3098c8130d
    Closes-Bug: #1522756

Changed in ironic-python-agent:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/254612

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (stable/liberty)

Reviewed: https://review.openstack.org/254612
Committed: https://git.openstack.org/cgit/openstack/ironic-python-agent/commit/?id=636c848027677ee699b130b78ab2033842582d1c
Submitter: Jenkins
Branch: stable/liberty

commit 636c848027677ee699b130b78ab2033842582d1c
Author: Dmitry Tantsur <email address hidden>
Date: Fri Dec 4 12:33:07 2015 +0100

    pyudev exception has changed for from_device_file

    Now pyudev raises DeviceNotFoundByFileError which does not inherit
    from EnvironmentError, so our 'except' block in hardware.py no longer
    catch the exception. It broke unit tests, but it can also potentially
    break the deploy.

    This patch updates hardware.py to catch both old a new exceptions.

    Change-Id: Iaefd6089f6f766a241054d8e132b2f3098c8130d
    Closes-Bug: #1522756
    (cherry picked from commit 2fc6ce22f8b531d33bb3d7f7876dd42276231797)

tags: added: in-stable-liberty
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/ironic-python-agent 1.1.0

This issue was fixed in the openstack/ironic-python-agent 1.1.0 release.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/ironic-python-agent 1.0.1

This issue was fixed in the openstack/ironic-python-agent 1.0.1 release.

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.