[elbe-devel] [PATCH v2 4/6] init: switch from command_out() to do() to unhide gpg output

Torben Hohn torben.hohn at linutronix.de
Wed Oct 2 12:07:06 CEST 2019


command_out() returns the error code, and also returns the stdout.
the return values are ignored in the respective codefragment though.

switch to do() and add allow_fail=True, because gpg seems to return error
when the key can not be validated completely.

This was added to debug a problem, where the the elbe-keyring.gpg did
not include all keys. But this somehow mitigated the problem.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Reviewed-by: John Ogness <john.ogness at linutronix.de>
---
 elbepack/commands/init.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index ffa0b0e53..6b463b4cb 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -21,7 +21,7 @@ from elbepack.version import elbe_version
 from elbepack.templates import write_template, get_initvm_preseed
 from elbepack.directories import init_template_dir, elbe_dir
 from elbepack.config import cfg
-from elbepack.shellhelper import command_out, system
+from elbepack.shellhelper import command_out, system, do
 
 
 def run_command(argv):
@@ -232,10 +232,10 @@ def run_command(argv):
         for key in xml.all(".//initvm/mirror/url-list/url/raw-key"):
             keys.append(key.et.text)
         import_keyring = os.path.join(out_path, "elbe-keyring")
-        command_out('gpg --no-options --no-default-keyring --keyring %s --import' % import_keyring,
-                    stdin="".join(keys))
+        do('gpg --no-options --no-default-keyring --keyring %s --import' % import_keyring,
+                    stdin="".join(keys), allow_fail=True)
         export_keyring = import_keyring + ".gpg"
-        command_out('gpg --no-options --no-default-keyring --keyring %s --export --output %s' % (import_keyring,
+        do('gpg --no-options --no-default-keyring --keyring %s --export --output %s' % (import_keyring,
                                                                                     export_keyring))
 
     if opt.devel:
-- 
2.20.1




More information about the elbe-devel mailing list