[node-patches] Change in ovirt-node[master]: tools: Log exception only in debug mode

fabiand at fedoraproject.org fabiand at fedoraproject.org
Mon Jul 1 08:44:58 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: tools: Log exception only in debug mode
......................................................................

tools: Log exception only in debug mode

Previousyl a stack trace was shown on non-matching passwords. This
stacktrace is now only shown in debug/verbose mode.

Change-Id: I9b3974cb6713732776fd0c9430e2ba7b5c9ee2cb
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=979964
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/tools/password.py
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/83/16283/1

diff --git a/src/ovirt/node/tools/password.py b/src/ovirt/node/tools/password.py
index 39838da..ddb1a5c 100644
--- a/src/ovirt/node/tools/password.py
+++ b/src/ovirt/node/tools/password.py
@@ -30,10 +30,12 @@
 class PasswordTool(cmd.Cmd):
     intro = "\n\n Password Configuration\n\n Enter ? for help.\n"
     prompt = "> "
+    is_debug = False
 
-    def __init__(self):
+    def __init__(self, debug=False):
         cmd.Cmd.__init__(self)
         self.logger = logging.getLogger(__name__)
+        self.is_debug = debug
 
     def do_set_root_password(self, line):
         """Set root password
@@ -84,7 +86,8 @@
             security.Passwd().set_password(username, pw)
             self.logger.info("Password updated successfully.")
         except ValueError as e:
-            self.logger.exception("Exception:")
+            if self.is_debug:
+                self.logger.exception("Exception:")
             self.logger.error("Password update failed: %s" % e.message)
 
 
@@ -100,7 +103,7 @@
     logging.basicConfig(level=lvl, format='[%(levelname)s] %(message)s')
 
     # Setup CLI
-    cli = PasswordTool()
+    cli = PasswordTool(namespace.verbose)
 
     #if namespace.command:
     #    for command in namespace.command:


-- 
To view, visit http://gerrit.ovirt.org/16283
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b3974cb6713732776fd0c9430e2ba7b5c9ee2cb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list