]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Make verbosity propagate correctly to modules
authorZack Cerza <zack@cerza.org>
Fri, 11 Oct 2013 22:10:57 +0000 (17:10 -0500)
committerZack Cerza <zack@cerza.org>
Fri, 11 Oct 2013 22:10:57 +0000 (17:10 -0500)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/__init__.py
teuthology/coverage.py
teuthology/lock.py
teuthology/nuke.py
teuthology/report.py
teuthology/results.py
teuthology/run.py
teuthology/suite.py

index f153cf9eeccf80f7bff37cc1ff55a89bffba0faa..b141370aab77ebc5df518d69602c812978cc0b9c 100644 (file)
@@ -2,3 +2,7 @@ from gevent import monkey
 monkey.patch_all(dns=False)
 from .orchestra import monkey
 monkey.patch_all()
+
+import logging
+logging.basicConfig(level=logging.INFO)
+log = logging.getLogger(__name__)
index 6acc79c28fe8ce10337e347c617f36992050aacc..3ad8aadb9af12b48d742521e4aa74b1b4e553c45 100644 (file)
@@ -6,6 +6,7 @@ import subprocess
 import MySQLdb
 import yaml
 
+import teuthology
 from teuthology.misc import read_config
 
 log = logging.getLogger(__name__)
@@ -89,13 +90,9 @@ def read_coverage(output):
 
 
 def main(args):
-    loglevel = logging.INFO
     if args.verbose:
-        loglevel = logging.DEBUG
+        teuthology.log.setLevel(logging.DEBUG)
 
-    logging.basicConfig(
-        level=loglevel,
-    )
     log = logging.getLogger(__name__)
 
     read_config(args)
index 1b080aeaa2001713934535f9273adb8d1904b224..dc69e845d8e125bd00b6477e922f9da2a4396712 100644 (file)
@@ -10,16 +10,17 @@ import tempfile
 import os
 import time
 
+import teuthology
 from .config import config
 from . import lockstatus as ls
-from . import misc as teuthology
+from . import misc
 
 log = logging.getLogger(__name__)
 
 
 def lock_many(ctx, num, machinetype, user=None, description=None):
     if user is None:
-        user = teuthology.get_user()
+        user = misc.get_user()
     success, content, status = ls.send_request(
         'POST',
         config.lock_server,
@@ -53,7 +54,7 @@ def lock_many(ctx, num, machinetype, user=None, description=None):
 
 def lock_one(ctx, name, user=None, description=None):
     if user is None:
-        user = teuthology.get_user()
+        user = misc.get_user()
     success, _, _ = ls.send_request(
         'POST',
         config.lock_server + '/' + name,
@@ -67,7 +68,7 @@ def lock_one(ctx, name, user=None, description=None):
 
 def unlock_one(ctx, name, user=None):
     if user is None:
-        user = teuthology.get_user()
+        user = misc.get_user()
     success, _, _ = ls.send_request(
         'DELETE',
         config.lock_server + '/' + name + '?' +
@@ -122,15 +123,10 @@ def canonicalize_hostname(s):
 
 
 def main(ctx):
-    loglevel = logging.INFO
     if ctx.verbose:
-        loglevel = logging.DEBUG
-
-    logging.basicConfig(
-        level=loglevel,
-    )
+        teuthology.log.setLevel(logging.DEBUG)
 
-    teuthology.read_config(ctx)
+    misc.read_config(ctx)
 
     ret = 0
     user = ctx.owner
@@ -206,7 +202,7 @@ def main(ctx):
                 statuses = [status for status in statuses
                             if status['type'] == ctx.machine_type]
             if not machines and ctx.owner is None and not ctx.all:
-                ctx.owner = teuthology.get_user()
+                ctx.owner = misc.get_user()
             if ctx.owner is not None:
                 statuses = [status for status in statuses
                             if status['locked_by'] == ctx.owner]
@@ -315,7 +311,7 @@ def updatekeys(ctx):
         level=loglevel,
     )
 
-    teuthology.read_config(ctx)
+    misc.read_config(ctx)
 
     machines = [canonicalize_hostname(m) for m in ctx.machines]
 
index b17c93d2abd9621a01b0f88f80046d4f07aaccd8..822817f30dfd343b72e2b8c9188d1e30d2eb195b 100644 (file)
@@ -5,6 +5,7 @@ import subprocess
 import time
 import yaml
 
+import teuthology
 from . import orchestra
 from .orchestra import run
 from .lock import list_locks
@@ -271,13 +272,8 @@ def synch_clocks(remotes, log):
 def main(ctx):
     log = logging.getLogger(__name__)
 
-    loglevel = logging.INFO
     if ctx.verbose:
-        loglevel = logging.DEBUG
-
-    logging.basicConfig(
-        level=loglevel,
-    )
+        teuthology.log.setLevel(logging.DEBUG)
 
     info = {}
     if ctx.archive:
index cd7ac23147e667ec51a756d34fe682dd22daa45c..eb425f8c97a85533d022ed903819da86c8e9ba39 100644 (file)
@@ -6,16 +6,16 @@ import httplib2
 import urllib
 import logging
 
+import teuthology
 from teuthology.config import config
 
 
 log = logging.getLogger(__name__)
-logging.basicConfig(level=logging.INFO)
 
 
 def main(args):
     if args.verbose:
-        log.setLevel(logging.DEBUG)
+        teuthology.log.setLevel(logging.DEBUG)
 
     archive_base = os.path.abspath(os.path.expanduser(args.archive))
     reporter = ResultsReporter(archive_base, base_uri=args.server,
index a63e5c096e45c3a27ebc7e46469ea6ae6b7b59fe..37decdcdfb2760f30812b551ae6e9962c7cd7760 100644 (file)
@@ -7,6 +7,7 @@ import subprocess
 from textwrap import dedent
 from textwrap import fill
 
+import teuthology
 from teuthology import misc
 from teuthology import suite
 
@@ -16,13 +17,8 @@ log = logging.getLogger(__name__)
 def main(args):
 
     log = logging.getLogger(__name__)
-    loglevel = logging.INFO
     if args.verbose:
-        loglevel = logging.DEBUG
-
-    logging.basicConfig(
-        level=loglevel,
-    )
+        teuthology.log.setLevel(logging.DEBUG)
 
     misc.read_config(args)
 
index 36b40e9f51508d49a2981168ed0d048cfcb0cc12..eb4fe607d2558e4a7475b1064620319707115cef 100644 (file)
@@ -6,6 +6,7 @@ import sys
 import logging
 from traceback import format_tb
 
+import teuthology
 from . import report
 from .misc import get_distro
 from .misc import get_user
@@ -16,11 +17,9 @@ from .results import email_results
 
 
 def set_up_logging(ctx):
-    loglevel = logging.INFO
     if ctx.verbose:
-        loglevel = logging.DEBUG
+        teuthology.log.setLevel(logging.DEBUG)
 
-    logging.basicConfig(level=loglevel)
     if ctx.archive is not None:
         os.mkdir(ctx.archive)
 
index 43880199da1a5b59f7c71e04dee1c1a9eed3f23f..026a73ce716589c135e9935425768e28ea6e512c 100644 (file)
@@ -12,19 +12,15 @@ import subprocess
 import sys
 import yaml
 
+import teuthology
 from teuthology import lock as lock
 
 log = logging.getLogger(__name__)
 
 
 def main(args):
-    loglevel = logging.INFO
     if args.verbose:
-        loglevel = logging.DEBUG
-
-    logging.basicConfig(
-        level=loglevel,
-    )
+        teuthology.log.setLevel(logging.DEBUG)
 
     base_arg = [
         os.path.join(os.path.dirname(sys.argv[0]), 'teuthology-schedule'),