|
|
69a90f |
From ff2820775597e6fc47bada2ce57b01f8cfd81af6 Mon Sep 17 00:00:00 2001
|
|
|
69a90f |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
69a90f |
Date: Wed, 13 Jul 2016 12:45:36 +0100
|
|
|
69a90f |
Subject: [PATCH 1/3] [atomichost] fix option list style
|
|
|
69a90f |
|
|
|
69a90f |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
69a90f |
---
|
|
|
69a90f |
sos/plugins/atomichost.py | 5 +++--
|
|
|
69a90f |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
69a90f |
|
|
|
69a90f |
diff --git a/sos/plugins/atomichost.py b/sos/plugins/atomichost.py
|
|
|
69a90f |
index 46d12e3..ce30ac7 100644
|
|
|
69a90f |
--- a/sos/plugins/atomichost.py
|
|
|
69a90f |
+++ b/sos/plugins/atomichost.py
|
|
|
69a90f |
@@ -22,8 +22,9 @@ class AtomicHost(Plugin, RedHatPlugin):
|
|
|
69a90f |
""" Atomic Host """
|
|
|
69a90f |
|
|
|
69a90f |
plugin_name = "atomichost"
|
|
|
69a90f |
- option_list = [("info", "gather atomic info for each image",
|
|
|
69a90f |
- "fast", False)]
|
|
|
69a90f |
+ option_list = [
|
|
|
69a90f |
+ ("info", "gather atomic info for each image", "fast", False)
|
|
|
69a90f |
+ ]
|
|
|
69a90f |
|
|
|
69a90f |
def check_enabled(self):
|
|
|
69a90f |
if not os.path.exists("/host/etc/system-release-cpe"):
|
|
|
69a90f |
--
|
|
|
69a90f |
2.4.11
|
|
|
69a90f |
|
|
|
69a90f |
From 46da5439bb79f294dca8019293eecf3096e5b999 Mon Sep 17 00:00:00 2001
|
|
|
69a90f |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
69a90f |
Date: Wed, 13 Jul 2016 12:47:06 +0100
|
|
|
69a90f |
Subject: [PATCH 2/3] [atomichost] replace custom logic with
|
|
|
69a90f |
Policy.in_container()
|
|
|
69a90f |
|
|
|
69a90f |
Don't reinvent the wheel by inspecting file system paths: rely on
|
|
|
69a90f |
the existing policy class in_container() method.
|
|
|
69a90f |
|
|
|
69a90f |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
69a90f |
---
|
|
|
69a90f |
sos/plugins/atomichost.py | 5 +----
|
|
|
69a90f |
1 file changed, 1 insertion(+), 4 deletions(-)
|
|
|
69a90f |
|
|
|
69a90f |
diff --git a/sos/plugins/atomichost.py b/sos/plugins/atomichost.py
|
|
|
69a90f |
index ce30ac7..a339557 100644
|
|
|
69a90f |
--- a/sos/plugins/atomichost.py
|
|
|
69a90f |
+++ b/sos/plugins/atomichost.py
|
|
|
69a90f |
@@ -27,10 +27,7 @@ class AtomicHost(Plugin, RedHatPlugin):
|
|
|
69a90f |
]
|
|
|
69a90f |
|
|
|
69a90f |
def check_enabled(self):
|
|
|
69a90f |
- if not os.path.exists("/host/etc/system-release-cpe"):
|
|
|
69a90f |
- return False
|
|
|
69a90f |
- cpe = open("/host/etc/system-release-cpe", "r").readlines()
|
|
|
69a90f |
- return ':atomic-host' in cpe[0]
|
|
|
69a90f |
+ return self.policy().in_container()
|
|
|
69a90f |
|
|
|
69a90f |
def setup(self):
|
|
|
69a90f |
self.add_copy_spec("/etc/ostree/remotes.d")
|
|
|
69a90f |
--
|
|
|
69a90f |
2.4.11
|
|
|
69a90f |
|
|
|
69a90f |
From e2d85366ef5b6f02e12e0ce353a0ccaa22ae8bbc Mon Sep 17 00:00:00 2001
|
|
|
69a90f |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
69a90f |
Date: Wed, 13 Jul 2016 15:13:35 +0100
|
|
|
69a90f |
Subject: [PATCH 3/3] [atomichost] improve 'atomic info' collection loop
|
|
|
69a90f |
|
|
|
69a90f |
Remove redundant code from the loop that drives 'atomic info'
|
|
|
69a90f |
collection and make the bracketing and indenting style match
|
|
|
69a90f |
other plugins.
|
|
|
69a90f |
|
|
|
69a90f |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
69a90f |
---
|
|
|
69a90f |
sos/plugins/atomichost.py | 11 ++++++-----
|
|
|
69a90f |
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
69a90f |
|
|
|
69a90f |
diff --git a/sos/plugins/atomichost.py b/sos/plugins/atomichost.py
|
|
|
69a90f |
index a339557..9b53d56 100644
|
|
|
69a90f |
--- a/sos/plugins/atomichost.py
|
|
|
69a90f |
+++ b/sos/plugins/atomichost.py
|
|
|
69a90f |
@@ -34,8 +34,9 @@ class AtomicHost(Plugin, RedHatPlugin):
|
|
|
69a90f |
self.add_cmd_output("atomic host status")
|
|
|
69a90f |
|
|
|
69a90f |
if self.get_option('info'):
|
|
|
69a90f |
- images = self.get_command_output("docker images -q")
|
|
|
69a90f |
- for image in set(
|
|
|
69a90f |
- images['output'].splitlines()):
|
|
|
69a90f |
- if image:
|
|
|
69a90f |
- self.add_cmd_output("atomic info {0}".format(image))
|
|
|
69a90f |
+ # images output may have trailing whitespace
|
|
|
69a90f |
+ images = self.get_command_output("docker images -q").strip()
|
|
|
69a90f |
+ for image in set(images['output'].splitlines()):
|
|
|
69a90f |
+ self.add_cmd_output("atomic info {0}".format(image))
|
|
|
69a90f |
+
|
|
|
69a90f |
+# vim: set et ts=4 sw=4 :
|
|
|
69a90f |
--
|
|
|
69a90f |
2.4.11
|
|
|
69a90f |
|
|
|
69a90f |
From b5e0e80ad784054fd2f4cdb8c6867982c0dd1c25 Mon Sep 17 00:00:00 2001
|
|
|
69a90f |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
69a90f |
Date: Fri, 19 Aug 2016 15:33:34 +0100
|
|
|
69a90f |
Subject: [PATCH] [atomichost] fix collection of 'docker info' output
|
|
|
69a90f |
|
|
|
69a90f |
The loop that drives collection of 'docker info' output for each
|
|
|
69a90f |
discovered Image ID incorrectly attempted to call strip() on the
|
|
|
69a90f |
dictionary returned by get_command_output().
|
|
|
69a90f |
|
|
|
69a90f |
Since the docker command does not produce leading or trailing
|
|
|
69a90f |
whitespace this is redundant anyway: discard the other entries
|
|
|
69a90f |
in the command dictionary and just split the result into distinct
|
|
|
69a90f |
lines.
|
|
|
69a90f |
|
|
|
69a90f |
Resolves: #853.
|
|
|
69a90f |
|
|
|
69a90f |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
69a90f |
---
|
|
|
69a90f |
sos/plugins/atomichost.py | 9 ++++++---
|
|
|
69a90f |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
69a90f |
|
|
|
69a90f |
diff --git a/sos/plugins/atomichost.py b/sos/plugins/atomichost.py
|
|
|
69a90f |
index 9b53d56..7091a45 100644
|
|
|
69a90f |
--- a/sos/plugins/atomichost.py
|
|
|
69a90f |
+++ b/sos/plugins/atomichost.py
|
|
|
69a90f |
@@ -34,9 +34,12 @@ class AtomicHost(Plugin, RedHatPlugin):
|
|
|
69a90f |
self.add_cmd_output("atomic host status")
|
|
|
69a90f |
|
|
|
69a90f |
if self.get_option('info'):
|
|
|
69a90f |
- # images output may have trailing whitespace
|
|
|
69a90f |
- images = self.get_command_output("docker images -q").strip()
|
|
|
69a90f |
- for image in set(images['output'].splitlines()):
|
|
|
69a90f |
+ # The 'docker images' command may include duplicate rows of
|
|
|
69a90f |
+ # output (repeated "IMAGE ID" values). Use a set to filter
|
|
|
69a90f |
+ # these out and only obtain 'docker info' data once per image
|
|
|
69a90f |
+ # identifier.
|
|
|
69a90f |
+ images = self.get_command_output("docker images -q")['output']
|
|
|
69a90f |
+ for image in set(images.splitlines()):
|
|
|
69a90f |
self.add_cmd_output("atomic info {0}".format(image))
|
|
|
69a90f |
|
|
|
69a90f |
# vim: set et ts=4 sw=4 :
|
|
|
69a90f |
--
|
|
|
69a90f |
2.4.11
|
|
|
69a90f |
|