From 4548b9d1f253fcd934f840f905bd3ec3ce4ec125 Mon Sep 17 00:00:00 2001 From: David Ames Date: Tue, 5 Dec 2017 00:12:12 +0000 Subject: [PATCH] Py3 Fixes Charm-helpers sync to get python3 fixes. Change-Id: I020028a930617a865f3a8fc039f3876cb2529804 --- hooks/charmhelpers/contrib/storage/linux/ceph.py | 8 ++++---- tests/charmhelpers/contrib/storage/linux/ceph.py | 8 ++++---- unit_tests/test_nova_compute_utils.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hooks/charmhelpers/contrib/storage/linux/ceph.py b/hooks/charmhelpers/contrib/storage/linux/ceph.py index 39231612..0d9bacfd 100644 --- a/hooks/charmhelpers/contrib/storage/linux/ceph.py +++ b/hooks/charmhelpers/contrib/storage/linux/ceph.py @@ -377,12 +377,12 @@ def get_mon_map(service): try: return json.loads(mon_status) except ValueError as v: - log("Unable to parse mon_status json: {}. Error: {}".format( - mon_status, v.message)) + log("Unable to parse mon_status json: {}. Error: {}" + .format(mon_status, str(v))) raise except CalledProcessError as e: - log("mon_status command failed with message: {}".format( - e.message)) + log("mon_status command failed with message: {}" + .format(str(e))) raise diff --git a/tests/charmhelpers/contrib/storage/linux/ceph.py b/tests/charmhelpers/contrib/storage/linux/ceph.py index 39231612..0d9bacfd 100644 --- a/tests/charmhelpers/contrib/storage/linux/ceph.py +++ b/tests/charmhelpers/contrib/storage/linux/ceph.py @@ -377,12 +377,12 @@ def get_mon_map(service): try: return json.loads(mon_status) except ValueError as v: - log("Unable to parse mon_status json: {}. Error: {}".format( - mon_status, v.message)) + log("Unable to parse mon_status json: {}. Error: {}" + .format(mon_status, str(v))) raise except CalledProcessError as e: - log("mon_status command failed with message: {}".format( - e.message)) + log("mon_status command failed with message: {}" + .format(str(e))) raise diff --git a/unit_tests/test_nova_compute_utils.py b/unit_tests/test_nova_compute_utils.py index 66a9dbfc..419c4850 100644 --- a/unit_tests/test_nova_compute_utils.py +++ b/unit_tests/test_nova_compute_utils.py @@ -564,7 +564,7 @@ class NovaComputeUtilsTests(CharmTestCase): self.relation_get.return_value = 'Zm9vX2NlcnQK' with patch_open() as (_open, _file): utils.import_keystone_ca_cert() - _open.assert_called_with(utils.CA_CERT_PATH, 'wt') + _open.assert_called_with(utils.CA_CERT_PATH, 'wb') _file.write.assert_called_with(b'foo_cert\n') check_call.assert_called_with(['update-ca-certificates'])