From b5e0e80ad784054fd2f4cdb8c6867982c0dd1c25 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Fri, 19 Aug 2016 15:33:34 +0100 Subject: [atomichost] fix collection of 'docker info' output The loop that drives collection of 'docker info' output for each discovered Image ID incorrectly attempted to call strip() on the dictionary returned by get_command_output(). Since the docker command does not produce leading or trailing whitespace this is redundant anyway: discard the other entries in the command dictionary and just split the result into distinct lines. Resolves: #853. Signed-off-by: Bryn M. Reeves --- sos/plugins/atomichost.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sos/plugins/atomichost.py b/sos/plugins/atomichost.py index 9b53d56b..7091a45f 100644 --- a/sos/plugins/atomichost.py +++ b/sos/plugins/atomichost.py @@ -34,9 +34,12 @@ class AtomicHost(Plugin, RedHatPlugin): self.add_cmd_output("atomic host status") if self.get_option('info'): - # images output may have trailing whitespace - images = self.get_command_output("docker images -q").strip() - for image in set(images['output'].splitlines()): + # The 'docker images' command may include duplicate rows of + # output (repeated "IMAGE ID" values). Use a set to filter + # these out and only obtain 'docker info' data once per image + # identifier. + images = self.get_command_output("docker images -q")['output'] + for image in set(images.splitlines()): self.add_cmd_output("atomic info {0}".format(image)) # vim: set et ts=4 sw=4 : -- cgit