Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2013-01-14 11:01:37 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2013-01-14 11:01:37 (GMT)
commita75122d1f6b3cbdfb6456e4e559d66e6b8d77e25 (patch)
treece0328a09fa930c30c289487c6976775334dedfb
parent8be37beabcbaef276a45a44ff94c8ea293c3f05a (diff)
Make system check interactive in all commands
-rwxr-xr-xcommands/check-system10
-rw-r--r--commands/common.py7
-rw-r--r--devbot/command.py8
-rw-r--r--devbot/plugins/debian.py6
-rw-r--r--devbot/plugins/fedora.py6
5 files changed, 19 insertions, 18 deletions
diff --git a/commands/check-system b/commands/check-system
index 4429d90..f92e491 100755
--- a/commands/check-system
+++ b/commands/check-system
@@ -14,17 +14,9 @@ parser.add_argument("--test", action="store_true",
help="don't add or remove packages, test only")
args = parser.parse_args()
-interactive = "SUGAR_BUILDBOT" not in os.environ
-
check_args = {"update": args.update,
"remove": args.remove,
"test": args.test,
- "interactive": interactive,
"lazy": False}
-setup_args = {"check_args": check_args}
-
-if not interactive:
- setup_args["log_name"] = "check-system"
-
-common.setup(**setup_args)
+common.setup(log_name="check-system", check_args=check_args)
diff --git a/commands/common.py b/commands/common.py
index c09da54..30bbdc2 100644
--- a/commands/common.py
+++ b/commands/common.py
@@ -9,6 +9,8 @@ from devbot import main
def setup(log_name=None, check_args={}):
+ is_buildbot = "SUGAR_BUILDBOT" in os.environ
+
config_args = {"config_dir": os.path.join(base_dir, "config"),
"install_dir": os.path.join(base_dir, "install"),
"source_dir": os.path.join(base_dir, "source"),
@@ -16,10 +18,13 @@ def setup(log_name=None, check_args={}):
"state_dir": os.path.join(base_dir, "state"),
"prefs_path": os.path.join(base_dir, "prefs"),
"logs_dir": os.path.join(base_dir, "logs"),
- "relocatable": "SUGAR_BUILDBOT" in os.environ}
+ "relocatable": is_buildbot}
if log_name:
config_args["log_name"] = log_name
+ if is_buildbot:
+ check_args["interactive"] = False
+
if not main.setup(config_args, check_args):
sys.exit(1)
diff --git a/devbot/command.py b/devbot/command.py
index 0d9c809..b3bd6fc 100644
--- a/devbot/command.py
+++ b/devbot/command.py
@@ -4,7 +4,7 @@ import time
from devbot import config
-def run(args, test=False, retry=0):
+def run(args, test=False, interactive=False, retry=0):
if test:
print " ".join(args)
return
@@ -12,7 +12,7 @@ def run(args, test=False, retry=0):
log_file = None
subprocess_args = {"args": args}
- if config.log_path:
+ if config.log_path and not interactive:
log_file = open(config.log_path, "a")
subprocess_args["stdout"] = log_file
subprocess_args["stderr"] = subprocess.STDOUT
@@ -38,10 +38,10 @@ def run(args, test=False, retry=0):
log_file.close()
-def run_with_sudo(args, test=False, retry=0):
+def run_with_sudo(args, test=False, interactive=False, retry=0):
args_with_sudo = ["sudo"]
args_with_sudo.extend(args)
print " ".join(args_with_sudo)
- run(args_with_sudo, test=test, retry=retry)
+ run(args_with_sudo, test=test, retry=retry, interactive=interactive)
diff --git a/devbot/plugins/debian.py b/devbot/plugins/debian.py
index a4e4d67..437846d 100644
--- a/devbot/plugins/debian.py
+++ b/devbot/plugins/debian.py
@@ -23,7 +23,8 @@ class PackageManager(interfaces.PackageManager):
args.append("install")
args.extend(packages)
- command.run_with_sudo(args, test=self._test)
+ command.run_with_sudo(args, test=self._test,
+ interactive=self._interactive)
def remove_packages(self, packages):
args = ["dpkg", "-P"]
@@ -41,7 +42,8 @@ class PackageManager(interfaces.PackageManager):
args.append("upgrade")
- command.run_with_sudo(args, test=self._test)
+ command.run_with_sudo(args, test=self._test,
+ interactive=self._interactive)
def find_all(self):
return [package.name for package in self._cache
diff --git a/devbot/plugins/fedora.py b/devbot/plugins/fedora.py
index 2e67674..d1a2936 100644
--- a/devbot/plugins/fedora.py
+++ b/devbot/plugins/fedora.py
@@ -19,7 +19,8 @@ class PackageManager(interfaces.PackageManager):
args.append("install")
args.extend(packages)
- command.run_with_sudo(args, test=self._test)
+ command.run_with_sudo(args, test=self._test,
+ interactive=self._interactive)
def remove_packages(self, packages):
args = ["rpm", "-e"]
@@ -35,7 +36,8 @@ class PackageManager(interfaces.PackageManager):
args.append("update")
- command.run_with_sudo(args, test=self._test)
+ command.run_with_sudo(args, test=self._test,
+ interactive=self._interactive)
def find_all(self):
query_format = "--queryformat=[%{NAME} ]"