From 2f8082575119e7f9537c306f210789ff3a21b410 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Sun, 30 Sep 2018 18:15:25 +0000 Subject: [PATCH] Add the missing argument in CommandError The CommandError class takes 'error' as an keyword argument but it is missing in callers. This commit fixes it. Change-Id: I3a13c8953eae1ccf7bc0b871ac24785979b579ac --- zun/container/docker/driver.py | 6 ++++-- zun/container/os_capability/host_capability.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/zun/container/docker/driver.py b/zun/container/docker/driver.py index e469e7627..4474dffd7 100644 --- a/zun/container/docker/driver.py +++ b/zun/container/docker/driver.py @@ -1121,10 +1121,12 @@ class DockerDriver(driver.ContainerDriver): (output, err) = utils.execute('df', '-B', '1G', CONF.docker.docker_data_root, run_as_root=True) - except exception.CommandError: + except exception.CommandError as e: LOG.info('There was a problem while executing df -B 1G %s', CONF.docker.docker_data_root) - raise exception.CommandError(cmd='df') + raise exception.CommandError(cmd='df', + error=six.text_type(e)) + total_disk = int(output.split('\n')[1].split()[1]) return int(total_disk * (1 - CONF.compute.reserve_disk_for_image)) diff --git a/zun/container/os_capability/host_capability.py b/zun/container/os_capability/host_capability.py index 5bba703a9..96d47dfeb 100644 --- a/zun/container/os_capability/host_capability.py +++ b/zun/container/os_capability/host_capability.py @@ -15,6 +15,7 @@ from oslo_concurrency import processutils from oslo_serialization import jsonutils +import six from zun.common import exception from zun.common import utils @@ -85,8 +86,9 @@ class Host(object): columns = line.split() address = columns[0] addresses.append(address) - except processutils.ProcessExecutionError: - raise exception.CommandError(cmd='lspci') + except processutils.ProcessExecutionError as e: + raise exception.CommandError(cmd='lspci', + error=six.text_type(e)) pci_info = [] for addr in addresses: