From 8d3d1978996ed0c9bc9e5a7489efb52f33fa2f88 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Thu, 27 Dec 2012 17:34:13 +0000 Subject: Expose log_path from config --- (limited to 'devbot') 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(): -- cgit v0.9.1