diff options
author | Victor Sergeyev <vsergeyev@mirantis.com> | 2014-12-30 13:50:27 +0200 |
---|---|---|
committer | Victor Sergeyev <vsergeyev@mirantis.com> | 2015-05-06 11:51:44 +0300 |
commit | 70062322a240353989babeddfb904b487a42d668 (patch) | |
tree | b914ca4a6c2a9df5f79f14a7abdc5c716dc128c5 /ironic/drivers/modules/amt/common.py | |
parent | 1961523996f1f0a88f2e3871c902dd7426ba25f5 (diff) | |
download | ironic-70062322a240353989babeddfb904b487a42d668.tar.gz |
Run tests in py34 environment
A lot of fixes to be compatible with python 3:
- fix encoding/decoding errors
- fix issues with comparison
- use `reload`, `reraise`, ext. modules from six
- use items() instead of iteritems()
- add a new file with py3 specific test requirements
- drop passing the arbitrary arguments to object.__new__ method.
See bug [1] for more details.
- add a workaround to bug in `mock` library
- add py33 and py34 test environment to tox.ini
[1] http://bugs.python.org/issue1683368
Change-Id: I90936cb6b6eaaf4b5e1ce67732caec3c8bdc1cc2
Diffstat (limited to 'ironic/drivers/modules/amt/common.py')
-rw-r--r-- | ironic/drivers/modules/amt/common.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ironic/drivers/modules/amt/common.py b/ironic/drivers/modules/amt/common.py index 9cacb31e3..3ab52d4f8 100644 --- a/ironic/drivers/modules/amt/common.py +++ b/ironic/drivers/modules/amt/common.py @@ -151,7 +151,9 @@ def parse_driver_info(node): for param in REQUIRED_PROPERTIES: value = info.get(param) if value: - d_info[param[4:]] = six.binary_type(value) + if not isinstance(value, six.binary_type): + value = value.encode() + d_info[param[4:]] = value else: missing_info.append(param) @@ -166,7 +168,9 @@ def parse_driver_info(node): if protocol not in AMT_PROTOCOL_PORT_MAP: raise exception.InvalidParameterValue(_("Invalid " "protocol %s.") % protocol) - d_info[param[4:]] = six.binary_type(protocol) + if not isinstance(value, six.binary_type): + protocol = protocol.encode() + d_info[param[4:]] = protocol return d_info |