diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-27 17:34:13 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-27 17:34:13 (GMT) |
commit | 8d3d1978996ed0c9bc9e5a7489efb52f33fa2f88 (patch) | |
tree | 0be806e0e6e02666f3f852d60bc2d726f3213405 | |
parent | 8a64d0947bb9a3afcc303015ee4bd8835be03a62 (diff) |
Expose log_path from config
-rw-r--r-- | devbot/command.py | 19 | ||||
-rw-r--r-- | devbot/config.py | 5 |
2 files changed, 9 insertions, 15 deletions
diff --git a/devbot/command.py b/devbot/command.py index 16bc9bd..73c2166 100644 --- a/devbot/command.py +++ b/devbot/command.py @@ -2,22 +2,15 @@ import subprocess import time from devbot import utils - -_log_path = None - - -def set_log_path(path): - global _log_path - _log_path = path - +from devbot import config def run(args, test=False, retry=0): if test: print " ".join(args) return - if _log_path: - stdout = open(_log_path, "a") + if config.log_path: + stdout = open(config.log_path, "a") stderr = subprocess.STDOUT else: stdout = None @@ -30,9 +23,9 @@ def run(args, test=False, retry=0): subprocess.check_call(args, stdout=stdout, stderr=stderr) break except subprocess.CalledProcessError, e: - print "\nCommand failed, tail of %s\n" % _log_path - if _log_path: - subprocess.call(["tail", _log_path]) + print "\nCommand failed, tail of %s\n" % config.log_path + if config.log_path: + subprocess.call(["tail", config.log_path]) if tries < retry + 1: print "Retrying (attempt %d) in 1 minute" % tries diff --git a/devbot/config.py b/devbot/config.py index 3faf2f4..401ef0b 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -7,7 +7,6 @@ import tempfile from devbot import distro from devbot import plugins from devbot import utils -from devbot import command config_dir = None logs_dir = None @@ -22,6 +21,7 @@ package_files = None system_lib_dirs = None home_dir = None build_state_dir = None +log_path = None _source_dir = None _build_dir = None @@ -87,8 +87,9 @@ def setup(**kwargs): _setup_state_dir(kwargs["state_dir"]) _setup_install_dir(kwargs["install_dir"], relocatable) + global log_path if "log_name" in kwargs: - command.set_log_path(create_log(kwargs["log_name"])) + log_path = create_log(kwargs["log_name"]) def get_source_dir(): |