Fix compatibility with Pint 0.5

This is the version we have in global-requirements, and it does not
contain module pint.errors. Fortunately, in all versions the required
error is exposed on the top level, so just use it.

See https://review.rdoproject.org/r/6741 for a build failure.

Change-Id: I1f194ccc48a3195fcbf8599c3a0b4fa21fde16d2
This commit is contained in:
Dmitry Tantsur 2017-05-22 17:05:53 +02:00
parent db76c899b5
commit 40ddf861c7

View File

@ -81,7 +81,7 @@ def get_nodes_memory_info(numa_node_dirs):
# Memory info sample line format 'Node 0 MemTotal: 1560000 kB'
value = line.split(":")[1].strip()
memory_kb = int(UNIT_CONVERTER(value).to_base_units())
except (ValueError, IndexError, pint.errors.UndefinedUnitError) as exc:
except (ValueError, IndexError, pint.UndefinedUnitError) as exc:
msg = ('Failed to get memory information for %(node)s: '
'%(error)s' % {'node': numa_node_dir, 'error': exc})
raise errors.IncompatibleNumaFormatError(msg)