[PATCH 07/14] Short-circuit initialization when printing out Anaconda version

Martin Kolman mkolman at redhat.com
Thu Aug 21 20:10:28 UTC 2014


We already short-circuit the initialization when printing out
the help and we should also short-circuit when printing
the Anaconda version information.

Also do basic logging setup when short circuiting the normal Anaconda init,
this gets rid of the annoying "no handlers found" error message on stdout
when printing the Anaconda version.

Related: rhbz:#1088459
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 anaconda | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/anaconda b/anaconda
index 26236db..c91ae6b 100755
--- a/anaconda
+++ b/anaconda
@@ -686,7 +686,13 @@ def cleanPStore():
 if __name__ == "__main__":
     # check if the CLI help is requested and return it at once,
     # without importing random stuff and spamming stdout
-    if ("--help" in sys.argv) or ("-h" in sys.argv):
+    if ("--help" in sys.argv) or ("-h" in sys.argv) or ("--version" in sys.argv):
+        # we skip the full logging initialisation, but we need to do at least
+        # this much (redirect any log messages to stdout) to get rid of the
+        # harmless but annoying "no handlers found" message on stdout
+        import logging
+        log = logging.getLogger("anaconda")
+        log.addHandler(logging.StreamHandler(stream=sys.stdout))
         parseArguments()
 
     print "Starting installer, one moment..."
-- 
1.9.3



More information about the anaconda-patches mailing list