|
|
61311a |
From 9135d767e6244d370d8cbd59a75e1a56b928d4a3 Mon Sep 17 00:00:00 2001
|
|
|
61311a |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
61311a |
Date: Wed, 12 Dec 2018 10:36:09 +0000
|
|
|
61311a |
Subject: [PATCH] [composer] avoid running 'blueprints list' twice
|
|
|
61311a |
|
|
|
61311a |
Use get_cmd_output_now() to store the first call to composer-cli's
|
|
|
61311a |
'blueprints list' command in the report, and then use that file to
|
|
|
61311a |
find the list of available blueprints.
|
|
|
61311a |
|
|
|
61311a |
Related: #1447
|
|
|
61311a |
|
|
|
61311a |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
61311a |
---
|
|
|
61311a |
sos/plugins/composer.py | 15 ++++++---------
|
|
|
61311a |
1 file changed, 6 insertions(+), 9 deletions(-)
|
|
|
61311a |
|
|
|
61311a |
diff --git a/sos/plugins/composer.py b/sos/plugins/composer.py
|
|
|
61311a |
index 34901bcee..ff3aa49bf 100644
|
|
|
61311a |
--- a/sos/plugins/composer.py
|
|
|
61311a |
+++ b/sos/plugins/composer.py
|
|
|
61311a |
@@ -12,11 +12,11 @@ class Composer(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
|
61311a |
|
|
|
61311a |
def _get_blueprints(self):
|
|
|
61311a |
blueprints = []
|
|
|
61311a |
- bp_result = self.get_command_output("composer-cli blueprints list")
|
|
|
61311a |
- if bp_result['status'] != 0:
|
|
|
61311a |
- return blueprints
|
|
|
61311a |
- for line in bp_result['output'].splitlines():
|
|
|
61311a |
- blueprints.append(line)
|
|
|
61311a |
+ bp_file = self.get_cmd_output_now("composer-cli blueprints list")
|
|
|
61311a |
+ if bp_file:
|
|
|
61311a |
+ with open(bp_file, "r") as bps:
|
|
|
61311a |
+ for line in bps.read().splitlines():
|
|
|
61311a |
+ blueprints.append(line)
|
|
|
61311a |
return blueprints
|
|
|
61311a |
|
|
|
61311a |
def setup(self):
|
|
|
61311a |
@@ -31,9 +31,6 @@ def setup(self):
|
|
|
61311a |
for blueprint in blueprints:
|
|
|
61311a |
self.add_cmd_output("composer-cli blueprints show %s" % blueprint)
|
|
|
61311a |
|
|
|
61311a |
- self.add_cmd_output([
|
|
|
61311a |
- "composer-cli blueprints list",
|
|
|
61311a |
- "composer-cli sources list"
|
|
|
61311a |
- ])
|
|
|
61311a |
+ self.add_cmd_output("composer-cli sources list")
|
|
|
61311a |
|
|
|
61311a |
# vim: set et ts=4 sw=4 :
|
|
|
61311a |
From e456ae4f23e49c36d5efe6b0584c5ec29be21ba5 Mon Sep 17 00:00:00 2001
|
|
|
61311a |
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
|
61311a |
Date: Mon, 18 Feb 2019 12:32:11 -0500
|
|
|
61311a |
Subject: [PATCH] [composer] Collect sources info for all sources
|
|
|
61311a |
|
|
|
61311a |
Adds collection of info on each source found by composer-cli. The
|
|
|
61311a |
_get_blueprints() method has been made more generic to accomodate both
|
|
|
61311a |
blueprints and sources.
|
|
|
61311a |
|
|
|
61311a |
Resolves: #1571
|
|
|
61311a |
|
|
|
61311a |
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
|
61311a |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
61311a |
---
|
|
|
61311a |
sos/plugins/composer.py | 22 ++++++++++++----------
|
|
|
61311a |
1 file changed, 12 insertions(+), 10 deletions(-)
|
|
|
61311a |
|
|
|
61311a |
diff --git a/sos/plugins/composer.py b/sos/plugins/composer.py
|
|
|
61311a |
index 0f926398b..e4f30f5f0 100644
|
|
|
61311a |
--- a/sos/plugins/composer.py
|
|
|
61311a |
+++ b/sos/plugins/composer.py
|
|
|
61311a |
@@ -10,14 +10,14 @@ class Composer(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
|
61311a |
|
|
|
61311a |
packages = ('composer-cli',)
|
|
|
61311a |
|
|
|
61311a |
- def _get_blueprints(self):
|
|
|
61311a |
- blueprints = []
|
|
|
61311a |
- bp_file = self.get_cmd_output_now("composer-cli blueprints list")
|
|
|
61311a |
- if bp_file:
|
|
|
61311a |
- with open(bp_file, "r") as bps:
|
|
|
61311a |
- for line in bps.read().splitlines():
|
|
|
61311a |
- blueprints.append(line)
|
|
|
61311a |
- return blueprints
|
|
|
61311a |
+ def _get_entries(self, cmd):
|
|
|
61311a |
+ entries = []
|
|
|
61311a |
+ ent_file = self.get_cmd_output_now(cmd)
|
|
|
61311a |
+ if ent_file:
|
|
|
61311a |
+ with open(ent_file, "r") as ents:
|
|
|
61311a |
+ for line in ents.read().splitlines():
|
|
|
61311a |
+ entries.append(line)
|
|
|
61311a |
+ return entries
|
|
|
61311a |
|
|
|
61311a |
def setup(self):
|
|
|
61311a |
self.add_copy_spec([
|
|
|
61311a |
@@ -27,10 +27,12 @@ def setup(self):
|
|
|
61311a |
"/var/log/lorax-composer/program.log",
|
|
|
61311a |
"/var/log/lorax-composer/server.log",
|
|
|
61311a |
])
|
|
|
61311a |
- blueprints = self._get_blueprints()
|
|
|
61311a |
+ blueprints = self._get_entries("composer-cli blueprints list")
|
|
|
61311a |
for blueprint in blueprints:
|
|
|
61311a |
self.add_cmd_output("composer-cli blueprints show %s" % blueprint)
|
|
|
61311a |
|
|
|
61311a |
- self.add_cmd_output("composer-cli sources list")
|
|
|
61311a |
+ sources = self._get_entries("composer-cli sources list")
|
|
|
61311a |
+ for src in sources:
|
|
|
61311a |
+ self.add_cmd_output("composer-cli sources info %s" % src)
|
|
|
61311a |
|
|
|
61311a |
# vim: set et ts=4 sw=4 :
|