aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDanilo Segan <danilo@canonical.com>2012-08-23 19:09:20 +0200
committerDanilo Segan <danilo@canonical.com>2012-08-23 19:09:20 +0200
commit641fa63238c7cdc8321c00537ad9ab12e66db4bb (patch)
treec4afa065e7f89787a953154ddd05d9d21cc58a5d /scripts
parenta1b406a9d9278cf1c8b5a570148fc2bd973c1c2b (diff)
Use the subprocess options compatible with python2.6 standard library version.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/linaroscript.py4
-rwxr-xr-xscripts/update-deployment.py20
2 files changed, 18 insertions, 6 deletions
diff --git a/scripts/linaroscript.py b/scripts/linaroscript.py
index 77faa1e..7bb40e6 100644
--- a/scripts/linaroscript.py
+++ b/scripts/linaroscript.py
@@ -55,8 +55,10 @@ class LinaroScript(object):
if verbosity == 0:
logging_level = logging.ERROR
elif verbosity == 1:
+ logging_level = logging.WARNING
+ elif verbosity == 2:
logging_level = logging.INFO
- elif verbosity >= 2:
+ elif verbosity >= 3:
logging_level = logging.DEBUG
else:
logging_level = logging.ERROR
diff --git a/scripts/update-deployment.py b/scripts/update-deployment.py
index 32114ea..6cfca6b 100755
--- a/scripts/update-deployment.py
+++ b/scripts/update-deployment.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python
"""Update a deployment of lp:linaro-license-protection.
@@ -84,6 +84,16 @@ class UpdateDeploymentScript(LinaroScript):
code_tree = bzrlib.workingtree.WorkingTree.open(working_tree_dir)
code_tree.update()
+ def run_subcommand(self, arguments, cwd=None):
+ process = subprocess.Popen(arguments, cwd=cwd)
+ process_out, process_err = process.communicate()
+ if process_out is not None:
+ logger.debug("stdout:\n" + "\n\t".join(process_out.splitlines()))
+ if process_err is not None:
+ logger.debug("stderr:\n" + "\n\t".join(process_err.splitlines()))
+ if process.returncode != 0:
+ logger.error("FAILED %d", process.returncode)
+
def update_installation(self, config, installation_root):
"""Updates a single installation code and databases.
@@ -108,13 +118,13 @@ class UpdateDeploymentScript(LinaroScript):
os.environ.get("DJANGO_SETTINGS_MODULE"))
self.logger.debug("Doing 'syncdb'...")
- self.logger.debug(subprocess.check_output(
- ["django-admin", "syncdb", "--noinput"], cwd=code_root))
+ self.run_subcommand(
+ ["django-admin", "syncdb", "--noinput"], cwd=code_root)
self.logger.debug("Doing 'collectstatic'...")
- self.logger.debug(subprocess.check_output(
+ self.run_subcommand(
["django-admin", "collectstatic", "--noinput"],
- cwd=code_root))
+ cwd=code_root)
def setup_parser(self):
super(UpdateDeploymentScript, self).setup_parser()