diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2016-08-19 15:33:34 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2016-08-19 15:33:34 +0100 |
commit | b5e0e80ad784054fd2f4cdb8c6867982c0dd1c25 (patch) | |
tree | 992a62cea7daf5831bf0289b6d9d9fa8e27d7c60 | |
parent | 57fdeaaad3436f374f4a68dbfef686c5dd8b4d5b (diff) | |
download | sos-b5e0e80ad784054fd2f4cdb8c6867982c0dd1c25.tar.gz |
[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 <bmr@redhat.com>
-rw-r--r-- | sos/plugins/atomichost.py | 9 |
1 files 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 : |