Merge "Fixed wrap from taking negative values"
This commit is contained in:
commit
5cdb655241
|
@ -223,6 +223,9 @@ def print_dict(dct, dict_property="Property", wrap=0, dict_value='Value',
|
|||
v = six.text_type(v)
|
||||
if wrap > 0:
|
||||
v = textwrap.fill(six.text_type(v), wrap)
|
||||
elif wrap < 0:
|
||||
raise ValueError(_("wrap argument should be a non-negative "
|
||||
"integer"))
|
||||
# if value has a newline, add in multiple rows
|
||||
# e.g. fault with stacktrace
|
||||
if v and isinstance(v, six.string_types) and r'\n' in v:
|
||||
|
|
|
@ -663,6 +663,10 @@ class PrintResultStringTestCase(test_base.BaseTestCase):
|
|||
'''
|
||||
self.assertEqual(expected, out)
|
||||
|
||||
def test_print_dict_negative_wrap(self):
|
||||
dct = {"K": "k", "Key": "Value"}
|
||||
self.assertRaises(ValueError, cliutils.print_dict, dct, wrap=-10)
|
||||
|
||||
|
||||
class DecoratorsTestCase(test_base.BaseTestCase):
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
``--wrap`` CLI argument for ``ironic driver-properties`` and
|
||||
``ironic driver-raid-logical-disk-properties`` commands now takes
|
||||
only non-negative integers as input. An error is shown if a
|
||||
negative value is passed.
|
Loading…
Reference in New Issue